What Makes Code Good Print

  • softwareengineering, software, performance, guide, howto, solution, zillionkinghost, hosting
  • 0

Qualities that matter.

WHAT GOOD CODE IS

Code that someone else can read, understand and change safely.

WHY THAT DEFINITION

Code is read far more often than it is written, and changed far more often than it is created.

WHAT CONTRIBUTES

Accurate names Small units with one responsibility Consistent conventions Shallow nesting Explicit behaviour Tests

WHAT DOES NOT CONTRIBUTE

Cleverness Brevity for its own sake Abstraction added in anticipation Comments explaining unclear code

WHY THAT LAST POINT

A comment explaining what code does is usually a sign the code should be clearer.

WHAT CLEVER CODE COSTS

Time, every time anyone reads it, including its author six months later.

WHAT TO OPTIMISE FOR

The reader.

WHAT TO ASK BEFORE SUBMITTING ANYTHING

Would someone unfamiliar understand this without asking me?

WHAT TO DO IF THE ANSWER IS NO

Rename, split, or simplify.

WHAT MATTERS MORE THAN ANY INDIVIDUAL RULE

Consistency across the codebase.


Was this answer helpful?
Back

Are you happy with your experience? Leave us a review on Trustpilot.


Trustpilot