DEV Community

DaleLanto
DaleLanto

Posted on • Updated on

Laravel 8 - "Cruddy by Design" A Controller Structure for Beginners πŸ”₯πŸ”₯πŸ”₯

One of the easiest to understand Controller structures in Laravel is "Cruddy by Design" by Adam Wathan.

After the conference he published a new GitHub repo that contains the demo app he refactored on stage. The 4 main tips to improve your code come as PRs on the repo with an full description on why the change is valuable. Very cool stuff.

Link of the video.

I highly recommend this method specially for beginners when you implement this and are working with a team, by looking at the logic of things in a CRUD way you can easily know where to find the code you need looking simply at the routes or controllers.

There's no real cost to having 10x as many controllers, given you can organise them and standardise naming. This approach has allowed several applications to remain easy to understand and manage as complexity grows; the http interface feels no more complex every time You add a new controller. If you were a developer introduced to a new codebase and you knew it used this approach, you would immediately know what "PodcastTagsController" does and how to use it without even looking in it. You could open routes/web.php in my application and immediately understand the majority of how people interact with the application over http.

Top comments (0)