Tuesday, August 10, 2004


Does our industry suffer from layeritis? Sometimes I look at architectures and think "too many layers". I firmly believe layering systems properly is a good thing to do, but can you go overboard. I firmly believe that doing anything in the extreme is bad. The architectures I see in Java tend suffer the most from this disease. I often see a client layer, JSP/Servlet layer, EJB layer, Model layer, Data Access layer, and then the Database layer. For most systems, I see that EJBs are unneeded and a total burden on the system. If you need to distribute your objects, then use EJB by all means, but ONLY IF YOU NEED THEM! Sadly, EJBs are often misused because they are the cool toy in the toolbox (and plus they are COMPLEX...which a lot of developers love). I don't mean this to be a rant, but I see too many projects suffer from using what the books and vendors tell them to. They think it's the right thing because that's what is being taught. Don't do layers to be doing them. And be very careful with your layers too! If you find yourself changing more one layer for any change, then think about what you're doing. Some changes will ripple, but they should be avoided. If you're making a lot of changes that span layers, then you haven't layered properly. The point of this post is don't over architect and do the agile thing. Of course, this isn't a gripe about my new project, but a mistake I see occur in a lot in java projects...Don't make it in yours...

No comments: