SlideShare ist ein Scribd-Unternehmen logo
1 von 31
Downloaden Sie, um offline zu lesen
Rules for documenting code
KISS
Keep it short and simple
Examples
Why do we use
comments?
Why do we use
comments?
        Comments are failure.
Explain Yourself in Code
//	
  check	
  if	
  the	
  user	
  is	
  administrator
if	
  (user.isRegistered	
  &&	
  user.privileges.equals(‘admin’))	
  {
	
  ...
}


          vs.
if	
  (user.isAdmin)	
  {
...
}
What is so bad about
         comments?
What is so bad about
         comments?
They rot.
/*	
  End	
  slide	
  */

Inaccurate comments are worse
   than no comments at all.
Bad
comments
Bad
comments
     ...most of them.
Redundant Comments
/**
	
  *	
  The	
  Loader	
  implementation	
  with	
  which	
  this	
  Container	
  is
	
  *	
  associated.
	
  */
	
  protected	
  Loader	
  loader	
  =	
  null;


/**
	
  *	
  The	
  Logger	
  implementation	
  with	
  which	
  this	
  Container	
  is
	
  *	
  associated.
	
  */
	
  protected	
  Log	
  logger	
  =	
  null;


/**
	
  *	
  The	
  Manager	
  implementation	
  with	
  which	
  this	
  Container	
  is
	
  *	
  associated.
	
  */
	
  protected	
  Manager	
  manager	
  =	
  null;
Redundant Comments

	
  protected	
  Loader	
  loader	
  =	
  null;
	
  protected	
  Log	
  logger	
  =	
  null;
	
  protected	
  Manager	
  manager	
  =	
  null;
Noise Comments
/**	
  The	
  name	
  */
private	
  String	
  name;

/**	
  The	
  version	
  */
private	
  String	
  version;

/**	
  The	
  licence	
  */
private	
  String	
  licence;
Scary Noise Comments
  /**	
  The	
  name	
  */
  private	
  String	
  name;

  /**	
  The	
  version	
  */
  private	
  String	
  version;

  /**	
  The	
  licence	
  */
  private	
  String	
  licence;

  /**	
  The	
  licence	
  */
  private	
  String	
  info;

  /**	
  The	
  licence	
  */
  private	
  String	
  help;
No Comments
private	
  String	
  name;
private	
  String	
  version;
private	
  String	
  licence;
private	
  String	
  info;
private	
  String	
  help;
Closing Brace Comments

try	
  {
	
   while	
  ((line	
  =	
  in.readLine())	
  !=	
  null)	
  {
	
   ...	
  

	
   }	
  //	
  while

}	
  //	
  try
Commented-out Code

public	
  class	
  Program
{
	
  	
  	
  	
  static	
  void	
  Main(string[]	
  args)
	
  	
  	
  	
  {
	
  	
  	
  	
  	
  	
  	
  	
  /*	
  This	
  block	
  of	
  code	
  is	
  no	
  longer	
  needed
	
  	
  	
  	
  	
  	
  	
  	
  	
  *	
  because	
  we	
  found	
  out	
  that	
  Y2K	
  was	
  a	
  hoax
	
  	
  	
  	
  	
  	
  	
  	
  	
  *	
  and	
  our	
  systems	
  did	
  not	
  roll	
  over	
  to	
  1/1/1900	
  */
	
  	
  	
  	
  	
  	
  	
  	
  //DateTime	
  today	
  =	
  DateTime.Today;
	
  	
  	
  	
  	
  	
  	
  	
  //if	
  (today	
  ==	
  new	
  DateTime(1900,	
  1,	
  1))
	
  	
  	
  	
  	
  	
  	
  	
  //{
	
  	
  	
  	
  	
  	
  	
  	
  //	
  	
  	
  	
  today	
  =	
  today.AddYears(100);
	
  	
  	
  	
  	
  	
  	
  	
  //	
  	
  	
  	
  string	
  message	
  =	
  "The	
  date	
  has	
  been	
  fixed	
  for	
  Y2K.";
	
  	
  	
  	
  	
  	
  	
  	
  //	
  	
  	
  	
  Console.WriteLine(message);
	
  	
  	
  	
  	
  	
  	
  	
  //}
	
  	
  	
  	
  }

}
HTML Tags in Comments
/**
	
  *	
  Task	
  to	
  run	
  fit	
  tests.	
  This	
  task	
  runs	
  fitnesse	
  tests	
  and	
  publishes	
  
the	
  results.
	
  *	
  
	
  *	
  <pre>
	
  *	
  Usage:
	
  *	
  &lt;taskdef	
  name=&quot;execute-­‐fitnesse-­‐tests&quot;	
  
classname=&quot;fitnesse.ant.ExecuteFitnesseTestsTask&quot;	
  
classpathref=&quot;classpath&quot;	
  /&gt;
	
  *	
  OR
	
  *	
  &lt;taskdef	
  classpathref=&quot;classpath&quot;	
  
resource=&quot;tasks.properties&quot;	
  /&gt;
	
  *	
  
	
  *	
  &lt;execute-­‐fitnesse-­‐tests	
  
suitepage=&quot;FitNesse.SuiteAcceptanceTests&quot;	
  
fitnesseport=&quot;8082&quot;	
  resultsdir=&quot;${results.dir}&quot;	
  
resultshtmlpage=&quot;fit-­‐results.html&quot;	
  
classpathref=&quot;classpath&quot;	
  /&gt;
	
  *	
  </pre>
	
  */
Good
comments
Informative Comments

//	
  format	
  matched	
  kk:mm:ss	
  EEE,	
  MMM	
  dd,	
  yyyy
Pattern	
  timeMatcher	
  =	
  Pattern.compile(
             “d*:d*:d*	
  w*,	
  w*	
  d*,	
  d*”);
Warning of Consequences Comments
  //	
  Don’t	
  run	
  unless	
  you
  //	
  have	
  some	
  time	
  to	
  kill
  public	
  void	
  _testWithReallyBigFile()	
  {
  	
   writeLinesToFile(100000000);

  	
   response.setBody(testFile);
  	
   response.readyToSend(this);
  	
   String	
  responseString	
  =	
  output.toString();
  	
   assertSubString(“Content-­‐Length:	
  100000000”,	
  
  	
  	
  	
  	
  	
  	
  	
  	
  responseString);
  	
   assertTrue(bytesSent	
  >	
  100000000)
  }
TODO Comments

//	
  TODO:	
  Refactor	
  this	
  code
TODO Comments

            //	
  TODO:	
  Refactor	
  this	
  code


  //	
  FIXME:	
  This	
  won't	
  work	
  if	
  the	
  file	
  is	
  
                           missing.	
  

//	
  XXX:	
  This	
  method	
  badly	
  needs	
  refactoring:	
  
               should	
  switch	
  by	
  core	
  type.
Dynamic
comments
Tests as Documentation


Unit tests = code level documentation
Behaviour tests = feature documentation
Jnario.org
Message
Try to write clear self-explanatory code.
Avoid comments if possible.
Thanks
References
Prowareness blog
http://www.prowareness.com/blog/anti-agile-manisfesto/

Clean Code (A Handbook of Agile Software Craftsmanship)
Robert C. Martin

Jnario
http://jnario.org/

Weitere ähnliche Inhalte

Was ist angesagt?

Unit/Integration Testing using Spock
Unit/Integration Testing using SpockUnit/Integration Testing using Spock
Unit/Integration Testing using SpockAnuj Aneja
 
Mutation Testing: Testing your tests
Mutation Testing: Testing your testsMutation Testing: Testing your tests
Mutation Testing: Testing your testsStephen Leigh
 
Java performance
Java performanceJava performance
Java performanceSergey D
 
Preview of Groovy 3
Preview of Groovy 3Preview of Groovy 3
Preview of Groovy 3Vijay Shukla
 
Java concurrency in practice
Java concurrency in practiceJava concurrency in practice
Java concurrency in practiceMikalai Alimenkou
 
Java - Singleton Pattern
Java - Singleton PatternJava - Singleton Pattern
Java - Singleton PatternCharles Casadei
 
All about unit testing using (power) mock
All about unit testing using (power) mockAll about unit testing using (power) mock
All about unit testing using (power) mockPranalee Rokde
 
Testable JavaScript: Application Architecture
Testable JavaScript:  Application ArchitectureTestable JavaScript:  Application Architecture
Testable JavaScript: Application ArchitectureMark Trostler
 
Mockito vs JMockit, battle of the mocking frameworks
Mockito vs JMockit, battle of the mocking frameworksMockito vs JMockit, battle of the mocking frameworks
Mockito vs JMockit, battle of the mocking frameworksEndranNL
 
JavaScript Tutorial For Beginners | JavaScript Training | JavaScript Programm...
JavaScript Tutorial For Beginners | JavaScript Training | JavaScript Programm...JavaScript Tutorial For Beginners | JavaScript Training | JavaScript Programm...
JavaScript Tutorial For Beginners | JavaScript Training | JavaScript Programm...Edureka!
 
Working Effectively With Legacy Code
Working Effectively With Legacy CodeWorking Effectively With Legacy Code
Working Effectively With Legacy CodeNaresh Jain
 
Appium TestNG Framework and Multi-Device Automation Execution
Appium TestNG Framework and Multi-Device Automation ExecutionAppium TestNG Framework and Multi-Device Automation Execution
Appium TestNG Framework and Multi-Device Automation ExecutionpCloudy
 
JAVASCRIPT TDD(Test driven Development) & Qunit Tutorial
JAVASCRIPT TDD(Test driven Development) & Qunit TutorialJAVASCRIPT TDD(Test driven Development) & Qunit Tutorial
JAVASCRIPT TDD(Test driven Development) & Qunit TutorialAnup Singh
 

Was ist angesagt? (20)

Unit testing concurrent code
Unit testing concurrent codeUnit testing concurrent code
Unit testing concurrent code
 
Unit/Integration Testing using Spock
Unit/Integration Testing using SpockUnit/Integration Testing using Spock
Unit/Integration Testing using Spock
 
Mutation Testing: Testing your tests
Mutation Testing: Testing your testsMutation Testing: Testing your tests
Mutation Testing: Testing your tests
 
Java performance
Java performanceJava performance
Java performance
 
Preview of Groovy 3
Preview of Groovy 3Preview of Groovy 3
Preview of Groovy 3
 
Java concurrency in practice
Java concurrency in practiceJava concurrency in practice
Java concurrency in practice
 
Java - Singleton Pattern
Java - Singleton PatternJava - Singleton Pattern
Java - Singleton Pattern
 
All about unit testing using (power) mock
All about unit testing using (power) mockAll about unit testing using (power) mock
All about unit testing using (power) mock
 
Testable JavaScript: Application Architecture
Testable JavaScript:  Application ArchitectureTestable JavaScript:  Application Architecture
Testable JavaScript: Application Architecture
 
6.Spring DI_1
6.Spring DI_16.Spring DI_1
6.Spring DI_1
 
JMockit
JMockitJMockit
JMockit
 
Tdd & unit test
Tdd & unit testTdd & unit test
Tdd & unit test
 
Mockito vs JMockit, battle of the mocking frameworks
Mockito vs JMockit, battle of the mocking frameworksMockito vs JMockit, battle of the mocking frameworks
Mockito vs JMockit, battle of the mocking frameworks
 
JavaScript Tutorial For Beginners | JavaScript Training | JavaScript Programm...
JavaScript Tutorial For Beginners | JavaScript Training | JavaScript Programm...JavaScript Tutorial For Beginners | JavaScript Training | JavaScript Programm...
JavaScript Tutorial For Beginners | JavaScript Training | JavaScript Programm...
 
Working Effectively With Legacy Code
Working Effectively With Legacy CodeWorking Effectively With Legacy Code
Working Effectively With Legacy Code
 
Mockito intro
Mockito introMockito intro
Mockito intro
 
Appium TestNG Framework and Multi-Device Automation Execution
Appium TestNG Framework and Multi-Device Automation ExecutionAppium TestNG Framework and Multi-Device Automation Execution
Appium TestNG Framework and Multi-Device Automation Execution
 
JAVASCRIPT TDD(Test driven Development) & Qunit Tutorial
JAVASCRIPT TDD(Test driven Development) & Qunit TutorialJAVASCRIPT TDD(Test driven Development) & Qunit Tutorial
JAVASCRIPT TDD(Test driven Development) & Qunit Tutorial
 
G pars
G parsG pars
G pars
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 

Andere mochten auch

Evaluation of a Multi-EMR web-based Form
Evaluation of a Multi-EMR web-based FormEvaluation of a Multi-EMR web-based Form
Evaluation of a Multi-EMR web-based FormKarim Keshavjee
 
חוות דעת לביתהמשפט המחוזי בפתח תקוה 2012 (1)
חוות דעת לביתהמשפט המחוזי בפתח תקוה 2012 (1)חוות דעת לביתהמשפט המחוזי בפתח תקוה 2012 (1)
חוות דעת לביתהמשפט המחוזי בפתח תקוה 2012 (1)Anochi.com.
 
Learning Presentations - List of Principles with Resources
Learning Presentations - List of Principles with ResourcesLearning Presentations - List of Principles with Resources
Learning Presentations - List of Principles with ResourcesIlene Dawn Alexander
 
חינוך ומדיניות סביבתית בישראל
חינוך ומדיניות סביבתית בישראלחינוך ומדיניות סביבתית בישראל
חינוך ומדיניות סביבתית בישראלAnochi.com.
 
בחירות בארהב 2012 – עדכונים וטיפים לימים האחרונים במירוץ לנשיאות
בחירות בארהב 2012 – עדכונים וטיפים לימים האחרונים במירוץ לנשיאותבחירות בארהב 2012 – עדכונים וטיפים לימים האחרונים במירוץ לנשיאות
בחירות בארהב 2012 – עדכונים וטיפים לימים האחרונים במירוץ לנשיאותAnochi.com.
 
מקבץ יצירות אפרים קישון
מקבץ יצירות    אפרים קישוןמקבץ יצירות    אפרים קישון
מקבץ יצירות אפרים קישוןAnochi.com.
 
White Paper on Revenue Leakage in Prossional Services Firm
White Paper on Revenue Leakage in Prossional Services FirmWhite Paper on Revenue Leakage in Prossional Services Firm
White Paper on Revenue Leakage in Prossional Services FirmSevera PSA
 
5 strategi pembelajaran_berbasis_tik
5 strategi pembelajaran_berbasis_tik5 strategi pembelajaran_berbasis_tik
5 strategi pembelajaran_berbasis_tikMASHANS
 
Universal design enacting accessible discussions
Universal design   enacting accessible discussionsUniversal design   enacting accessible discussions
Universal design enacting accessible discussionsIlene Dawn Alexander
 
Blackbookcommunism
BlackbookcommunismBlackbookcommunism
BlackbookcommunismAnochi.com.
 
שורשי המשבר
שורשי המשברשורשי המשבר
שורשי המשברAnochi.com.
 
Creating Accessible Presentation Slides
Creating Accessible Presentation SlidesCreating Accessible Presentation Slides
Creating Accessible Presentation SlidesIlene Dawn Alexander
 
SmartKal in 1 minute
SmartKal in 1 minuteSmartKal in 1 minute
SmartKal in 1 minuteyklub
 
2013 07-31-02 (1) נגב טקסטיל
2013 07-31-02 (1) נגב טקסטיל2013 07-31-02 (1) נגב טקסטיל
2013 07-31-02 (1) נגב טקסטילAnochi.com.
 
IGU Gas Price Report _2014
IGU Gas Price Report _2014IGU Gas Price Report _2014
IGU Gas Price Report _2014Anochi.com.
 
Multicultural/Inclusive Learning & Teaching Philosophy
Multicultural/Inclusive Learning & Teaching PhilosophyMulticultural/Inclusive Learning & Teaching Philosophy
Multicultural/Inclusive Learning & Teaching PhilosophyIlene Dawn Alexander
 
חגי גולדמן מיה מחשבים
חגי גולדמן מיה מחשביםחגי גולדמן מיה מחשבים
חגי גולדמן מיה מחשביםAnochi.com.
 
The hamas covenant
The hamas covenantThe hamas covenant
The hamas covenantAnochi.com.
 
הצעה להחלטת ממשלה אנרגיה מתחדשת609
הצעה להחלטת ממשלה אנרגיה מתחדשת609הצעה להחלטת ממשלה אנרגיה מתחדשת609
הצעה להחלטת ממשלה אנרגיה מתחדשת609Anochi.com.
 

Andere mochten auch (20)

Evaluation of a Multi-EMR web-based Form
Evaluation of a Multi-EMR web-based FormEvaluation of a Multi-EMR web-based Form
Evaluation of a Multi-EMR web-based Form
 
Picturebookhalloween
PicturebookhalloweenPicturebookhalloween
Picturebookhalloween
 
חוות דעת לביתהמשפט המחוזי בפתח תקוה 2012 (1)
חוות דעת לביתהמשפט המחוזי בפתח תקוה 2012 (1)חוות דעת לביתהמשפט המחוזי בפתח תקוה 2012 (1)
חוות דעת לביתהמשפט המחוזי בפתח תקוה 2012 (1)
 
Learning Presentations - List of Principles with Resources
Learning Presentations - List of Principles with ResourcesLearning Presentations - List of Principles with Resources
Learning Presentations - List of Principles with Resources
 
חינוך ומדיניות סביבתית בישראל
חינוך ומדיניות סביבתית בישראלחינוך ומדיניות סביבתית בישראל
חינוך ומדיניות סביבתית בישראל
 
בחירות בארהב 2012 – עדכונים וטיפים לימים האחרונים במירוץ לנשיאות
בחירות בארהב 2012 – עדכונים וטיפים לימים האחרונים במירוץ לנשיאותבחירות בארהב 2012 – עדכונים וטיפים לימים האחרונים במירוץ לנשיאות
בחירות בארהב 2012 – עדכונים וטיפים לימים האחרונים במירוץ לנשיאות
 
מקבץ יצירות אפרים קישון
מקבץ יצירות    אפרים קישוןמקבץ יצירות    אפרים קישון
מקבץ יצירות אפרים קישון
 
White Paper on Revenue Leakage in Prossional Services Firm
White Paper on Revenue Leakage in Prossional Services FirmWhite Paper on Revenue Leakage in Prossional Services Firm
White Paper on Revenue Leakage in Prossional Services Firm
 
5 strategi pembelajaran_berbasis_tik
5 strategi pembelajaran_berbasis_tik5 strategi pembelajaran_berbasis_tik
5 strategi pembelajaran_berbasis_tik
 
Universal design enacting accessible discussions
Universal design   enacting accessible discussionsUniversal design   enacting accessible discussions
Universal design enacting accessible discussions
 
Blackbookcommunism
BlackbookcommunismBlackbookcommunism
Blackbookcommunism
 
שורשי המשבר
שורשי המשברשורשי המשבר
שורשי המשבר
 
Creating Accessible Presentation Slides
Creating Accessible Presentation SlidesCreating Accessible Presentation Slides
Creating Accessible Presentation Slides
 
SmartKal in 1 minute
SmartKal in 1 minuteSmartKal in 1 minute
SmartKal in 1 minute
 
2013 07-31-02 (1) נגב טקסטיל
2013 07-31-02 (1) נגב טקסטיל2013 07-31-02 (1) נגב טקסטיל
2013 07-31-02 (1) נגב טקסטיל
 
IGU Gas Price Report _2014
IGU Gas Price Report _2014IGU Gas Price Report _2014
IGU Gas Price Report _2014
 
Multicultural/Inclusive Learning & Teaching Philosophy
Multicultural/Inclusive Learning & Teaching PhilosophyMulticultural/Inclusive Learning & Teaching Philosophy
Multicultural/Inclusive Learning & Teaching Philosophy
 
חגי גולדמן מיה מחשבים
חגי גולדמן מיה מחשביםחגי גולדמן מיה מחשבים
חגי גולדמן מיה מחשבים
 
The hamas covenant
The hamas covenantThe hamas covenant
The hamas covenant
 
הצעה להחלטת ממשלה אנרגיה מתחדשת609
הצעה להחלטת ממשלה אנרגיה מתחדשת609הצעה להחלטת ממשלה אנרגיה מתחדשת609
הצעה להחלטת ממשלה אנרגיה מתחדשת609
 

Ähnlich wie Commenting in Agile Development

Back-2-Basics: .NET Coding Standards For The Real World (2011)
Back-2-Basics: .NET Coding Standards For The Real World (2011)Back-2-Basics: .NET Coding Standards For The Real World (2011)
Back-2-Basics: .NET Coding Standards For The Real World (2011)David McCarter
 
Clean code _v2003
 Clean code _v2003 Clean code _v2003
Clean code _v2003R696
 
Effecient javascript
Effecient javascriptEffecient javascript
Effecient javascriptmpnkhan
 
FileWrite.javaFileWrite.java  To change this license header.docx
FileWrite.javaFileWrite.java  To change this license header.docxFileWrite.javaFileWrite.java  To change this license header.docx
FileWrite.javaFileWrite.java  To change this license header.docxssuser454af01
 
Code Documentation. That ugly thing...
Code Documentation. That ugly thing...Code Documentation. That ugly thing...
Code Documentation. That ugly thing...Christos Manios
 
Treatment, Architecture and Threads
Treatment, Architecture and ThreadsTreatment, Architecture and Threads
Treatment, Architecture and ThreadsMathias Seguy
 
First Failure Data Capture for your enterprise application with WebSphere App...
First Failure Data Capture for your enterprise application with WebSphere App...First Failure Data Capture for your enterprise application with WebSphere App...
First Failure Data Capture for your enterprise application with WebSphere App...Rohit Kelapure
 
Bring the fun back to java
Bring the fun back to javaBring the fun back to java
Bring the fun back to javaciklum_ods
 
Speed up your developments with Symfony2
Speed up your developments with Symfony2Speed up your developments with Symfony2
Speed up your developments with Symfony2Hugo Hamon
 
Krazykoder struts2 annotations
Krazykoder struts2 annotationsKrazykoder struts2 annotations
Krazykoder struts2 annotationsKrazy Koder
 
TypeScript for Java Developers
TypeScript for Java DevelopersTypeScript for Java Developers
TypeScript for Java DevelopersYakov Fain
 
Eric Lafortune - ProGuard: Optimizer and obfuscator in the Android SDK
Eric Lafortune - ProGuard: Optimizer and obfuscator in the Android SDKEric Lafortune - ProGuard: Optimizer and obfuscator in the Android SDK
Eric Lafortune - ProGuard: Optimizer and obfuscator in the Android SDKGuardSquare
 
Droidcon2013 pro guard, optimizer and obfuscator in the android sdk_eric lafo...
Droidcon2013 pro guard, optimizer and obfuscator in the android sdk_eric lafo...Droidcon2013 pro guard, optimizer and obfuscator in the android sdk_eric lafo...
Droidcon2013 pro guard, optimizer and obfuscator in the android sdk_eric lafo...Droidcon Berlin
 
OOP2017: Containerized End-2-End Testing – automate it!
OOP2017: Containerized End-2-End Testing – automate it!OOP2017: Containerized End-2-End Testing – automate it!
OOP2017: Containerized End-2-End Testing – automate it!Tobias Schneck
 
Dart for Java Developers
Dart for Java DevelopersDart for Java Developers
Dart for Java DevelopersYakov Fain
 

Ähnlich wie Commenting in Agile Development (20)

Back-2-Basics: .NET Coding Standards For The Real World (2011)
Back-2-Basics: .NET Coding Standards For The Real World (2011)Back-2-Basics: .NET Coding Standards For The Real World (2011)
Back-2-Basics: .NET Coding Standards For The Real World (2011)
 
Clean code _v2003
 Clean code _v2003 Clean code _v2003
Clean code _v2003
 
Clean code slide
Clean code slideClean code slide
Clean code slide
 
Effecient javascript
Effecient javascriptEffecient javascript
Effecient javascript
 
FileWrite.javaFileWrite.java  To change this license header.docx
FileWrite.javaFileWrite.java  To change this license header.docxFileWrite.javaFileWrite.java  To change this license header.docx
FileWrite.javaFileWrite.java  To change this license header.docx
 
Code Documentation. That ugly thing...
Code Documentation. That ugly thing...Code Documentation. That ugly thing...
Code Documentation. That ugly thing...
 
Treatment, Architecture and Threads
Treatment, Architecture and ThreadsTreatment, Architecture and Threads
Treatment, Architecture and Threads
 
First Failure Data Capture for your enterprise application with WebSphere App...
First Failure Data Capture for your enterprise application with WebSphere App...First Failure Data Capture for your enterprise application with WebSphere App...
First Failure Data Capture for your enterprise application with WebSphere App...
 
J Unit
J UnitJ Unit
J Unit
 
Bring the fun back to java
Bring the fun back to javaBring the fun back to java
Bring the fun back to java
 
Speed up your developments with Symfony2
Speed up your developments with Symfony2Speed up your developments with Symfony2
Speed up your developments with Symfony2
 
Krazykoder struts2 annotations
Krazykoder struts2 annotationsKrazykoder struts2 annotations
Krazykoder struts2 annotations
 
TypeScript for Java Developers
TypeScript for Java DevelopersTypeScript for Java Developers
TypeScript for Java Developers
 
Clean code
Clean codeClean code
Clean code
 
Eric Lafortune - ProGuard: Optimizer and obfuscator in the Android SDK
Eric Lafortune - ProGuard: Optimizer and obfuscator in the Android SDKEric Lafortune - ProGuard: Optimizer and obfuscator in the Android SDK
Eric Lafortune - ProGuard: Optimizer and obfuscator in the Android SDK
 
Droidcon2013 pro guard, optimizer and obfuscator in the android sdk_eric lafo...
Droidcon2013 pro guard, optimizer and obfuscator in the android sdk_eric lafo...Droidcon2013 pro guard, optimizer and obfuscator in the android sdk_eric lafo...
Droidcon2013 pro guard, optimizer and obfuscator in the android sdk_eric lafo...
 
OOP2017: Containerized End-2-End Testing – automate it!
OOP2017: Containerized End-2-End Testing – automate it!OOP2017: Containerized End-2-End Testing – automate it!
OOP2017: Containerized End-2-End Testing – automate it!
 
Dart for Java Developers
Dart for Java DevelopersDart for Java Developers
Dart for Java Developers
 
Demystifying Maven
Demystifying MavenDemystifying Maven
Demystifying Maven
 
Android - Anatomy of android elements & layouts
Android - Anatomy of android elements & layoutsAndroid - Anatomy of android elements & layouts
Android - Anatomy of android elements & layouts
 

Mehr von Jan Rybák Benetka

SDSC21 - Are We Back to Normal Yet? The Impact of Covid on Human Mobility
SDSC21 - Are We Back to Normal Yet? The Impact of Covid on Human MobilitySDSC21 - Are We Back to Normal Yet? The Impact of Covid on Human Mobility
SDSC21 - Are We Back to Normal Yet? The Impact of Covid on Human MobilityJan Rybák Benetka
 
Anticipating Information Needs Based on Check-in Activity
Anticipating Information Needs Based on Check-in ActivityAnticipating Information Needs Based on Check-in Activity
Anticipating Information Needs Based on Check-in ActivityJan Rybák Benetka
 
IR Game: How well do you know information retrieval papers?
IR Game: How well do you know information retrieval papers?IR Game: How well do you know information retrieval papers?
IR Game: How well do you know information retrieval papers?Jan Rybák Benetka
 
COST DATA VIS - Prototype presentation
COST DATA VIS - Prototype presentationCOST DATA VIS - Prototype presentation
COST DATA VIS - Prototype presentationJan Rybák Benetka
 
Jenda Rybák - Master's Thesis Theme Presentation
Jenda Rybák - Master's Thesis Theme PresentationJenda Rybák - Master's Thesis Theme Presentation
Jenda Rybák - Master's Thesis Theme PresentationJan Rybák Benetka
 

Mehr von Jan Rybák Benetka (6)

SDSC21 - Are We Back to Normal Yet? The Impact of Covid on Human Mobility
SDSC21 - Are We Back to Normal Yet? The Impact of Covid on Human MobilitySDSC21 - Are We Back to Normal Yet? The Impact of Covid on Human Mobility
SDSC21 - Are We Back to Normal Yet? The Impact of Covid on Human Mobility
 
Anticipating Information Needs Based on Check-in Activity
Anticipating Information Needs Based on Check-in ActivityAnticipating Information Needs Based on Check-in Activity
Anticipating Information Needs Based on Check-in Activity
 
IR Game: How well do you know information retrieval papers?
IR Game: How well do you know information retrieval papers?IR Game: How well do you know information retrieval papers?
IR Game: How well do you know information retrieval papers?
 
COST DATA VIS - Prototype presentation
COST DATA VIS - Prototype presentationCOST DATA VIS - Prototype presentation
COST DATA VIS - Prototype presentation
 
Project: Coworking spaces
Project: Coworking spacesProject: Coworking spaces
Project: Coworking spaces
 
Jenda Rybák - Master's Thesis Theme Presentation
Jenda Rybák - Master's Thesis Theme PresentationJenda Rybák - Master's Thesis Theme Presentation
Jenda Rybák - Master's Thesis Theme Presentation
 

Kürzlich hochgeladen

From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 

Kürzlich hochgeladen (20)

From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 

Commenting in Agile Development

  • 3. Keep it short and simple
  • 5. Why do we use comments?
  • 6. Why do we use comments? Comments are failure.
  • 7. Explain Yourself in Code //  check  if  the  user  is  administrator if  (user.isRegistered  &&  user.privileges.equals(‘admin’))  {  ... } vs. if  (user.isAdmin)  { ... }
  • 8. What is so bad about comments?
  • 9. What is so bad about comments? They rot.
  • 10. /*  End  slide  */ Inaccurate comments are worse than no comments at all.
  • 12. Bad comments ...most of them.
  • 13. Redundant Comments /**  *  The  Loader  implementation  with  which  this  Container  is  *  associated.  */  protected  Loader  loader  =  null; /**  *  The  Logger  implementation  with  which  this  Container  is  *  associated.  */  protected  Log  logger  =  null; /**  *  The  Manager  implementation  with  which  this  Container  is  *  associated.  */  protected  Manager  manager  =  null;
  • 14. Redundant Comments  protected  Loader  loader  =  null;  protected  Log  logger  =  null;  protected  Manager  manager  =  null;
  • 15. Noise Comments /**  The  name  */ private  String  name; /**  The  version  */ private  String  version; /**  The  licence  */ private  String  licence;
  • 16. Scary Noise Comments /**  The  name  */ private  String  name; /**  The  version  */ private  String  version; /**  The  licence  */ private  String  licence; /**  The  licence  */ private  String  info; /**  The  licence  */ private  String  help;
  • 17. No Comments private  String  name; private  String  version; private  String  licence; private  String  info; private  String  help;
  • 18. Closing Brace Comments try  {   while  ((line  =  in.readLine())  !=  null)  {   ...     }  //  while }  //  try
  • 19. Commented-out Code public  class  Program {        static  void  Main(string[]  args)        {                /*  This  block  of  code  is  no  longer  needed                  *  because  we  found  out  that  Y2K  was  a  hoax                  *  and  our  systems  did  not  roll  over  to  1/1/1900  */                //DateTime  today  =  DateTime.Today;                //if  (today  ==  new  DateTime(1900,  1,  1))                //{                //        today  =  today.AddYears(100);                //        string  message  =  "The  date  has  been  fixed  for  Y2K.";                //        Console.WriteLine(message);                //}        } }
  • 20. HTML Tags in Comments /**  *  Task  to  run  fit  tests.  This  task  runs  fitnesse  tests  and  publishes   the  results.  *    *  <pre>  *  Usage:  *  &lt;taskdef  name=&quot;execute-­‐fitnesse-­‐tests&quot;   classname=&quot;fitnesse.ant.ExecuteFitnesseTestsTask&quot;   classpathref=&quot;classpath&quot;  /&gt;  *  OR  *  &lt;taskdef  classpathref=&quot;classpath&quot;   resource=&quot;tasks.properties&quot;  /&gt;  *    *  &lt;execute-­‐fitnesse-­‐tests   suitepage=&quot;FitNesse.SuiteAcceptanceTests&quot;   fitnesseport=&quot;8082&quot;  resultsdir=&quot;${results.dir}&quot;   resultshtmlpage=&quot;fit-­‐results.html&quot;   classpathref=&quot;classpath&quot;  /&gt;  *  </pre>  */
  • 22. Informative Comments //  format  matched  kk:mm:ss  EEE,  MMM  dd,  yyyy Pattern  timeMatcher  =  Pattern.compile( “d*:d*:d*  w*,  w*  d*,  d*”);
  • 23. Warning of Consequences Comments //  Don’t  run  unless  you //  have  some  time  to  kill public  void  _testWithReallyBigFile()  {   writeLinesToFile(100000000);   response.setBody(testFile);   response.readyToSend(this);   String  responseString  =  output.toString();   assertSubString(“Content-­‐Length:  100000000”,                  responseString);   assertTrue(bytesSent  >  100000000) }
  • 24. TODO Comments //  TODO:  Refactor  this  code
  • 25. TODO Comments //  TODO:  Refactor  this  code //  FIXME:  This  won't  work  if  the  file  is   missing.   //  XXX:  This  method  badly  needs  refactoring:   should  switch  by  core  type.
  • 27. Tests as Documentation Unit tests = code level documentation Behaviour tests = feature documentation
  • 29. Message Try to write clear self-explanatory code. Avoid comments if possible.
  • 31. References Prowareness blog http://www.prowareness.com/blog/anti-agile-manisfesto/ Clean Code (A Handbook of Agile Software Craftsmanship) Robert C. Martin Jnario http://jnario.org/