October 12, 2007

Conventions for Java code

I like the structure with Java. Although you can create structure with any language it somehow feels as it comes with Java, so it feels easier to accomplish and is kind of satisfying (in a really geeky way). So included in my personal project to be a kick-ass java developer (;-) I am also aiming towards writing nice, readable code that is based on predefined code conventions and guidelines both for the programming part but also for commenting.

You might have heard that really good written code doesn't need commenting. Maybe that's a bit exaggerated but in some sense true. If all variables, methods, classes and so on are named after specific conventions they will be more readable to you and other programmers that might inherit your code some day.

Take a look at the conventions for coding and commenting here:




Technorati tags:
, , , ,


4 comments:

Johan Känngård said...

Try Checkstyle, http://checkstyle.sourceforge.net/, it validates that the sourcecode is in the correct format. There is also a great Eclipse plugin at http://eclipse-cs.sourceforge.net/. It's highly configurable, and a great tool to get nice-looking code!

Niklas Waller said...

Hi Johan,
Thanx a lot for that. I just tried the eclipse plug-un and it works great, just what I wanted. It feels like I should configure some myself though since it seems to complain on every tab character (indent) I have on every line. Maybe that is good java programming but it seems hard for me to read.

Niklas Waller said...
This comment has been removed by the author.
Niklas Waller said...

I bumped into Mobilefish.com who provides a configuration file for checkstyle which is less extreme and takes away some of most annoying checkstyle warning messages. Works perfect for me. Take a look at it here ->
http://www.mobilefish.com/developer/checkstyle _
/checkstyle_quickguide_configuration_file.html