views:

194

answers:

3

Hi Folks,

I can develop an application/project. But that is not in the correct coding standard. it takes large memory and others can not be understand it easily. What the General Standard to for coding. I have a question like how to name the variables methods & what is the best way to package the classes. like that?

For that, is there any tutorial or example please share .

Thanks in Advance.

+5  A: 

http://www.oracle.com/technetwork/java/codeconvtoc-136057.html

If a project you're already working on has coding standards defined, use that. Otherwise, you can follow standards like the one I linked above and make sure you're consistent in using it. It'll help make your programs readable for yourself and others.

Coding District
+1 Thanks for your response
Praveen Chandrasekaran
+6  A: 

What you need are the best-practices (JAVA) and how it works.

For that, i can recommend as an older post

as Macarse said:

Have you read Effective Java? http://java.sun.com/docs/books/effective/

There is a good amount of good code in it.

To learn how things are done (in the best way) i'll recommend to always check other people's code, especially the open source projects.

You can always check the jdk source code, there are some good algorythms around it: http://java.sun.com/j2se/1.5.0/source_license.html

Also, sometimes I use to research some good open source apps code...

edited: Also is a good idea to participate in communities like this....

Check this out: http://www.javadb.com/

as Naiku said:

The best option for you to study good code is to look at some popular open source projects. I think 2 years is good enough time to understand code in these projects. Some of the projects you could look at:

* openjdk
* apache tomcat
* spring framework
* apache commons (very useful)
* Google collections

Enough for you study and understand a variety of concepts. I frequently study code in JDK catalina(tomcat) and spring, jboss, etc.

For Java Memory Management see this Question

Garis Suero
Thanks a lot. Good work. keep answering..
Praveen Chandrasekaran
A: 

Here are few more links for Java coding standards. You will notice that it is not a hard and fast rule that these conventions needs to be followed, Developer community just adopts subset of these or whatever fits best as per their needs.

http://www.ontko.com/java/java_coding_standards.html

http://www.javarmi.com/2010/05/java-coding-standards-and-best-practices-2/

YoK