Screen Shot 2016-05-24 at 10.05.28 AM

Micro Library or Framework VS Large Library or Framework in Javascript

No matter how great we are, sometimes we really need to use libraries or frameworks, especially when we have limited time. Also, I found an interesting article 6 Reasons To Use JavaScript Libraries & Frameworks and I agree with that.


But, even though we need to use libraries or frameworks, we need to consider which libraries or frameworks that best fit with our needs. We also need to be careful with the performance. So, which libraries or frameworks we must choose?


Micro Library or Framework

The purpose of Micro Library or Framework is to help us doing frequently called codes without needed to reinvent the wheels, but we don’t need to waste the disk-space to store the unnecessary codes. Let’s use leftpad by Tom MacWrigth on NPM as a sample and take a look to the code.

As we can see, the module is only small pieces of code, and of course we can write that without needed to download it. But, it’s okay if we only use that on a single project. If we use that on many projects, then simply use the module (for me) is better than re-write them on every projects. And the more problems will show up when the code we write has a bug. Change them all? No for me. I don’t care if people call me lazy or don’t know how to program, but time is really matter to me. I wont waste my time to write something that I can easily download that from the internet. So, in short, the purpose of Micro Libraries or Micro Frameworks is to safe time, size, and probably performance.


Large Library or Framework

The purpose of Large Library or Framework is to help us doing many frequently called codes in one package. So, by using large library or framework, we don’t need to download the libraries that we need one by one because we already got them in one package. Let’s use Lodash by John-David Dalton on NPM as a sample.


As we can see, the module contains so many useful functions and we can simply use them rather than writing our own code, one by one. But, the problem is using large library will produce file size. So we need to carefully choose which library or framework that really fit our needs, but doesn’t contains too many unused codes. And we can’t simply pick the used parts from large library or framework, especially if the codes is compiled to single file.



Performance is really important. The library size will impact to our project size, and also will increase the memory usage and load time. We know we can compile our codes to reduce the file size, but it won’t reduce the memory usage and load time. So, micro library or framework will be better for performance. But, even though micro libraries or frameworks is better, large libraries or frameworks is worth if they’re fit with our needs.



So, to choose which libraries or frameworks for our projects is depend on our needs. If we only need a small thing, or we don’t use at least 50% of the library, then Micro Library or Framework should be better. But, if we need more than 50% of the library or even all the functions, then the Large Library or Framework is worth.


Thanks for coming and read my post. Again, I’m sorry for my bad english 🙂

Nanang Mahdaen El Agung

I am a Senior Front-End Developer and Javascript Addict.

Follow me on Instagram