How software library is different from software framework?

A software library is a reusable set of code which software developer can use as it comes from its creators, it does not provide any hooks for developer to extend or override it. A software framework is a platform, which setups the architecture whole project will follow.

So, what's the difference?

  • The key difference between a library and a framework is "Inversion of Control". When you call a method from a library, you are in control. But with the framework, the control is inverted: the framework calls you.
  • Libraries are not extendable, you just call API of it and get the result. Frameworks are extendable, you can even completely override behavior of its parts.
  • Usually in the framework, the control flow is predefined and there are many white spots that you should fill out with your own code, predefined as well. The point is, in case of framework you need to provide some code to make it work as expected (although framework might has reasonable default implementation for white spots), but in case of library you just use its functionality.
  • Framework might incorporate libraries as part of itself, but libraries can't incorporate frameworks or other libraries.

Short answer

  • Software library is a reusable set of code which software developer can use in his application to solve particular, well-defined problem, consider it handy tool in your pocket.
  • Software framework is a platform, which setups the architecture for whole project, consider it skeleton of your software.

Similar articles

Comments