![]() Architecture and Project StructureĪhh, yes, a million-dollar question: how to structure a Laravel project? I even published a 2-hour course on that topic, back in 2019, and I still feel I only scratched the surface there. So, anything related to payments, user access, stability of the core most used functionality. As Matt Stauffer famously said, " first, write tests for features, which, if they break, would cause you to lose your job". If you are really pressured on time, pick the functions to test that are crucial for your app to work. Now, I'm not necessarily talking about a mythical "100% test coverage". If they don't, it means they don't care about quality that much, so then maybe time to find another company? They will then understand and allow that extra time. It involves some communication: evaluate the deadlines thinking about the time to write tests, also talk to the managers about what would happen if you don't write tests. I have a full video about it.īut this is where you need to find that time. Yes, I know that typical argument that " we don't have time to write tests". If that argument still doesn't convince you to cover the code with tests, probably nothing else will. So, literally, your broken code may cause financial loss to the business. So, how else would you ensure that the released code doesn't cause bugs? Quite often a new code is just a refactoring of the old code, so if you change something in the project structure, how would you be able to test that nothing is broken? Don't fall into the mindset I call " fingers-crossed driven development".Īlso, getting back to the definition of a larger project - remember, the price of the bug is high. Heck, you may even have no idea how that other code or modules work because you're focused on your parts of the application. You could test your own code, yes, but you have no idea how it may affect the old code written by others. In larger projects, you just cannot physically manually test all the features before releasing them. In smaller projects, there's usually a smaller budget and a stronger push to launch "something" quicker, so automated tests are often ignored as a "bonus feature". So yes, I'll be talking about those large projects below. Or, some broken if-statement may lead real dozens of people to NOT place the orders. I would like to emphasize those projects where your inefficient or broken code may cause real money to be lost: like 30 minutes of downtime in an e-shop may lose $10,000 to the business easily. With the scope of work this big, there are usually multiple developers working on the project, which brings the complexity to manage the codebase.Īlso, a third non-tech feature of a large project is the price of the error. With that, as secondary measurement numbers, you may count the number of routes or public Controller methods.Įxample from an open-source Monica CRM project that has 300+ lines of code in routes/web.php file: ![]() If you have many models, it usually means complexity. In simple terms, how many Eloquent Models your project has. ![]() What I mean by a larger project is mostly the number of entities to manage. Yes, but it's a large database, not the Laravel project itself. ![]() Some people measure that in the number of database records, like million rows in users table is large. Disclaimer: What is a LARGE project?įirst, I want to explain what I mean by "large". This article will be full of external links to my own content and community resources, so feel free to check them out. So, in this article, I tried to list the questions (and some answers) to think about, when working with large(r) Laravel projects. Probably the most difficult step in the dev career is to jump from simple CRUD-like projects in the early years into some senior-level stuff with bigger architecture and a higher level of responsibility for the code quality.
0 Comments
Leave a Reply. |