Coding Best Practices

For a software developer it is advisable to follow coding conventions. Here are some good links for coding conventions on different languages for quick reference.


Java Coding Conventions
.Net Coding Conventions
Database Naming Conventions (Oracle)
C Coding Conventions

In addition there are tools available using which you can check whether you are following best coding practices or not. For example in Java tools like PMD, FindBugs and Checkstyle are available as eclipse plugin which helps you to ensure that your code follows the recommended coding practices.


Cheers,
Kamlesh

The hidden Tomcat folder of Eclipse

In my day to day work I use eclipse 3.3.0 for java development. Eclipse provides a very convenient way to create a dynamic web application (J2EE) and configure it with a server like tomcat or JBoss within eclipse itself. When you deploy your web application in the tomcat separately, you copy the web module directory or the war file to the webapps folder of tomcat. But when you do the same using eclipse, it does not copy any file related to the web application to your tomcat deployment. So when sometime you need to debug your web application, say, by making some temporary changes in JSP files or to see the java files generated for the JSP files, at that time you need to know the actual path where eclipse stores the web application. Eclipse actually creates a tomcat like folder structure in the current workspace. Following is the path of the webapps folder where you can find your web application:
  
Eclipse_Workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps
 
Where Eclipse_Workspace is the current workspace.

 If you have not configured the server for eclipse, the org.eclipse.wst.server.core folder remains empty.   

Enjoy Learning, 

Kamlesh  

    

 

Weak References in Java

Java is said to be a civilized language due to its garbage collection feature. Weak reference is one of the useful features of Java related to garbage collector. Following is a link from Ethan Nicholas’s blog where he has explained weak references, soft references and phantom references very nicely:

http://weblogs.java.net/blog/2006/05/04/understanding-weak-references

– Kamlesh