php[architect] logo

Want to check out an issue? Sign up to receive a special offer.

To use a framework, or not to: that is the question

Posted by on April 2, 2010

“To be, or not to be:  that is the question:” is the memorable quote from Shakespeare’s Hamlet played in the 1600s. Programmers, today, have a similar dilemma.

When should a programming framework be used?

This takes me back many years to ‘Microprocessors 101’ course in my undergraduate studies. I quite distinctly remember our Professor telling us “Please do not use the Microprocessor to ring the door bell”. This simple and humorous statement carried a profound meaning. For everything there was a purpose. Just because it sounds cool does not mean that you have to use it.

A framework is usually thought of or defined as an underlying structure.  You could imagine a wooden structure, sort of a skeleton when a house is being built. This provides a guide, structure and flow to build the house. A programming framework pretty much does the same thing.  A programming framework provides for a structured and disciplined programming which results in a more consistent output from a programming team.

For example a PHP framework using the MVC design pattern enforces the MVC paradigm. The high level logical flow is dictated by the framework rather than by the programmer.

Most frameworks also come with a large amount of utility and housekeeping code which allows programmers to concentrate on the core application at hand rather than mundane tasks such as sanitization, database connection and error handling.

If the framework is application specific, for example a web framework, then development time is faster and the end product better as most of the code has been tried and tested.

If the framework is open source and well supported (e.g. CakePHP) by the community then you get the benefit of all the contributions which may include bug fixes and plug-ins. However on the flip side a framework is a software package like any other written by programmers and can have serious hidden bugs. Security vulnerabilities are now open to the public!

However to gain all the advantages of a framework you need to learn it and the learning cycle is steep. Doing the tutorial usually is not enough and you actually have to work on a project or two to learn all the nuances of the framework. If there is a problem you have to be prepared to dig deep into the core libraries to either solve the problem or analyze the functioning.

Like the Shakespearean quote there is no simple answer.  Only interpretations and interpretations are born out of experience. So before you plunge into a framework, think and make sure it is not the door bell!


I work as a Senior Product Developer with IntraPoint, Inc. IntraPoint located in Norway and Washington D.C. is a leading provider of Crisis Management & Business Continuity solutions.
Tags: , , ,
 

Responses and Pingbacks

I’d say the answer is quite simple, don’t reinvent the wheel, ever.
Unless you need something really special (chances are you don’t) then you should go with an existing framework.

Nice posts, in my opinion, using the frameworks means ready to take some time to learn their characteristics. If we want to build enterprise or large scale app then we must ready with the deep knowledge about framework that we will use. Framework is very good for rapid development thing, but it must be followed with good understanding of the framework that we use.

I have used Joomla for two years. It was a good way to learn from php and mysql. Now, 2 years later, I deveolped my own php framework for my own use. It grantises me the perfect knowledge of all the functions, database connections, etc… and hackers don’t know the keys to enter the system esaly.

For me is more quick to develope web applications with my framework than using joomla.

Sanjeev Kumar on
April 12th, 2010 at 7:16 am

I have used CakePHP by the last three year, I think CakePHP is good for all type of web application.

This is a good question…
But what about a highlevel frameworks?
Think about Drupal, it’s not framework, but it’s more than a simple CMS.
In my opinion sometimes a web developer need a Content Management Framework… well I’ve coded one, its name is ArcaCMF and you can find it at http://www.arcacmf.org
Suggestions are welcome!

Giovanni

[…] Please read my post on php architect. […]

Any commends on Symfony ? Don’t want to start a religious war.. but I only saw CakePHP mentioned. A few years ago, I jumped into Symfony because it was the most documented framework of all, and I simply liked it a lot..

So any comments on it?

I recommend CodeIgniter. It helps and doesn’t get in the way too much.
Personally I like to keep my Model classes separate from the framework so they could work independently if needed.

I think that it doesn’t matter which framework you use, as long as you use that framework properly.

A framework is just a set of libraries…written by someone else. If you choose a framework to use, to save you time writing those libraries yourself, at least take the time to ADOPT them as your own. Treat them as if you did write them. Learn how they work. It will still take less time than writing and testing them yourself, and you will benefit down the road when your application needs to evolve.

I developed my own framework (Hamlets) because I was sick and tired off learning a new syntax with each framework. My desire was to reuse all my Java skills and libraries. The framework should be easy-to-use and easy-to-learn. Hamlets can be mastered in 20min. It is the result of radical software simplification.

[…] To use a framework, or not to: that is the question – http://www.phparch.com/2010/04/to-use-a-framework-or-not-to-that-is-the-question/ […]

good post.

for me, learning an existing framework doesn’t mean easier than making a new (simple) one.

I build my own framework. Not as good as the existing framework, but I think it’s enoght for me.

I don’t think a framework is necessory. Why should we depend more on others when we know the tricks.? I developed my own framework for my applications. Sure, it is not rich as others, but have all the features I need. Whenever I create an application or have free time, I improve my FW. Yes, it is more easy for me to modify and use my FW rather than using any other.

Many developers are moving towards components, which means that you can use classes from different framework, and add them to your own framework. I use classes from Pear for doing Mime and Mail, as I find these classes easy to use – for Imap, I use the Zend framework – and then it is easy to add these vendor packages to my own framework – using composer. The reason I like using my own framework is that I will know exactly how to hack it, and when to hack it, if it should be necessary.This can be a good thing if you don’t have large team or if you a freelance programmer.

framework doesn’t really add new features to php.

AND

it is hard to learn a framework and you can’t find a job without knowing a framework. 🙁

since the use of framework began it is now difficult to look a web development job 🙁

php_framework = blockage_to_jobs;

booooom!

All frameworks suck, frameworks make engineers dumb because they don’t have to think anymore how to architect solution.
There is no single solution for every problem.
Don’t re-invent the wheel applies to the concept of libraries and is fine but frameworks are on the architectural layer so you should create your own architecture that exactly fits your needs. Try to solve problems don’t try to fit frameworks and patters just for hype

Leave a comment

Use the form below to leave a comment: