Friday, 10 February 2006

JEE/J2EE best practices

Recently I had a chance to implement enchancements at some of the old java applications. I got really sick of how the applications were implemented! Honestly, looking at the code, there had been no standards or good practices done when the code was implemented. I was really annoyed and wrote an article on Wiki and put this link on how good practices could really save some time in the future:

I would like to emphasize the importance of following these best practices in building JEE Applications (see attached for the PDF document). Extra time might be required to follow the best practices initially, but it is really worth doing, because the advantages definitely outweigh the disadvantages.
The first point in the article, as an example, is unfortunately, very frequently overlooked: Always use MVC, and cleanly separate business logic from controller logic from presentation!
It is indeed very tempting to misplace the logic, and I have to admit that I have done that in the past by misplacing "quick fixes". In time, these "quick fixes" accumulate and become spaghetti codes that sometimes not even the author/s could understand. Projects that don't untilise this MVC pattern will almost always lead to maintenance dramas. At the end of the day, extra time will be required to go through the spaghetti codes in order to just fix a tiny issue or add a small enhancement.
Open source frameworks like
Struts does help developers to use MVC, but it does not stop anyone from adding business logic/controller logic in the presentation layer. The same point can be said to Java language, as Java is a good OO (object oriented) language but it does not stop anyone from coding everything in one single method in one single class.
blog comments powered by Disqus