Keep Methods Short

The more quickly we understand a method, the more quickly we can move on.

A method has a a name. The idea is that if we encounter the method being called somewhere, the name will tell us what it does so we can avoid reading the code behind it.

We advocate longer, descriptive names in order to describe what things are as unambiguously as possible. However, at some point, increasing a name’s length will make it less readable. This means that if a method does a lot, you can choose between 2 evils: A name that does not describe it well or a name that is too long to be easily readable.

Instead, we should keep our methods short enough so that that we do not have to make that choice. In other words, a method should be short enough to be easily described in a method name.

Next Article: Minimize Arguments