We can't find the internet
Attempting to reconnect
Something went wrong!
Hang in there while we get back on track
This is a commentary on https://github.com/alexeymezenin/laravel-best-practices
When you're learning to code, the first step is to make code work. To accomplish something at all. But once you create a slightly larger app, the code becomes either into a huge blob called the Ball of Mud. Or, if you've already picked up some techniques to redirect the flow (e.g. functions or classes) and the DRY concept, you can even tangle it into some Spaghetti code!
The second step is to learn how to organize your code so that your project isn't total mess. For that you usually learn various techniques like DRY, SOLID and so on. At this point you should also learn how and when to apply these techniques. Sadly, most of the time instead of teaching the tools along with their uses, you just get a huge toolbox with a "BEST PRACTICES" label. The result? Devs at this point in their journey make their code either into a nearly infinite stack of layers (Lasagna code) or split it into a thousand isolated microclasses — Ravioli code. The Ravioli is the ultimate application of the Single Responsibility principle: each dumpling is only responsible for one thing — invoking the next dumpling.
The reality is that the third step is to learn how and when to apply the techniques you've learned as a junior. And I'll try to provide brief tips on that here. Nothing comprehensive, I'll just give a small commentary on each of the best practices making them even bester.
Are the statements in this article correct? No, these are also opinions. Some of them are intentionally contrary to the originals. My goal here is to highlight that the best practices are not dogmas and you are allowed to think about their use. Make your own decisions.
I only knew Spaghetti and Ravioli, but I asked ChatGPT for the rest of the terms so they must be correct. Even if they weren't before this. It also suggested me other great names like Goulash code (a mix of all techniques) and Casserole code (rewritten so much it has become unrecognizable).
continue reading on github.com
⚠️ This post links to an external website. ⚠️
If this post was enjoyable or useful for you, please share it! If you have comments, questions, or feedback, you can email my personal email. To get new posts, subscribe use the RSS feed.