Innovations & Programming ToolsDecember, 2021

What is framework or library, and how do they compare?

LavaPi News

LavaPi News

We live in a world of frameworks and libraries; you cannot browse any development or programming forum without coming across these two. Framework and libraries are a set of classes, modules and/or code that can be used in your app development process, it helps you to solve a specific “Problem area’. So let’s go back to the basics and start with definitions, what is a library and what’s a framework? Then we can discuss the differences!

Definitions

Framework - the best way to describe it would be to refer to it as a skeleton with specific openings you’re supposed to fill in with a code. A framework is more like a blueprint for a home, you cannot change it, but you can decorate, with limited control

Library - is defined as a set of functions organized inside classes. You call on these set of functions, and the library does some sort of work. To continue with the example, if the framework is a blueprint, then the library is like Target; you can shop for stuff you like, pick and choose precisely what you’d like to see in your code. 

Differences

  1. While we are on the subject of control, we should mention that the most fundamental difference between a framework and a library is precisely that - control. You call on the library, but the framework calls you. This difference may be the biggest of them all, because of the inversion of control. Some even call it the Hollywood principle, and Frameworks are like agents; they always say: Don’t call us, we’ll call you. On a more serious note, a framework takes control away from the developer. They are more “opinionated” compared to libraries. It tells you what needs to be done, and you do it. 
  2. Another big difference is described by developers perfectly, they said: with a library, you can choose whatever little part you like, while with a framework, you have to commit your entire project to it. No negotiation. 
  3. While working on an outsourced web development project, you may decide to replace one library with another, but that’s not how frameworks function. If you don’t like a specific part of the library, you can swap it quickly, but in case you’d like to change your framework, you most likely will have to rewrite your entire code base. Ouch. 

Whatever you’re working on, whether it’s a personal project or an outsourcing job in the IT field, you have to keep in mind that frameworks are much stricter and have more control over you. At the same time, libraries are contained and can be re-used on other projects. This article may make frameworks sound bad, and libraries look cool, but the main conclusion is that both of these items are very useful tools if they’re applied correctly. 

Relatedarticles

Functional Programming Languages

LavaPi News

LavaPi News

In the IT world, Functional Programming refers to a specific paradigm, where the programs are constructed by applying and composing functions. Functional Programming Languages are specifically designed to handle symbolic computation; they use conditional expressions and recursion to perform comput...

Read more

Arrow Right

Typescript or Javascript

LavaPi News

LavaPi News

If you’re ever curious about how popular Javascript actually is, then let me show you in numbers: There are almost 2 billion websites created and a whopping 95% of them use Javascript. Needless to say, it remains the most used language in the world. As for Typescript, it still isn’t on this kind of heig...

Read more

Arrow Right