DEV Community

Cover image for Confidently Incorrect - Microblogging Platform
Bradley Hill
Bradley Hill

Posted on

Confidently Incorrect - Microblogging Platform

Confidently Incorrect since 1987

Docker, Laravel and MVC

This was a fun project, smaller group, but a return to PHP, this time using the Laravel framework, and having to manage installing docker and using a provided container for the project was the first challenge for us, to the point that before beginning working on the project we had an afternoon reserved for ensuring the Windows users had WSL2 installed and setup to be best placed to initialise the project. Luckily I have been using Ubuntu for all of my coding at Ada Tech School since the beginning, and it definitely simplified this process for myself, although I did make a small mistake with copying the .env.example file provided to .env file after installing the docker container which caused it not to work, so I had to do a fresh installation making sure to follow the readme to the letter this time.

As a team we decided to conduct the majority of our work as a mob, with one person piloting the keyboard and the others discussing and deciding how to proceed with what code to write, as well as to have a daily meeting each morning to decide upon what our specific goals for that day will be and how we are going to proceed, with a recap held after the lunch break and at the end of the day, to review the work we have done.

Our early days were spent getting used to the Laravel framework, studying the documentation and looking at various short tutorials, from which we used Blade to create our Views, the pages that will be displayed to the users.

One of the benefits of using Laravel is that it imposes an MVC architecture to the project, the Model-View-Controller architecture, which helps greatly with organising the files with shared responsibility into shared directories, separating the responsibilities between the View (user interface and presenting data), the Model (data and business logic) and the Controller (the in-between responsible for communicating between the View and the Model, coordinating the flow of data and the applications' behaviour).

It also helps with writing code bearing in mind the SOLID principles, a very useful group of principles to bear in mind whilst using Laravel and its Object Orientated Programming.

This all went well, but our progress slowed as we progressed from creating the various pages we were going to use, to coding the routes and routing, but once we had become more confident with the syntax become easy to define our endpoints and routing for switching pages.

We also began using an ORM (object relational manager) with our database Eloquent which whilst our first time using an ORM, does very quickly become clear that it facilitates our interaction with our database, which we were using a PostgreSQL database which came bundled in our initial docker container for this project.

The one great failure on our part with our project, was neglecting the testing, when we had PHPUnit available for us to create a suite of unit tests, feature tests, and API testing, all of which would have improved the quality of our application.

If I were to redo this project, I would start from a TDD (Test driven development) approach, and ensure that we had a decent coverage with our tests. It may seem to slow down the process of writing the code, but writing the tests before the code can end up saving you time in the long run, by catching bugs early, and crafting higher quality code from the beginning.

And that is it for this short series discussing the projects completed whilst studying at Ada Tech School, at least whilst I was studying there.

My next short series of articles will be coming shortly, so until next time, stay safe and be well!

Top comments (0)