Frameworks. What's the fuss all about?
Oliver Sarfas • February 15, 2019
programmingLaravel, Symfony, Django, Angular, Vue.js, ASP.NET MVC. Frameworks you've no doubt seen, and potentially used before. But why do we use them? What positives do they offer? Is there a "bad framework"?
For reference, and to make things easier for me, all the content from here, will refer specifically to Laravel, or Symfony. These are the two frameworks I'm most accomplished with - however the concepts should still stand true for the others.
What is a Framework?
In computer programming, a software framework is an abstraction in which software providing generic functionality can be selectively changed by additional user-written code, thus providing application-specific software.
https://en.wikipedia.org/wiki/Software_framework
In this definition, we can see that Laravel is a framework. It does this, as it provides generic functionality - such as Authentication, and Pagination. Symfony, in the same light, provides other functionality, Routing and Forms for example.
So, Why?
Off the top of my head, I can think of 4 main reason why we (the development community) use Frameworks. They are;
Convenience
The code is written for you, by potentially thousands of developers all working collaboratively towards a common goal. Why write a custom Router implementation, when Symfony already has one? It just makes sense.
There is a flip side to this. If you're using a framework for the first time, you will find yourself lost in a maze of Objects, functions, and directories that are entirely alien to you. Allow yourself time to "onboard" the code base, and see how the framework works.
Security
This is the easiest way to sell a framework to a non-technical, or a client. Frameworks, by being open source, go through a "technical natural selection".
Only changes that are agreed to be secure are accepted as merges into the codebase. If there is a breach / issue - there are potentially thousands of developers working to fix it. Instead of one guy, who may or may not care about the framework now.
Framework often have release cycles. As part of this, they will normally offer Long Term Support version(s). This ensures, to your company, client, whoever; that your core framework has the latest patches and security fixees.
Caveat: It is of course down to the developer to ensure that their framework has the latest updates installed. The LTS is just a promise that the framework will make the latest fixes / patches available for that given release
Documentation
I've yet to work for a company that truly has documented everything. From fully custom MVC frameworks, down to something as simple as a JSON API solution. Companies simply do not allow time for Documentation.
Yes, I'm aware of Document-Driven Development, however I don't think this will be around for long. I'm passing it off as a fad.
Enter Frameworks. Laravel especially, has a rich library of documentation. This is supported, and maintained, by the community. If you find that something isn't documented - you can document it yourself, and have that merged into the full docs. Incredible.
Testing
Ah testing. To those converted to TDD, you can skip over this, but to the others, Frameworks make your lives a lot easier with testing.
Much the same as Documentation really, put simply, they're fully tested. Everything. So you know it's going to work as intended.
No more spending weeks trying to figure out why sessions are acting weird in a certain situation. It "just works".
Great. How do I get started?
Build something.
Look at your open tabs right now. Take the "simplest" site. Now build a copy of it. For me, that'd be a news / blog page. So I'd look at Laravel, and build a basic CMS from it for me to post blog articles to.
Use the Community
If you're looking to get into Symfony, Django, Laravel, Spring, etc. etc. They all have very active communities. Laravel for instance has large groups on Slack, and Reddit. We've even branched out into Discord lately!
There's a large plethora of content available on Youtube, and even Twitch. So you can easily watch someone code live, and interact with them to learn more.
What about "bad frameworks"
Well. This is a hard one to explain.
I'll go with Laravel again, as there's a lot of discussion around this topic lately.
Laravel, has been labelled by some as a "poorly built framework", and with some good reason. There's a few implementations that are questionable (see this reddit thread for an example).
Everyone has their opinion, and to that they are entitled. I personally believe that Laravel does so much more to enrich and accelerate my development that I'm quite happy with it having some "nichés".
Whether you decide to use Flask over Django with Python, or Symfony over Laravel with PHP. The choice is yours. And really, that's the beauty of this industry. We can all achieve the same goal, by using different tools.