Matt Raible has been building web applications for most of his adult life. He started tinkering with the web before Netscape 1.0 was even released. For the last 16 years, Matt has helped companies adopt open source technologies (Spring, Hibernate, Apache, Struts, Tapestry, Grails) and use them effectively. Matt has been a speaker at many conferences worldwide, including Devoxx, Jfokus, ÜberConf, No Fluff Just Stuff, and a host of others.

Matt is a DZone MVB and is not an employee of DZone and has posted 143 posts at DZone. You can read more from them at their website. View Full User Profile

How long does it take to build a modern web framework?

01.24.2008
| 3959 views |
  • submit to reddit

Dear Java Web Framework Authors,

I hope you're doing well and continue to enjoy working on the web framework you created years ago. I'm curious to know something:

  How long would it take you to build your web framework from scratch?

If all the code from your framework magically disappeared tomorrow and you had to write it from the ground up - how long would it take? What if you had a group of 3-5 developers (of your choosing) to help you do it? 

Furthermore, would you write the whole thing line-by-line, or could you borrow code from other open source projects to streamline the process?

Thanks in advance for your response,

Matt 

Published at DZone with permission of Matt Raible, author and DZone MVB.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Comments

Marcus Breese replied on Thu, 2008/01/24 - 4:29pm

I think the key issue implicit in your question is scope, and is something that many people will disagree on. There isn't much to the definition of a web framework, except that it must be able to accept a request and return a result back to the user. They also typically use Servlets or JEE to accomplish this task.

After that though, you'll have a lot of disagreement... do you mean a full MVC stack? Does the framework use an existing technology for the view aspects (JSP? Velocity?), or does it do something "special". From the perspective of the model, does the framework include an ActiveRecord type model itself, or does it just use Hibernate like the rest of the world?

So, to answer your question about my home-grown framework (Craptactulous as it is :) I can answer your question pretty easily... I did perform a major rewrite of it not too long ago. It is annotation based (so no XML configuration needed), doesn't rely on Spring (but can use it), uses JSP/JSTL for the view (I like to hand code HTML), and has no specific requirement for a model (but has a nice Hibernate support class).  Basically, it's a reflection driven controller.  the view is standard jsp, and the model is left up to the app author.

1 month at most, probably closer to 2 weeks. 

I would probably rewrite it all from scratch without borrowing code from too many other places.  I also like to limit the dependecies that are required.  This does two things: 1) makes it easier to write without having to integrate extra code, and 2) makes things smaller... the smaller a framework, the less work it does, so the less you have to write... I tend to believe that the ess that a framework does, the better it can do that specific job and get out of my way of making the application.

Ignacio Coloma replied on Fri, 2008/01/25 - 3:07am

My case (loom): annotation-based, supports Spring, core taglib and ajax taglib, JSPs, etc. From scratch, it has been one year, six months working as a pet project and another six working mostly full-time. It would have required _much_more time if I had to coordinate with other people, and you are going to learn _a_helluva_lot_ in the process (one thing is to use a framework, and an entirely different one is to develop one).

I rely very little on third party libraries, and only when the quality of them has been well-proven. The parts that you will have to keep in mind are:

  • property binding (HttpServletRequest-to-java and viceversa): I developed my own from scratch after seeing how much fun did the struts2 guys have with OGNL (well, that and because I wanted to fine-tune validations).
  • workflow: where and how to configure interceptors. Nobody is helping you here.
  • validation and conversion: You can spare some ideas from everybody else, but unless you pretend to use hibernate validations and the like (which I don't recommend) you will again have to roll your own.
  • javascript support: This is a hell of a thing. There are so many options in constant motion that just choosing your bread-and-butter basement (ext, prototype, jquery, mootools, gwt) is a headache. Keeping your framework bare bones (no javascript helpers) is an option, I suppose - it's just not my case. On the other extreme is ExtTLD.
  • security: keeping the bad guys out of injecting illegal values into your model objects or scripts into your HTML.
  • reading your config: wether it's annotations, XML or spring support, it will not be magically developed.
  • You _have_ to support injections.
  • i18n all the way down.
  • JSON support. Probably there will be some libraries here to help you.
  • Flow control and conversation scope: I would seriously think SWF here.

Having said that, if I understood the question be sure that the world really needs it. You more than anyone else know that there are plenty of web frameworks out there. You will also get it easier if you have real requirements (real people in need of your framework) as soon as possible. They make great beta testers :)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.