Vague Identifier

This generally happens when the OneResponsibilityRule has been violated.

Example: An identifier for a class is given a very vague name because each meaningful name for the class is incomplete; it only describes part of the use of the class and not its whole responsibility.

Rather than fix the class with refactoring, the author takes the short cut and invents a name that doesn't clearly mean anything in order to avoid disinformation.

see http://www.objectmentor.com/publications/naming.htm


Can also happen in a well-factored class or method if the programmer is simply sloppy about naming things. I once came across a method called boolean NumVal?(String). Nuts. I had to search for the method's code before I found out that it returns true if every character in the string is a digit. I could think of a dozen better names for that method.

Why is NumVal? a bad name?

There may be valid reasons for the method to have these limitations, but the name of the method should reflect this.

If I saw a method called NumVal, I'd instantly expect it to return a numeric representation of the object whose method it is.


EditText of this page (last edited December 16, 2003) or FindPage with title or text search