See all articles

Who makes the worst code pasta? The dangers of spaghetti code

Stakeholders - and, as some would claim - Project Managers in particular, are often dismissive of the quality of the code produced by a software development team. They care about fast results, about delivering on a project and quickly moving on to the next one. This topic came up in a recent discussion in which iRonin’s CEO, Cyprian, participated - and he has some strong opinions on the subject. One of them is that spaghetti code is not at all as tasty as it sounds, and that the developers who produce it are solely responsible for it.

What is spaghetti code?

The term is used pejoratively to denote badly structured, recklessly written code that’s difficult to maintain. It can be the result of changing project requirements, poor team culture and the low skill of developers. The results of producing such code can be quite disastrous.

Low-quality code is difficult to maintain, scale and extend. This means accruing technical debt: every time a large change needs to be introduced, rewriting sections of existing code is going to be a must, as the codebase would not have been ready for these changes. This means extra work (and expenses) every time the project expands. Technical debt can be crippling and even prevent a product from ever reaching its full potential. Additionally, code that’s badly structured and difficult to read is a security risk, as it’s much easier to miss potential security issues.

All of the above also means that spaghetti code, despite having a low production cost, generates large losses over time. The costs of maintaining and scaling it become exorbitant very soon. In this way, high quality code that’s initially more expensive to produce can be cheaper overall.

Aside from threatening the project (through poor quality that might put off users and technical debt that might sink the client’s business after a time), this situation is extremely undesirable because of the competitive nature of the IT job market. If developers leave, it’s going to be very difficult, time-consuming and costly to replace them. The trick to success in the IT industry seems to be pouring resources into finding and retaining the best talent, and one way to do it is provide them with challenging, exciting projects.

If the worst does no occur and team members don’t leave, they’re going to be frustrated and unmotivated. This will have an impact on the atmosphere within the team, and possibly on the entire company’s culture. Job satisfaction might go down. An unchallenged team will also be unable to properly develop professionally - without good learning opportunities, they will stagnate, maybe even fall behind their peers. This will slowly reduce their value on the job market and, as a result, reduce the value of the company’s assets.

Who produces spaghetti code?

The short answer is: unmotivated developers, or ones whose skills don’t match project requirements. As Cyprian says, “code quality is up to the developers. Great devs make the best pasta.” The claim from the introduction to this article, about PMs influencing code quality, can’t be taken at face value.

Imagine a situation in which a team’s PM pushes the developers to work as fast as possible, at the cost of quality and satisfaction. What’s going to happen? Unless they can effect a change in approach, the great developers on the team will either lose all motivation or leave for greener pastures, where they will be able to pour their passion into their work. The team will be reduced to the unmotivated and mediocre, unable to implement project requirements in the optimal way.

How to produce good code - iRonin’s solutions

Good code means smart code. It isn’t necessarily longer to write or more expensive. Skilled developers who’ve worked with a variety of projects can use best development practices pretty much in their sleep. Especially if the projects they work on match their skills and interests. Our approach at iRonin is that, as service providers, we have a responsibility to deliver the highest quality of code possible.

Creating a situation in which a development team will produce great code is easier than it might seem. First, make sure that the project’s requirements match the team’s skills. You can’t expect a junior developer to be able to complete certain tasks in a timely manner, just as it would be demotivating to saddle a senior dev with menial work. The technology you or the project owners choose is just as important. While most developers pick up new languages and frameworks with ease, you shouldn’t expect them to do so if they don’t care for that particular technology on any level. Don’t force RoR devs to work with PHP if they hate it. They could do it, but they wouldn’t be motivated enough to give it their best. And remember: good code can be written in any language, as long as the developers enjoy it.

You might think that the suggestion to match your projects to your devs’ skills is unrealistic. But the truth is that you shouldn’t accept every project that comes your way. It’s tempting - more business is always good, right? - but it’s also not uncommon for companies to fall apart because of constantly changing expectations, technologies, processes and methodologies. Developers usually like challenges and new experiences, but these need to fall within their area of interest. On that note: invest in your developers’ motivation and growth. Send them to conferences, support their professional initiatives and let them have a say in what solutions to apply for each project. This way, you’ll help them constantly grow and stay motivated, and they’ll be happy to work with you for a long time.

Conclusions

Cyprian’s advice is not to stay within your comfort zone. To the contrary - it’s good to follow new trends and make use of cutting edge solutions. The important thing is to respect the developers on your team, to give them opportunities to grow and work on projects they’re excited about. In IT, skilled and experienced people are the core value of any business. It’s important to support them when they want to deliver the quality of code that fits their experience and dedication.

iRonin’s team always focuses on technical excellency and high code quality in our projects.

We believe that it’s our responsibility to make optimal choices for our clients, and to support them with all of our skill and experience.

Similar articles