Wednesday, July 23, 2008

Are development frameworks worth anything?

After graduating from university every decent software development undergraduate is able to write computer programs in many languages. Most probably the list will include C, C++, Java, Ada, Pascal (Delphi), PHP, Shell scripts, JavaScript. Depending on the university the list could be longer or shorter and programming skills would also differ. And those guys are able to write almost everything in every enumerated language (starting from HTTP servers up to transactional systems and applications computing shortest paths between two or even ten cities in Europe).

How is it possible that even guys who graduated with honors know almost nothing when they start working for companies for their first assignments? Is it because companies and already existing projects use frameworks (transactional, middleware, whaterverware)? Does it make sense to invest in using frameworks? Aren't they only the source of problems and maintenance horror? Isn't it better to write your home-grown tiny little framework that will do good - you don't need full blown framework because your project is too small now?

I'll try to answer some of these questions and other questions regarding development frameworks.

A bit of history

I started working before the end of fourth year (out of five) at my university in a small development company. Although it was a small company it had really fancy products in its portfolio all developed in Borland Delphi. My task as a "fresh" and highly skilled student was to port some of the functionality from those products to the Java technology and expose it as a web application. My only choice was J2EE stack: Apache Tomcat, Java Servlet, JSP, JDBC and maybe something more. I knew MVC design pattern and I knew all mentioned technologies. I started developing the system and it was working well until it reached its critical mass i.e. adding new features meant copying-pasting a lot of code. OK - I was not the Java and object-oriented prodigy at that time but everything I touched simply worked. Yet, it was not very easily extensible.

My first framework
Struggling with such problems I found Struts that solved 99% of my problems, literally. This framework was what I was looking for. I even wanted to write something like that by myself but I found it first. Struts 1.x saved my life and my project at that time. 1:0 for the frameworks.

It's time to learn more
After couple of months I moved to a bigger and more prestigious company for a trainee position. Some time before that happened I started interesting in Aspect Oriented Programming (AOP) - more specifically AspectJ. This AOP-thing seems unimportant in this context but it really isn't. You will see it shortly :)

In my new, bigger, more prestigious job there was a system that we were supposed to develop as a standalone GUI application in SWT and JFace. Middleware components were based on Spring Framework and Hibernate - two big and full-blown frameworks I didn't know at that time. I had to learn them and be an expert in them.

Is it so simple?
As I was extremely fast-learner then (I really think I was better in learning then that I'm now :) I caught Spring and Hibernate in minutes and my colleagues also. It doesn't mean we were good at Spring and Hibernate just like that. I still didn't understand many things but I was able to be a leading developer in this project (after over one year) and deliver requested features.

Although we learned Spring very fast there was a part of it not all of the guys were able to catch - it's name was AOP. It was very important part of this framework we were using extensively - and if I weren't learning AOP before I could have had big problems at work then. This means that even if you know how to use the framework and you're good at it you don't have to know it from the inside - although it can really help you in case of any problems.

Was it worth?
After all those years I see how Spring together with Hibernate made our lives easier. We were able to deliver new features really really quickly. The maintenance of the system was not so bad at all and I know that if we developed this system using pure JDBC and home-grown ORM stuff we would not deliver this system to the customer or would deliver it much later.

What now?

When I start a new Java-based project I almost always assume that we would need Spring Framework, Hibernate, Struts2, JFree Chart, Lucene, iText, Jakarta POI, Velocity, ........................................... And most of the time we need all of these.

The real learning
I hope you see what I mean - you have to know a lot of stuff and you cannot know it all after you leave your school. Learning all those frameworks and libraries took me years and I still know nothing. There is still a lot of things I have to learn but isn't it fun? It is - for me. Our job (software developer) is very difficult, we have to learn enormous amount of things. Not just for the sake of learning - we have to use our knowledge, be creative and produce something from nothing. Smart people are not enough - you need here smart, knowledgeable and skilled people.

The real learning starts after graduation when you know programming languages but you don't know frameworks. Frameworks are like languages themselves - and they make developer's live easier (after they make his/her life much more difficult).


Does it make sense to learn all of this, to spend so much time on learning frameworks? Does such investment pay off? Isn't it better to write something simpler and quicker but on your own? You can multiply such questions and each similar question is an excellent question.

Try it yourself you'll see how difficult it is
If you tried to learn and then apply at least one framework in your professional life you should know how horrible it can be. You go through tutorial (torturorial :)), copy the code, set all properties, start the example and.... java.lang.NullPointerException. Yes - you know this very well :) After at least few days and many WTFs you finally solve the problem but wait! Here is another one...

Until you excel the use of the framework of your choice you can get mad many times. You will lose a lot of time and nerves and you still cannot be sure that the use of your framework will do good to your project.

Invest or not?
As always there is no simple answer. Definitely it's worth investing some time and money into investigation. If the framework you want to use makes the development or maintenance easier the decision should be obvious. If the learning curve in order to excel the framework is bigger than the value of using the framework you should consider not using it.

The big disadvantage of frameworks is the learning curve - you have to learn it and to be smart enough to understand it - not everybody is capable of doing this and doing this for such a long time. Many team leads and project managers don't like that risk and they invest in crappy home-grown solutions - that doesn't pay off in the long run.

If your project is to write couple of JSP pages with maybe few Servlets it really doesn't make sense to use Struts or Spring. It may make sense to write your own two- or three-classes tiny little framework that will work after couple of hours - not days or weeks of training.

After all using frameworks pays off and is worth investing time and money - of course if you use appropriate frameworks to your project and your project reaches its critical mass. Your application will be much more maintainable and extensible (maybe also more testable and portable). Your customer will be satisfied and your employees will be smarter and more skilled. These are the reasons you should consider development frameworks very seriously.

Do you have different view on frameworks? What do you think - is it worth investing your time and effort in learning how to use them? I would be glad to know your opinions.

Originally published on

No comments: