What is the purpose of this code?

No comments

There are only two hard problems in Computer Science: cache invalidation and naming things.
– Phil Karlton

We name and name and name. We name variables, functions, arguments, classes, source files, and the directories. Proper naming makes the code easier to read.

Intention-revealing names

The right name tells you why the variable, function or class exists. The name reveals what the piece of code does, and how it is used. If you need to explain the name in the comments, then the name does not reveal its intent well enough.

Disinformation

The code should not only mean what it does but also do what it says. For example, if you have a function cleanTheHouse() you’d expect it to clean the whole house and not only the kitchen or the bathroom.

Names are everywhere. Give them a meaning.

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 )

Google+ photo

You are commenting using your Google+ 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