In the old days, developers used all kinds of tricks to obscure the semantics of code; vowel collapsing, Hungarian notation, arbitrarily mixing upper and camel case, removing random letters.  The special naming codes kept everybody in a job because special knowledge was needed to maintain software.  But now programmers are unlikely to stay in the same company for ten years so consistency is important.  Others need to be able to easily understand the source code.

Whilst a whole book could be written on naming conventions, this chapter has a few favorites mostly based around the following rule: English-like source code is easy to understand.

Only the most dedicated Propellerhead will miss code like this:

Dcmt dcRef = ths.rfSmr.pfnRgen(ths,usln,rvl);

compared to this..

Document doc = submissionManager.generateReport(this,
                                   userSelections, defaultValues);  

Tip: Use common sense, but longer words are usually better.

blog comments powered by Disqus