Hacker News new | past | comments | ask | show | jobs | submit login

Here is a question for people who are more knowledgeable than me.

I remember reading somewhere that a library is a bunch of functions you call in your software whereas a framework is a software that calls your functions. I'm obviously paraphrasing but you get the idea.

Bootstrap is called a CSS "framework" but as far as I can tell, the user calls the predefined classes if putting them in an html element's attribute can be considered a "call". Or maybe CSS with its selectors is the one calling the HTML by, dunno, crawling it.

Can you help me? I'm confused. :)




I would say:

    - a framework provides a structure you fit your stuff into or build off of
    - a library provides functionality you can fit into the structure of your code however you see fit
In the case of bootstrap, I think they use the term framework because it supplies layout and styling patterns you fit your page/app into. E.g., the grid, containers, forms with form-groups, the predefined "primary", "secondary", ..., styles, etc.


As with many definition terms there are multiple answers to what is a library and what is a framework, and the phrasing you've described is one way, but another axis that is probably closer to why Bootstrap chose the name "Framework" over library is: "do one and only one feature" versus "generously include the kitchen sink".

Often in CSS terms a CSS library is focused on a specific "vertical": a grid library provides everything you need for a grid. Whereas a CSS framework generally focuses on providing a little bit of everything ("horizontal"): Bootstrap has a grid system (library), but also a button library, a modal popup library, etc, all bundled together in a one-stop shop for developer convenience.


You're right, but bootstrap forces your html to have a certain structure (everything should go in a container div, in columns or lines, ...)

So it is more a framework in that aspect in my opinion.

But it had also "components" which are more library-like (buttons, bars, cards, tooltips...). So I'd say it's both.


If you use it as just a CSS include then I agree with you in a sense.

But typically or rather optimally you use it with Sass/SCSS and override Bootstraps variables so Bootstrap generates its classes based on your input.

Related:

One of the goals of Bootstrap 5 is for example a stronger shift towards utility (atomic) classes. In 4 you can already generate their utility classes based on your variable declarations. In 5 this will get more powerful and the API becomes cleaner.

Another goal is to improve documentation for users who integrate with Bootstrap SCSS this way.


That's one definition. Another valid definition of a framework would be something that is a fundamental part of your project, or something you build upon, whereas a library would be something that you use to enhance a particular part of a project. Bootstrap would seem to fit that definition in most cases.


I don't think there is a really solid standardization on what makes something a library versus a framework. Particularly not with regards to CSS.

The two terms certainly don't offer much more than a suggestion of what's inside the shrink wrap.


I don't agree with this definition.

To me a library is a bunch of functions that you can drop in, whereas a framework is an opinionated implementation of functionality that requires you to adapt to it.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: