This post has already been published on code::gallery blog which now has been merged into this blog.
We come across a mesh of nomenclature regarding libraries everyday - Application Programming Interface (API), libraries, toolkits, frameworks, and probably some more. So, what is the difference?
Some of these terms do overlap. API is the interface provided by the library, toolkit or the framework. This interface, usually, works like a contract between the creator and the user. Library is a generic term for a group of functionality provided. These libraries together can form a toolkit or a framework. Gang of Four (GoF) explain the difference between toolkits and frameworks in Design Patterns - Elements of Reusable Object-Oriented Software:
A toolkit is a set of related and reusable classes designed to provide useful, general purpose functionality. Toolkits don’t impose a particular design on your application; they just provide the functionality that can help your application do its job. They let you as an implementer avoid recoding common functionality. Toolkits emphasize code reuse. They are the object-oriented equivalent of subroutine libraries.
…
A framework is a set of cooperating classes that makeup a reusable designed for a specific class of software. The framework dictates the architecture of your application. It will define the overall structure, its partitioning into classes and objects, the key responsibilities, thereof, how the classes and objects, the key responsibilities thereof, how the classes and objects collaborate, and the thread of control. A framework predefines these design parameters so that you, the application designer/implementer, can concentrate on th specifics of your application. The framework captures the design decisions that are common to its application domain. Frameworks thus emphasized design reuse over code reuse, though a framework will usually include concrete subclasses you can put to work immediately.
You commit to a functionality when you use a toolkit, whereas you commit to the design when you use a framework. That is why it is of prime importance to choose the right option for the job. A wrong choice can ruin the entire effort.
This is also important for the creators. Since a framework provides design reuse, it is imperative that it is flexible. Otherwise, it might limit the programmer in more ways than enable him/her.
Technorati tags: libraries, toolkits, frameworks
Copyright Abhijit Nadgouda.


August 27th, 2006 at 11:41 pm
[...] The challenge in designing an API is to provide flexibility but also hide the irrelevant information. Alex Bosworth provides a nice list of rules for providing a Web API with some examples. What are a few simple rules for providing a web API? [...]
June 4th, 2007 at 3:25 pm
[...] had thought about this earlier, but I feel that it needed more [...]
August 13th, 2007 at 12:02 pm
[...] selection of frameworks, without realizing the implications. They can be constraining, especially frameworks because they impose the architecture and design. You create a dependency when you buy into the [...]
December 9th, 2007 at 7:10 pm
[...] more to understand when to use them and when not. Or I might get too pedantic to call some of them libraries and not frameworks. But non-semantic names should not be a reason to not use [...]
March 15th, 2008 at 4:59 pm
[...] had thought about this earlier, but I feel that it needed more [...]