Link Details

It is known that beautiful code improves readability and therefore makes maintaining such a code base easier. However, time and time again we are confronted with code that is neither elegant nor beautiful. This article attempts to address the latter by describing ways to make your code beautiful.

Posted by equivalence  |   Dec 05 2008 / 15:36

Add your comment

Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.


User 128441 avatar

je88484 replied ago:

I find the author's first point "Return from if statements as quickly as possible." ironic. For many years, I was told that one should never exit a function other than by completing the last statement in the function. Also one must never use a break to terminate a loop. Only the conditions specified in the loop statement itself should determine when to exit. These practices were widely believed necessary to uphold the principles of structured programming. These beliefs haven't disappeared. My son studied Java in high school less than 5 years ago. His instructor forbade the use of the switch because its usual use requires one to employ a break. It makes me wonder when, exactly, the programming community changed its collective mind on this? What other "truisms" of today (TDD?) will be abandoned in the next 10 years or so?

Reply 0 votes

Recommended Links

Written by: Ryan Knight
Featured Refcardz: Top Refcardz:
  1. Apache Hadoop
  2. Play
  3. Akka
  4. Debugging JavaScript
  5. Design Patterns
  1. Apache Hadoop
  2. REST
  3. Java
  4. Git
  5. Java Performance
Connect with DZone