Framework vs Library

alex_ber
Geek Culture
Published in
2 min readFeb 12, 2022

intrusive vs non-intrusive

What is difference between library and framework?

Quote:

The first major difference between a framework and a library is who is in control of the development process.

With a code library, a developer generally calls upon the library whenever they feel it is appropriate. A framework generally requires that the developer is fully immersed in its workflow.

As a result, it often feels as though the framework is in control of the development process rather than the developer. This is inversion of control! This is commonly simplified as some variation of the following:

* Library: Call us to get the job done.
* Framework:
You don’t call us, we’ll call you.

It is because of this inversion of control that frameworks are much more opinionated and also why they are capable of doing so much for developers.

Opinionated for those wondering means frameworks are making a lot of decisions regarding how code is written, the location of files, and possibly even the name of said files.

Making these assumptions allows for the usage of the paradigm of convention over configuration which allows developers to skip the process of app configuration in exchange for following certain conventions (such as putting certain files in certain folders, etc.).

https://betterprogramming.pub/libraries-vs-frameworks-whats-the-difference-5f28c53dcffe

Frameworks are further divided to intrusive and non-intrusive one. The main appeal of a non-intrusive framework is that it stays out of the way of your design and modelling activities. It stays completely out of the way until you need it. For example, Spring is non-intrusive framework. The application code doesn’t need to depend on any of the Spring objects directly. ORM framework are typically very intrusive.

My personal preference is the following: I prefer to use 1–2 non-intrusive frameworks in the project, such as Spring, Spring Boot, web.py in Python and many other libraries of the focused specific tasks. This is the reason why I don’t like popular Django and Flask frameworks in Python. On another side, I do use EJB3 in Java and it works reasonably well. But I’ve used it in non-typical manner — in order to use it efficiently I’ve read 300 page design document of it that allows me to know how can I customize it’s usage to very high (not-typical) degree. Another example will be JPA.

--

--