Thursday, March 22, 2007

Naming :: Acronyms and Abbreviations

How often do we have to look into the code when a class name or a variable name contains acronyms or abbreviations in it. For example consider the following class name:

class MyCPPProgram {};

The class name, MyCPPProgram, is correct and fine except that it can be more readable if we declared the class like this:


class MyCppProgram {};

I find the 2nd one more readable than the 1st one. We can also see a similar naming pattern in Java. For example the HttpServlet class. It's not HTTPServlet.

3 comments:

Anonymous said...

don't be a slave to a convention
this issue is readability for humans

class MyCPPprogram {};
allows acronym but reader can see the word break
of course My CPP program is a horrid example

HTTPservlet is a better example - Sun obviously doesn't like caps

abbreviations aren't acronyms and should follow the usual camelCase

Anonymous said...

i love to chat with slangs but i want to know that what exactly hmu mean online. If anybody know please reply.

Awara Pagal Deewana said...

Check out HMU Meaning here:

http://www.webacronym.com/slang-definition/hmu/

Post a Comment