Home » Java Tutorial: Java Naming Conventions

Java Tutorial: Java Naming Conventions

by tutorialsart

Java Tutorial naming conventions are recommendations, rather than rules.

Naming conventions normally come as part of project standards; these are designed to ensure that the code is written in a consistent way across different areas of the project and also even within the same class of method.

After a certain amount of time a piece of code will have been written, then maintained by several different people. If everyone writes in a different way this code is going to become more and more difficult to read.

Think of it like a book that has been written by different people with different styles, you’re never quite sure who has written the next sentence. It would be very difficult to read, as each style will interrupt your flow.

Java code is the same, you only write it once but it will be read many times by you and your colleagues. It always pays to take the extra step to make it readable.

If the rules are broken the program won’t compile; the Java compiler will complain. If the conventions are broken the program will still compile and run but it will be left to your boss and your colleagues to do the complaining.

This is a very important point to learn as a new developer. It’s one of the small things that are easy to ignore, but following the standards closely will help everyone around you and get you noticed as a careful developer who listens to requirements.

It is one of those hidden rules that in the long term is going to directly affect your bank balance. Writing code that is easy to read because it follows conventions will mark you out as someone who cares and someone who can be trusted. It is really in your best interests to follow best practices and follow the coding conventions wisely.

House style will change from project to project. When you join a new project it is very easy to slip into your style, normally the style you used on your last project. Make sure you read the coding conventions and pay careful attention to the areas where they are different to the way you are used to. Note these, so you can refer to them as necessary.

Ensure you use the new house style, not your style. If there are no coding conventions, be proactive: suggest creating some. It will help everyone in the long run and mark you out as someone who is proactive, and that’s never a bad thing.

Sun have a perfectly good set of coding conventions. This is a very good starting point for your coding conventions if you need them. You can use them just “as is” or document where you would like to deviate from these standards or just use Sun’s version.

Hypertext pre-processor

In regard to web development languages, there are several to choose from. The most widely used is PHP, which stands for hypertext pre-processor although it did originally stand for Personal Home Page when it was originally created. Social Media sites such as Facebook and Yahoo are built using PHP to give a few examples.


The second most widely used is ASP.NET which stands for Active Server Page and was created and supported by Microsoft. Now in its fourth iteration, this web platform is fully extensible and a very mature competitor to PHP in the web development industry.


The main difference between the two languages is the fact that PHP is compile on page load, so every time a user visits a page on a site, the PHP code is compile server side and the results send to the client. With ASP.NET, the source code is compile prior to deployment, meaning that the framework itself has a significantly low overhead on the server in terms of page loading speeds.

As the page is , the server simply loads the compiled file and sends it to the client. This means that on paper, the ASP.NET framework is faster than PHP. Although it must be note that PHP has some very clever caching mechanisms now available. Which minimises this performance issue considerably.

A developer who utilises both of the above languages should be hard press to tell you. What one language can do that the other could not. Choice generally depends on developer preference and provided they are a capable programmer. They will be able to produce identical systems on either platform using either language.


You may also like

Leave a Comment