Framework versus libraries

01.09.2019 16:54

The move away from does it all frameworks have been going on for a while now. They are usually not the go to solution in the world of React and Node; and the Clojure world aren’t fund of them either. This is a good place to start.

To understand the difference between a library and a framework you can take a look at Django, Rails, jQuery or Angular. All of them attempt to solve “everything” or a lot of different things. And as a result your app end up having dependencies to them all over the place. While if you a bunch of libraries and have good abstractions you can limit the dependencies to a third party library very effiently.

The key difference between using libraries and a framework is that you need to do more of the configuration yourself. But you often understand more about how stuff works when you do so. Also: it is often a lot easier to change what you use for X and a lot easier to upgrade dependencies. The reason for this is that let’s say you have a well designed React app, and you have a “api-module” for all the requests to the backend, and you decide to change from axios to fetch you’ll only be required to change that module. Then you just remove axios from deps are you’re done. Let’s say you wanted to do the same with jQuery, it would take forever because people on your team would continue to write code using jQuery $.get/$.post etc because it is there.

There are also things like Entity Framework that is more like a library, even though it is called a framework.

Rails or Django may still be the correct thing for you and your projects. But there are some disadvantages to it, and I think it is important to understand them. And I don’t think frameworks are the future.