Saturday, October 20, 2007

The Web Framework Hell

So I've worked many years in the software engineering field creating all kinds of web applications, integration software, and server side software. I've developed cgi web sites in C or perl. I've developed web apps using plane java servlets. I've created web applications using Struts and iBatis. I've created server side integration software using Spring, custom Java frameworks, hibernate, EJB's, and more...

Today, what does a developer do when they want to start a project from scratch?

Do I go with JSF? Ruby on Rails? JRuby? Groovy on Rails? Struts 2? GWT? Flex?

Hell begins ...

For example, let's say I choose to go the Java JSF route. I download JSF.... Woops, hold on.... Which JSF do I download? MyFaces or Sun? Be careful here because if you choose one then you can't use the other.... They don't work together.

Ok, so now I chose Sun JSF reference implementation. The only problem here is that the components are very basic and don't fit the needs for Web 2.0. No problem, right? Let me go choose one of these: IceFaces, Infragistics, JBoss Rich Faces, GWT, or one of these. Be careful with this choice too because most of these won't work together and some of them cost money. And also watch out because most of these don't provide all of the features you want. They all seem to be missing at least 1 thing...

One other problem. All of these use JSP by default. Well, we all know that JSP has pretty much sucked since it came out. No fear, let's just add another framework to fix the problem. Here we come to save the day! Facelets! Facelets is actually pretty nice, but it seems like a strange framework that is supported by like 2 developers but pretty much everyone that uses JSF uses facelets.

One other problem. Why do I have this extra layer in my code called a backing bean? Seems like kind of a waste most of the time... Seems like, eh... Is that why there is another framework called JBoss SEAM that is suppose to solve all of our problems? SEAM allows you to throw away that backing bean layer and tie your View layer directly to your EJB or POJO's. It also provides some extra states and page flow mechanisms. Guess what though, it's a pain in the ass to get working with all of these other frameworks. And at the end of the day, it really hasn't given us much. It's easy to download seam and run their example applications but that's because they already have pre-built ant scripts. Try getting the examples to run inside your IDE so that you can be an efficient developer. Then the real fun begins!

My Technology Stack:
  • Sun JSF
  • JBoss SEAM
  • JBoss RichFaces
  • Facelets
  • EJB3 Session Beans
  • JPA
  • JBoss 4.2 application server
  • Maven 2
Note: I'm sure that I'd like to use Spring eventually in this stack too, but haven't required it yet...

Now that I finally got all of this working together, I think it's pretty much crap. I've spent about a week getting it to all work together and I probably only understand about half of it. And I really haven't accomplished anything with the web app that I was suppose to be working on. I could have accomplished more by firing up a command on grails and saying generate scaffold.

Why don't I use Netbeans Visual Web pack for JSF?

Because it doesn't work with Facelets, MyFaces, JBoss RichFaces, or pretty much any other component library. The other big problem is that it has no templating framework built into it which is essential for any real production application. If you could use facelets with it then you could use Facelets layout templating which is pretty nice.

What's wrong with GWT?

It does not create completely compatible code across all browsers. And I'm not sure this will ever be possible because IE is so different then anything else. It does come close, but I haven't done much development with GWT and I've already ran into at least 3 issues with components not working correctly in IE vs. Firefox.

However, I love the idea of GWT so I'm going to keep trying it to see what happens.

So what's next?

I've written small sample applications in Flex, GWT, Ruby on Rails, and Grails so my next stop will probably be one of those again. But Ruby on Rails and Grails have crappy component libraries and you have to be really good at CSS and/or integrate Yahoo UI's or Dojo to get anything Web 2.0 and decent looking.

I think I'm going to try and develop some backend code using Grails framework (returning JSON). Then I'm going to experiment some more with GWT and Flex front ends because they seem to be the right approach overall to the Web 2.0 era. Flex does have the best looking components by far and GWT can easily wrap any other javascript component like Yahoo UI or Dojo.

Conclusion


We're all screwed! Just kidding.

For real though, if you need to get something done then don't start choosing a huge technology stack like JSF requires. I recommend picking some framework that has everything built in like Grails. If you want something very professional looking and you're not a CSS expert then choose Flex as your front end with any servlet back end that returns JSON.


The best part of this technology war is job security. There are a ton of jobs out there for all of us so that we can all support each others crap that we've developed while learning this stuff.

Happy coding!

2 comments:

Ted said...

As a matter of fact, you can use the NetBeans Visual Web Pack with ICEfaces.

Brent Ryan said...

Thanks Ted. Now that you mention it, I do remember seeing something about using IceFaces with the visual web pack. I think my real problem with the visual web pack is that you can use some kind of templating like site mesh or the layout stuff facelets provides. Without that, I can never use visual web pack for real production development.

I'll remove the IceFaces from this part of my blog.