DEV Community

Partha Maity
Partha Maity

Posted on

2

Library vs Framework Explained

Library

You started a project and finished it and then started an other one and noticed 🀨 that you have repeated some pieces of code from previous project and then you finished it.

Next day, you started a new project and damn! you noticed it again, you once again repeated some pieces of code from previous two projects.

Hmmm!! πŸ€” ...

So you thought - "Why not I copy those repeating pieces of code and keep it in a separate file, so that the next time I need it, I can just copy it from there."

That's how the concept of library came into existence.

A library is a collection of reusable pieces of code that can be used in multiple projects.


Framework

Once fine day, you started a project and you noticed that you have to repeat some pieces of code from previous projects. You grabbed your library and copied those pieces of code and probably felt happy πŸ˜„ that you have saved some time.

But soon that happiness turned into frustration 😀 when you received handful of bugs πŸ› from the application. You started debugging and realized that you have to fix the same bug in multiple places 😫. You fixed it and moved on.

For the next few days, you kept on receiving bugs πŸ› and fixing them.

....and then one day, you realized that if you had followed a particular structure or pattern, you would have saved yourself from all these bugs πŸ›. You made few rules from your experience and started following them.

You noticed that you were able to fix bugs πŸ› faster and also were able to add new features faster. It just boosted tour productivity of building applications.

You just created your own framework.

A framework is a collection of rules and guidelines or a structure for building an application.


Note: The above explanation is just for understanding purpose. It is not a complete explanation of library and framework. If you find any mistake in the above explanation, please let me know. I will be happy to correct it.

Image of Datadog

Create and maintain end-to-end frontend tests

Learn best practices on creating frontend tests, testing on-premise apps, integrating tests into your CI/CD pipeline, and using Datadog’s testing tunnel.

Download The Guide

Top comments (0)

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

πŸ‘‹ Kindness is contagious

Please leave a ❀️ or a friendly comment on this post if you found it helpful!

Okay