Code Comments

 // enforce precondition: a to be between 0 and 59
 a = (a<0) ? 0 : ((a>59) ? 59 : a);

 http://www.stickyminds.com/testing.asp?Function=edetail&ObjectType=ART&ObjectId=9041&tth=DYN&tt=siteemail&iDyn=3
MichaelFeathers notes in the article, for example, "Long methods are easy to spot because they typically have a common form: a series of comments describing the purpose of a block of code that follows each comment." A decent heuristic is that when there is comment on a block in a long method, that block is a shorter method trying to get out, and often the comment is a guide to a good IntentionRevealingMethodName?


EditText of this page (last edited July 24, 2014) or FindPage with title or text search