Hello, users! 👋
Today we'll be talking about those evil, sometimes best friends of us, that are everywhere... Frameworks.
We'll answer 2 core questions: What are them, and why using them... But also, when to use them.
You already know me, we don't need large introductions, let's go into this.
I remember all my first-times in coding.
Frameworks and Github were the big ones and I still remember how I struggled to understand both concepts. It is easy when you already know them, but totally not easy when you don't even have a clue of why would I want to keep my code online somewhere... Oh, dear, I kind of miss those times.
Some "official" definitions say that Frameworks are pieces of software developed to help you build some patterns that are commonly used when creating an application.
Okay, let's visualize this. Let's imagine we'd like to build a web. We'd create our index.html, then start giving styles to it with the < style > tag, and then maybe some scripts with the < script > tag and... Voilà! A web!
...but we could do better, right?
So we start being serious about this. Our web must be great. We'll start thinking inside the concept of a structure, and we'll take our styles and put them in a .css file placed inside a css folder... But our scripts will follow the same rule, we'll put that code in a .js file placed inside a js folder.
So now we have a structure for our project, everything is in the right place!
That's nice, don't you agree? It's all about organization, how we place our code and how our code interacts with itself. It's all about a structure.
Okay let's now repeat that official definition we had above, something about "build some patterns that are commonly used when creating an application"... Well, if I start organizing all my projects with the same structure, I'm creating the .css file+folder, the .js file+folder and the index.html file over and over again when I start a new project... But we're developers, don't we? We love creating things that do the nasty-repetitive-boring stuff for us and stop "wasting time" on that...
So maybe one day you have an ✨awesome✨ idea. To create something that already does this kind of structure for you! No more starting from scratch your structures!
Well, congratulations, a framework has been born.
Maybe this isn't an example or defition you 100% agree on, but let's just make it easy 🙂.
Got it! But... I can create those structures by myself, anyway.
You're correct. Partially.
The second really nice thing about frameworks is that they're already prepared to face a new modern project, it's not just a nice folder distribution, but a tool-box themselves!
You don't even need to go search other libraries or technologies, most Frameworks will already have them implemented to help improve your code and help your development.
You'll find many different types of frameworks, such as CSS frameworks (that already created the same-repetitive-styles for you to use quicker), JS frameworks (that already create the structure that we were mentioning and organize your code)... And many, many more. Investigate!
It's up to you either if you'd like to pick up all the techs involved in your project or just go with the flow.
Then, should I always use a Framework?
It's up to you.
If you have the time or the intention to build a huge project from scratch without any "help", go for it!
In the other hand, it may be too much if your intention is to build a little project that you could build, for example, with a plain index+css+js structure. As said before, there are some strong points in the framework usage, but you should think if you really need them for what you're about to build.
Remember however, that in real Companies the regular practice is to use frameworks, why? We said it before, there's no time to waste creating the structure from zero! The real bussiness is in the code development itself, so if something else could just do the nasty-boring stuff for us... We'd save a lot of time.
What you should really do with frameworks
Get familiar with them.
Know them, understand what kind of structure they have, how they link or how they'll be linking your code before and after the compile process.
As if you were about to do dinner, you don't need to be a chef but a common knowledge of how to use a kitchen will come handy if your friends are coming.
I hope this example or perception I have may help others understand a bit better what's with that "modern word" in most job offers in IT.
There's nothing to be afraid of, frameworks are here to do things easier and faster, the rest of the application is our code, as it was before!
See you around, let's keep coding and learning 💻!