POV: No, Bootstrap is not a "Good Practice".
So, some friends and I have been debating for while whether we should use bootstrap in our project or not, and I silently believe such debate exist in every team. In this article, I decided to wrap up why I think using Bootstrap is a bad idea. Keep in mind this is just a personal point of view, so if you don't agree with me for any reason or find a certain point incorrect, write me in the comments section what you think!
1- It's a Complete Waste of the "class" Idea.
The main purpose of using classes with CSS is the encapsulation and reusability of the common styling properties among HTML elements. Using a class to wrap a single CSS property and repeating the same set of 6-7 classes on every element sounds like a completely another idea to use classes - no encapsulation, no reusability. Just inline styling with classes instead of properties. Some will argue that this is solved by using components, but repeating a "component" is totally different from repeating a "styling".
2- its Maintenance is Hell.
Encapsulation and reusability in CSS existed for a reason: making one source of truth for styling. If changing one styling aspect will make you change the same code in 8 other places, you may better revise your code design.
3- It's UGLY.
Nothing is more depressing than an HTML code with hundreds of bootstrap classes scattered everywhere to the point where the original HTML structure of the component is not recognizable anymore in the flood.
4- Class Names Are Not Expressive.
I'll leave this one to you to compare:
<div class="element">
I am an element!
</div>
element {
padding-inline: 3px;
padding-block: 6px
}
Code 2:
High-level languages are not mainly designed to be "fast" - that one is left for the low-level languages. The main reason high-level languages existed is to be as human-readable as possible. Just imagine if Java code was used like this:
p c M {
p s v m(s a){
// code here
}
}
funny isn't it? Yes, because Speed is not a justification to write class names like if it's an assembly code. It's is an artifact that should be done to be readable and beautifully written.
However, keep in mind this article is mainly focused on Bootstrap's concept of utility classes, not the idea of reusable UI components which might be a good idea in many cases.