Last updated 2004-06-28 by Roedy
Green ©1996-2004 Canadian Mind Products
Java definitions: 0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
You are here : home : Java Glossary : N words : naming methods and variables.
One of the most time-consuming and often neglected coding tasks, is renaming methods and variables to give ever clearer intentions. The idea is to suggest in the name exactly what the method does, no more, no less. You also want to distinguish it easily from all similar (non-overloaded) methods. You have to balance the pain you cause forcing client code to rename against the potential for confusion during future maintenance. A tool like IBM's VAJ takes out most of the pain. Most of this renaming work goes on in the early stages of code development before the first release of a class. You would be amazed how much renaming a method or variable helps you understand your own code. It greatly aids the composition process. It gives you better tools to think with.
If you can't come up with a good name for a method, there is a good chance your method is not sufficiently unified, and you should repartition the work.
If you use any variant of Hungarian notation where you put type information in your name, make sure you maintain it. If you change the type of the variable or method, you must globally rename it. Experiences with inaccurate Hungarian notation cause most maintenance programmers to detest detest all forms of Hungarian notation.
Interfaces are usually adjectives, e.g. Serializable, Externalizable. Classes that are related to each other should have names that are related e.g. BaseShape, CircularShape and RectangularShape.
home |
Canadian Mind Products | |||
| mindprod.com IP:[24.87.56.253] | ||||
| Your IP:[80.134.30.163] | ||||
| You are visitor number 844. | ||||
| Please send errors, omissions and suggestions | ||||
| to improve this page to Roedy Green. | ||||
| You can get a fresh copy of this page from: | or possibly from your local J: drive mirror: | |||
| http://mindprod.com/jgloss/naming.html | J:\mindprod\jgloss\naming.html | |||