Framework vs. library

Two software terms that programmers use every day. Yet, if you ask programmers what they are, you will most likely receive different answers from one programmer to another. I found out this the other days asking some of my colleagues and I then realized I have a personal definition for library and framework, which, of course, I consider to be the right definition.

For me, a library is a collection of methods and functions (and even classes or other more exotic structures) that help achieve a result, or solve a problem. The application calls the methods in the library to solve its tasks.
A framework, on the other hand, is the abstract structure of an application. To complete the application, the programmer adds code that customize this framework in such a manner that will solve the applications tasks. The framework calls this code when it needs. A framework typically already contains most or some of the logic and the structure of the application and some special points where custom code can be inserted in the default flow to alter it in order to achieve new functionality. Sometimes, framework are very complex and might include programming languages or compilers.
FWVSLIB2

 

And I think that if we look at some examples, the things become quite clear:
  • C Runtime Library – contains functions like sprintf that a programmer can call to format a string.
  • 7-zip compression library – contains functions that a programmer can call to compress or decompress files.
  • ASP.NET is a framework, because you only provide a few missing pieces to the barebone to have your web application.
  • Spring – a framework for Java applications. Again, the programmer just writes some of the missing pieces, the framework does the rest.

Leave a Reply

Your email address will not be published. Required fields are marked *