Link Details

Link 139219 thumbnail
User 358503 avatar

By equivalence
via equivalence.co.uk
Published: Dec 05 2008 / 15:36

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.
  • 53
  • 3
  • 7168
  • 14

Comments

Add your comment
User 128441 avatar

je88484 replied ago:

0 votes Vote down Vote up Reply

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?

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.

Spring Integration
Written by: Soby Chacko
Featured Refcardz: Top Refcardz:
  1. Search Patterns
  2. Python
  3. C++
  4. Design Patterns
  5. OO JS
  1. PhoneGap
  2. Spring Integration
  3. Regex
  4. Git
  5. Java