Cars get old too

Hélder Sancho
xgeeks
Published in
4 min readMar 25, 2021

A Success Story on Marketplace Refactoring

It’s likely you know someone that owns a car, right? But it is even more likely that you know someone who had to get their car fixed. As people do, cars get older too. When a car gets older, and the manufacturer’s warranty runs out, it is not always easy to find a good repair shop, especially in the right location, with the right experience, the right tools and the right credentials.

by Matthew Daniels on Unsplash

Internet doesn’t seem like it was made for reference checks of repair shops for cars. So, why not making it easier for all of us, car owners? A marketplace that matches owners with certified mechanics seemed to be the solution our partner was looking for. Our xgeeks team jumped into it and was responsible for optimizing the marketplace that seemed to be having a bumpy ride.

First things first, the team noticed the code seemed to be, let’s say, messy. It didn’t follow any standards, and wasn’t formatted, making it much harder, if not impossible, to maintain. Using the aptly named PHP Mess Detector (PHPMD) to analyze code complexity, we detected more than 15,000 errors and warnings. With this, the project team understood the challenge they had ahead themselves.

Many of these issues were related with the fact the application was built with CodeIgniter, which doesn’t support code modularity by default: a deficit that makes code logic needlessly complex and hard to understand, making it even more challenging to implement new features.

Additionally, another expert team also evaluated the codebase, to make sure our understanding and action plan to make this marketplace more secure, drew the same conclusions. They also advised the company to rebuild the code from scratch as we initially did. By migrating from CodeIgniter to Laravel instead, the issues were solved much quicker than first expected, and therefore, at a much lower cost. This brought some additional return on investment to the product.

Since Laravel and CodeIgniter are both PHP frameworks, it was possible to leverage from our existing expertise in Laravel, which is more accurate to optimize larger projects and to design for extensibility. The detailed recommendation was to migrate from CodeIgniter 3.1.8 to Laravel 7.0 (PHP7.4) and implement Vue.js (3.0.0) for the Lead Management System (LMS) used to manage enquiries.

xgeeks’ work on this marketplace allowed to enhance the application’s performance in many levels, from test coverage, to security, including versioning, CI/CD and other aspects. Regarding test coverage, on the day the team started to work on this project, it was 0%, so there was a long way to go. Today, it’s 84%.

by Klim Musalimov on Unsplash

Security was an important issue to address in this project. It was far too easy for external stakeholders to use SQL Injections to get hold of sensitive user data stored in the database. Nowadays, a marketplace cannot run under these circumstances, this huge flaw was fixed, hence the platform became more secure to all its users.

When our team started the project, the Lead Management System was causing readability and performance issues. Furthermore, it didn’t have automatic backups. Our work led to a normalized database, all its data was optimized, and automatic backups were configured too. With no versioning system in place, it was painful for the developers to keep track of changes to the code and super-complex to revert live problems from the system. We implemented a Git strategy to solve these issues.

When it comes to deployment system, the agility of deployments was enhanced by changing from manual FTP to GitHub webhooks integrated with a Plesk control panel. About CI/CD, since there was no CI/CD strategy in place, our team used GitHub Actions to run automatic tests, and that aimed to predict and pre-empt errors before going to production. The linters in line together with the best practice guidelines had a crucial role in the maintenance of the code.

These aspects took this marketplace to another level of its ultimate vision of connecting car owners with repair shops, while making it secure and scalable. It is likely you will meet someone who got their car fixed through this platform. Cars will get old, but this marketplace won’t.

If you find this article interesting, please share it, because you know — Sharing is caring!

If you enjoy working at a large scale in projects with global impact and if you like a real challenge, feel free to reach out to us at xgeeks! We are growing our team and you might be the next one to join this group of talented people 😉

Check out our social media channels if you want to get a sneak peek of life at xgeeks! See you soon!

--

--