Level 1
1 day < 1 min
LeaderboardGuest · Log in
Key point 8 of 8 · Programming Fundamentals
Estimated reading time: 5 min

Writing Good Software

Code style refers to the conventions a programmer, or an entire team, follows regarding how source code is formatted and named, distinct from what the code actually does; two programs that produce identical results can nonetheless differ enormously in how easy they are for a human being to read and understand. Common conventions cover matters such as consistent indentation, which visually reflects a program's nested structure of blocks and conditions; descriptive naming of variables and functions, so that a name like 'daysUntilExpiration' communicates its purpose far more clearly than a terse, generic name like 'x'; and a consistent, predictable arrangement of a program's overall structure, such as where functions are declared relative to where they are used. Most professional teams adopt, or write, a shared style guide and often enforce it automatically using tools, called linters and formatters, that check or even automatically rewrite code to match agreed-upon conventions, precisely so that style becomes a settled, non-controversial matter that developers no longer need to spend time debating during code review. The underlying justification for caring about style at all is a frequently repeated observation in the profession: code is read far more often than it is written, by other people and by one's own future self, which means that time invested in readability tends to pay for itself many times over across a program's lifetime.

Food for thought

Why do you think there's historiographical debate about "Writing Good Software"?