This post originated from an RSS feed registered with Java Buzz
by Simon Brown.
Original Post: Rolling your own
Feed Title: Simon Brown's weblog
Feed URL: http://www.simongbrown.com/blog/feed.xml?flavor=rss20&category=java
Feed Description: My thoughts on Java, software development and technology.
In Is it really 2005?, Brian asks why people are still writing their own frameworks, specifically around data persistence and the J2EE web tier. Certainly, from my perspective, I'll always try to recommend that teams adopt an existing framework that is proven, well adopted and meets their needs. However, there are situations where rolling your own can make more sense.
While adopting best of breed frameworks in a greenfield project is very appealing, you do have to take into consideration the team characteristics, including their experience and project timescales. A couple of examples spring to mind, the first of which is Hibernate. While I think it's a great tool, the learning curve is steeper than many people imagine. Or perhaps that's just me. ;-) Anyway, I think Hibernate pays off in the long run, but you could argue that, for very simple applications, it's possible to code up a JDBC based DAO layer in no time at all.
The other example is webapp frameworks. This is going back a couple of years now, but when Struts was at its peak, there were definitely a few times that I recommended we build our own MVC framework. Here, I'm talking about a controller servlet and an action interface, based around the example code from chapter 12 in Professional Java Servlets. In justification of this decision, the simple nature of the web UI didn't require the complexity of Struts and the team was new to Java, J2EE, UML, RUP, etc. The last thing they needed was another tool to learn. We actually had to deliver something and reducing the complexity in the web tier provided time to concentrate on other things, such as sorting out our performance problems due to misunderstandings around how JTA transactions work with session and message-driven beans.
My point is this. Making the buy vs. build decision isn't as straightforward as it first seems. Most of the time, using a pre-built framework does make sense but there are times when it doesn't. Make your own judgement but be prepared to justify it.