Kent Beck’s Rules of Simple Design, #2

The code must express the intent of the programmers.

Choose good names. Variable, method, and class names should be obvious and clear. Don’t be afraid to have long names. Don’t re-use names.

Keep methods small. A reader should be able to tell at a glance what a method is doing and how it is doing it. Under ten lines is ideal.

Use standard nomenclature. Don’t use words that aren’t appropriate to the domain. Don’t use metaphors or similes. Say what you mean.

Never be cryptic or clever. Avoid complex algorithms and obfuscated code. Programming is not an intelligence contest. The easier it is to understand, the better the code will be.

Use comments appropriately. Comments should explain why, not what. If you can’t tell what the code is doing, then the code is too complicated.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: