Long Method Names

As code completion (or auto complete) has become more ubiquitous and second nature to most software developers, so also has the tendency to spend less time thinking critically about the names that we assign our variables and methods. In place of this, I have observed the likelihood to squeeze the entire purpose of the variable or method into the name (e.g. DoThisUnlessThatIsTrueAndBeGentle()). Perhaps we may soon have the entire algorithm of a method squeezed into a name (with the obvious advantage of not needing to read the method at all!). Have we lost (or forgotten) the advantage of abstracting the purpose of a variable or implementation of a method (or class) behind a simple, distinct name?

Disadvantages:
1. It's almost never possible to completely and accurately name a variable or method. Any attempt to do so may lead to more confusion.
2. Side-by-side comparisons of two versions of the same code become more painstaking with horizontal scrolling -- perhaps a bug is even missed because the developer is too lazy/busy to mess with the scrolling.
3. Constrained to multi-line formatting

Advantages:
1. More descriptive names?

I am often reminded of an article by Joel Spolsky (back when I read his stuff): http://www.joelonsoftware.com/articles/Wrong.html (scroll to the "I'm Hungary" section towards the bottom) when I ruminate on this subject.

Comments

Recent posts