VariablesIn addition to Sun's convention, we also go a step further by naming variables as closely as possible to the name of the class or interface they represent. For example: Code Block |
---|
StudentDao studentDao;
|
not Code Block |
---|
StudentDao dao;
|
While it might seem redundant, the reason is that a developer should never have to look through code to figure out what something is. A simple convention such as this helps tremendously not just in our Java classes, but particularly in the case of jsp pages where Eclipse cannot offer much help. Consider the following from a jsp page in the EC section of Admissions: Code Block |
---|
<c:out value="${ecAssignment.ecTerritory.ecSubRegion.name}"/>
|
Without doing any research, we know based on the names above that there are classes called EcAssignment, EcTerritory, and EcSubRegion. Had we been lazy and named those variables something like assn instead of EcAssignment, it wouldn't be clear to someone else what that name represents, and it could take a lot of work to figure out even where to even begin. |