A case study about a horribly written Laravel Application
During my talk in a Laravel Bootcamp last July 20, 2019. I used this codebase to explain the best practices in writing Laravel applications. Here is a gist of my talk:
Why not just go through a list of "best practices"
The fact is, I already did, by creating a this website, but it will gonna be a boring talk to just read those text aloud during the presentation isn’t it?
The thing about human in general is, we understand and remember things a lot better when you have to handle a bad situation and you started asking yourself “how these things supposedly work?”.
For example, when you are driving and apprehended by a traffic enforcer in the road due to some traffic violation, you started to get curious of what are the traffic rules relevant to your violations.
So the situation “being apprehended” creates the spark of interest to the rules, that is in contrast to you being given a 23 page list of traffic rules and asked to memorize it.
Culmination of Common mistakes
When you visit the list of issues in this link, there is a sort of like laundry list of issues that this codebase has. These are common issues (a bit exaggerated ones) that you/team might encounter in a real-world environment. For example
- Wordpress developers tends to not use .env files when storing sensitive information
- plain php developers tends to place blocking API calls and business logic inside view files
- etc
I would like to reiterate that mentioning those frameworks and methodologies doesn’t mean they are less capable in writing quality codes, but the intent is to make it easier for them to adapt in the paradigm shift and thought process that Laravel requires.
A Story about an evolution
the MessyCodebase project is a story about how a spaghetti code evolved into a clean code. Being the laravelbestpractices.com as it’s protagonist and messycodebase always trying to violate every known good principle. It is a quest and adventure that places you (as a developer) can also undertake – by cloning the repo, attempting to refactor it and coming up with a better version of it…
Did you find this useful?
I'm always happy to help! You can show your support and appreciation by Buying me a coffee (I love coffee!).