Good day, and welcome to my first ever blog post on Will May’s Journey to Educate Himself in Software Development. Today I want to discuss my most recent personal project – an e-commerce website built on top of a custom-built PHP MVC framework, complete with both a customer-facing shopping experience and a staff-facing content management system. The website is for a fake supermarket company called Bargain Basement.
For a period of around two months, I spent almost every evening working on this project: my first serious web application. I must confess that, unlike some of the projects I’ve worked on in the past, this one was not exactly a labour of love, and it was with a sigh of something like relief that I eventually laid down the virtual quill in mid-March. Why? Well, as the scale of the application grew, I got the distinct sense that my work was becoming shabbier. Shabbier not in the sense that individual lines or even blocks of code were being written poorly; rather, shabbier for the fact that I was semi-consciously neglecting the underlying skeletomuscular architecture of the application, the very ligaments and tendons that held everything together, in favour of transient gains. The scale of what I wanted to achieve with this application was never clearly defined, and there was an endless list of features to code and fixes to make; it was in this demanding context that shortcuts were taken. Shortcuts that did, in the end, lead to the relatively timely production of a fairly complete, well-featured little website; but shortcuts that simultaneously compromised its robustness and future viability.
Nevertheless, I feel a great sense of satisfaction at having created this thing, and I certainly learnt a lot in the process. First and foremost, what better way to learn how a modern MVC web application works than to code one yourself from scratch, with nary a framework in sight? I should at this point give thanks to Zura Sekhniashvili (AKA “The Codeholic”), of YouTube fame, whose free, six-hour video series Use PHP to Create an MVC Framework formed the basis for this entire project. Zura’s “Laravel-lite” was a brilliantly scoped piece of work, one that managed to retain a fairly light weight despite being packed full of real-world functionality. Among the MVC concepts implemented were dependency injection, routing, separation of concerns during request handling, data validation and database abstraction, through object-relational mapping and migrations. From my perspective, as well as building on top of what Zura had done, I’m proud to say that I truly got my hands dirty with this core code as well, making substantial changes to most of the core classes, as well as coming up with some of my own architectural innovations, such as my “Layout Tree” (patent pending!) concept for arbitrarily deep nesting and hot-swapping of view files, which I might discuss in a future post.
Things to take away for the future…
- Work on smaller projects – This one was a little bit ambitious for a starter project, in hindsight. For the time being, any projects I pick up should be smaller and denser, with less emphasis on utilising existing knowledge to meticulously build out a complicated front end, and more emphasis on interfacing with new tools and techniques
- Have a defined endpoint – Without one, it can be easy to lose focus and motivation. That was certainly the case here, as I found myself robotically building out feature after feature, with little light at the end of the tunnel
- Do something interesting – Perhaps unsurprisingly, building a website for a supermarket that doesn’t exist turned from an amusing little diversion into a study in nihilism. In future, I should pick a project whose end product is something I’m actually excited to see
You can see my code for this project here. Thanks for reading, and see you next time.
Well done mate!
Look forward to seeing the next one.