DEV Community

Discussion on: What is the difference between a Library vs A Framework?

Collapse
 
deciduously profile image
Ben Lovy • Edited

The most succinct way I've heard it described is that "you use libraries, but frameworks use you". You can add a library to your project to handle some piece of functionality, but you're still organizing and designing the solution yourself. When you use a framework, everything already fits a regimented pattern, and you're just filling out logic within this already rigid structure.

This makes sense for huge complicated concerns where frameworks like Django or Ruby on Rails dominate - a lot of applications will cover more or less the same basic set of functionality, and it's a pretty complicated set of stuff. These frameworks take care of all that stuff for you, as long as your application fits the mold, so you can spend your time actually coding for the problem.

Collapse
 
tacomanick profile image
Nick Shattuck

Thanks for the reply. I haven't any experience with jQuery yet but that's good to know. So, what would things like CSS Grid, Flexbox or bootstrap be considered? Would those be frameworks? I ask these specifically because I've experimented with them and I want to have my terminology correct when I discuss with other developers.

Collapse
 
deciduously profile image
Ben Lovy

It's tough because it's a little bit nebulous. CSS Grid and Flexbox are actually neither - instead, they're APIs, or sets of functions that are available for developers to use. They are modules built right in to browsers, so they work more like a built-in feature of the CSS language than an external library.

Bootstrap is a little tricky. I'd call it a library, and the website describes itself as a component library, because you can pick and choose pieces from it to include in your app however you like. However, I believe Bootstrap use often ends up using some pretty strict patterns, in order to fully utilize what it offers, so it's used a lot more like a framework. React.js is another tool like this that kind of straddles the line. It's just a library, but in reality it to get the most of it you're better off sticking to the pattern they impose, so it's really a framework-y style of development.

Thread Thread
 
tacomanick profile image
Nick Shattuck

Thanks for the succinct response. I didn't think to consider them API's. I still have a lot to learn!

Thread Thread
 
deciduously profile image
Ben Lovy

I still have a lot to learn!

Don't we all :)