Framework vs Library – what’s the diff?

How are Frameworks and Library Different from each other?

  • Inversion of Control is a key part which makes a framework different from a library. When we call a method from a library we are in control, but with the framework the control is inverted, the framework calls our code.  (E.g a GUI framework calls our code through the event handlers)
  • A library is essentially a set of functions (well defined operations) that we can call (organized into classes). Each does some work and then returns the control to the client
  • A framework embodies some abstract design with more behavior built in. In order to use it, we need to insert our behavior into various places in the framework either by subclassing or by plugging in our code. The framework code then calls our code at these points.
  • A framework can also be considered as a skeleton where the application defines the meat of the operation by filling out the skeleton. The skeleton still has code to link up the parts
  • read more