What would ”nice looking”—or ”beautiful”, for that matter—actually mean when referring to source code? I asked some programmer friends what they thought that meant. Their answers were obvious, but still worth stating:

  • Code should be locally coherent and single-functioned: One function should do exactly one thing. It should be clear about what it’s doing.
  • Local code should explain, or at least hint at the overall system design.
  • Code should be self-documenting. Comments should be avoided whenever possible. Comments duplicate work when both writing and reading code. If you need to comment something to make it understandable it should probably be rewritten.

Published

Category

micropost

Contacto