Where: Somewhere in earth.
When: More than a decade ago.
Me: Sir, what is a framework?
Architect/Team Lead: Oh, it is a set of utilities.
Years after, when I stumbled upon IoC (Inversion of Control) and Dependency Injection, and articles from Martin Fowler, it dawned on me that Framework IS NOT JUST set of utilities. When I got the hang of it, I tried explaining the concepts to my fellow developers.
IoC is the one implementation which distinguishes a set of utilities from a framework. With IoC implemented properly, the Application is just part of the framework. Without IoC, Application is in control. Lets delve further.
Set of Utilities
Well, there wouldn’t be any project on earth without any set of utilities. Functions which are common across the application, which we abstract into small utility classes or functions. In this case, the Application is in control. The application decides when and how to use the utilities. For example, we go to our nearby McDonalds (or a nearby favorite fast food place). We are in control. We decide where to park our car (in spaces available of course :)), when to order, what to order, where to sit, where to hang our jackets. Got it?
When we have a Framework, the application is a part of the framework. We have to register the application (or parts of the application to be used), and the framework will decide when and how to invoke our application. This concept is called Inversion of Control. Let’s suppose we go to any up-scale restaurant in New York City. Typically we have to make reservations (analogous to registering the application). THEY (the restaurant) will let us know what time is available. Once we reach there, THEY valet part our car. We wouldn’t have any idea where the car is getting parked. THEY usher us into the dining area, and get our jackets and hang it in THEIR own locker rooms. (You are getting the hang of it, rt?). Once we are done with the food, our jackets are returned and our car comes when we step outside. THEY take care of us. THEY are in control. WE become part of their SYSTEM (analogous to the FRAMEWORK).
To know more about IoC and Dependency Injection, read this article: http://www.martinfowler.com/articles/injection.html.