One of the holy grails of software development is reusability, and a product of this is a library. Reusable code is compiled into a library and distributed so that it can be reused in multiple projects, in multiple scenarios. More progress in this has led to building more and more into these reusable units – the design, the semantics, the rules. And this has given us different reusable units – toolkits and frameworks. Unfortunately we tend to use them more as buzzwords than what they mean and what they stand for.
This is the reason I have included this question while interviewing others. Does the developer understand the meaning and differences in these buzzwords? I think this is an important factor while choosing various components while developing new software. Not that I want his/her answer to match mine, but it is a good way to find out whether the person has thought about it. If not, I consider that person has to learn a lot in today’s RAD era. Unfortunately, not many know the difference, and many more still have not given any thought to it.
I had thought about this earlier, but I feel that it needed more elaboration.
Libraries
I think a library is used with two different meanings. I like to use it as a reusable compiled unit that can redistributed and reused across various projects. Not necessarily binary, but they sure contain code that is compiled, not binary compiled but compiled to be distributed together.
Toolkit
A toolkit reflects that fact that it provides functionality for a specific domain. It is a kit of tools to handle requirements of that domain. This is the other meaning that is usually applied to libraries, which I think are in fact toolkits. It is quite possible that a toolkit contains many libraries, depending on the atomic unit of distribution required.
A toolkit does not contain application design. In other words you can have two completely different applications, with different designs, using the same toolkit for the functionality that it provides. You write the main core of your application and make calls to the toolkit for certain functionalities. This enables you to use multiple toolkits for your application.
I think we will find a lot of references where a toolkit is referenced as a library.
Some examples of toolkits:
Framework
A framework has an inbuilt architecture, which dictates the way an application has to be written to use it. The framework includes a lot of design decisions, which helps in speedier development of application as the developer can now focus only on the domain. However this also means that once a framework is chosen there are not many alternatives for design of the application itself. Nowadays many popular RAD include the MVC architectural pattern.
The framework takes a lot of design decisions for you and does a lot of work for you. You usually end up writing the modules or plugins or hooks into the framework to build your application. It also means that you can find frameworks using some toolkits to achieve the functionality. Here are some examples:
I think choosing a toolkit or a framework is instrumental in designing your application. A lot of dynamics of the application would depend on it. In case of a framework, most of the elements will be imposed, in case of a toolkit you might have more freedom. In spite of this I feel that the flexibility that you would get from both would depend on the project being considered. But a toolkit gives you more options. This is good and bad both – the choice can give you freedom to choose your design, but might also eat a lot of your time in taking decisions.
It is also important from the perspective as a toolkit or framework developer. You have understand the impact of the design decisions that you take on the application that will use it.
What do you think?

June 4th, 2007 at 7:17 pm
This completely connects with a recent experience we had. We organized an event last saturday on PHP Frameworks, with speakers from Zend Framework, Joomla (who have their 1.5 product based on their own framework) and Symfony. Looking at the different products, several people came to the conclusion that at this point at least, Zend Framework is not really a framework, but rather a class library. So it’s interesting to see this post coming up now.
June 4th, 2007 at 7:46 pm
Zend Framework is an architectural framework not an application framework. Application framework like CakePHP, SolarPHP. .NET require a single way to build application. Zend Framework does not require you to do it if you dont want to. Zend Framework can become a class library if you dont use its MVC classes.
June 4th, 2007 at 8:24 pm
I agree. In a nut-shell, you use a framework to design an application, a library to hold the business logic(potentially reusable), and a tool-kit to interact with the user.
-Sashidhar
June 4th, 2007 at 9:24 pm
It’s generally accepted that the defining quality of a framework (over and above that of a library) is the use of “inversion of control”.
http://www.martinfowler.com/bliki/InversionOfControl.html
i.e. where things get registered with the framework for callbacks, and then at some point control is handed to the framework for however long the framework requires it.
Cheers,
Andrew
June 4th, 2007 at 11:57 pm
Don’t forget about development process frameworks too! For example, XP, Waterfall, RUP, etc… Are these frameworks, or libraries, or processes? RUP (Rational Unified Process) is a set of best practices but people often refer to it as a framework…. yet the RUP tool is really just a library of documents.
June 5th, 2007 at 1:20 am
Interesting topic…A library is just a set of reusable logic…Where as framework and Toolkit imposes more restrictions or additions to the dev process.
June 5th, 2007 at 1:53 am
This is one of the main problems we have in Software Engineering field. The definitions for terms are not set in stone and different companies use terms in their own ways. What one person calls a library is a toolkit to another person or a framework to a third person.
Abhijit, I believe that in an interview, it is more important to have the interviewee explain their views than to have them recite something they memorized. As you said, it is a way to check whether they have thought about this problem and/or encountered this issue.
June 5th, 2007 at 12:56 pm
Thanks for your comment guys.
Stefan, I agree with you that Zend framework can behave like a class library. It is mostly a set of patterns, recommendations and best practices. You can choose how to use it. But exactly in cases like these, it is important to realize its behavior.
Shashidhar, almost with you. A toolkit is not necessarily for interacting with the user, if by use you mean the end user. A toolkit is a set of functionalities targeted towards a domain. It might very well be for a developer.
Andrew, you said it. IoC is one of the principles frameworks follow so that the dependency is more stable. I would think they should follow all the principles.
Jitendra, I agree with you that frameworks impose some restrictions, especially they have already taken some design decisions for you.
Michael, that is one of the reasons for this question in the interview. Everybody knows the buzzwords, but their context and their usage is not thought about. This affects especially when you have to take decisions like whether to use a library or a framework.
September 7th, 2007 at 11:47 pm
a Library is a collection of reusable codes (Functions / classes) that can be “USED” Directly in your code with your “OWN WAY OF ORGANIZING AND STRUCTURING YOUR CODE WITH COMPLETE FREEDOM”.
A framework is a “COLLECTION” of “READY MADE STRUCTURES” of codes as well as reusable classes and functions that you can “FOLLOW” or “INHERIT” or “USE” but with its some Constant prescribed manners of it.
In other ways Library offers Only ready made codes that cam be used. but a framework offers Structured and organized manners and ways as well as reusable helper codes.
** My English might be wrong **
September 9th, 2007 at 9:47 pm
Neel, both libraries and frameworks have reusable codes. Libraries can have classes and structures as well, and both will have some constraints within which you can use them. I think the primary difference is who dictates the application architecture.
September 11th, 2007 at 11:42 am
But in case of a framework(I am talking about application frameworks) sometimes you need to walk in the way that the framework wants or lets you.
September 11th, 2007 at 12:06 pm
Neel, exactly. A framework dictates the application architecture on you. The only way to reuse the framework is to develop the application according its architecture. A library has more loosely coupled code, which you can use in different scenarios.
March 15th, 2008 at 5:01 pm
[...] Source: http://ifacethoughts.net [...]
March 27th, 2008 at 4:08 pm
Can anyone please tell me exact difference between Joomla nad Symfony ? I want to upgrade my site using one of these. I want to use the better one. Can anyone tell me the best option between Joomla and Symfony alongwith the reason?
Thanks and regards,
Sarika