When is Software Too Complex?



When is Software Too Complex?

Gone are the days of simple software programs used to complete a task or two to help users’ lives become a bit easier. In today’s software landscape, complexity is more in-demand than ever. Brands, companies, and even individuals want their new apps to act like the Swiss Army knives of technology with layered, complicated feature sets and a wide array of functions alongside a beautiful, intuitive user interface.

With the introduction of the cloud-native era and many advancements in the world of tech, the current landscape already migrated from massive software architectures with real physical servers to breaking things down into containers in a distributed cloud computing environment. These changes, along with the expectation that each piece of software features rich, UI-focused experiences, make for incredibly complex development.

What is Software Complexity?

Software is an intangible product, which makes it notoriously difficult to measure in terms of metrics, but its complexity is one aspect that’s easily quantified. Software complexity is the way developers describe a specific set of characteristics within their code. These characteristics focus specifically on how pieces of code interact with others in the codebase.

The complexity acts as a software quality grade for the code and is a measurement of these characteristics. There are, of course, a multitude of ways to measure these characteristics and thus their complexity, but there are a few main methods and metrics utilized today to evaluate the complexity of code:

  • Cyclomatic Complexity - Definitely the better-known method, it’s even common for the interchangeable use of software complexity and cyclomatic complexity as terms. Cyclomatic complexity measures the number of linearly independent paths throughout a piece of code. This “linear path” refers to a unique path with loops only counted once. Devs use a control flow graph to calculate it.
  • Source Lines of Code (SLOC) - A more literal way of judging complexity, SLOC counts the number of lines in source code. It’s the most straightforward metric or method used to determine complexity.
  • Halstead Volume - This measures how much information resides in the source code by evaluating the number of variables and how many times they’re used in functions and programs.
  • Maintainability Index - This helpful metric calculates the overall score of the long-term maintainability of a program in more empirical measurement. It weighs the Halstead volute and Cyclomatic complexity against the number of code lines within a program.

When Does Complex Software Become Too Complex?

It’s definitely understandable that clients want the most “bang for their buck” when it comes to new software. However, this comes at a price for both the dev team and the client themselves. In addition to dealing with the cloud aspect of development, the dev team also begins to deal with technical debt over time and a loss of quality in some cases.

When left unmanaged, code complexity becomes a type of technical debt. Developers obviously don’t ever want to “owe” their client something like this but it does happen due to a variety of reasons. Sometimes the client demands the addition of a highly complex feature set or even just a last-minute addition to the code. This then leads to issues like enormous codebases filled with thousands of lines of “spaghetti code” instead of elegant, clean, and easily understood code.

In many cases, the devs recognize this issue and have the intention to come back and clean up these messy lines. However, they don’t always get the opportunity to do so as they’re swamped with other tasks, haven’t received training in the art of quality coding, or simply don’t understand the importance of code quality. Sometimes they just don’t have enough time before pushing to market. This creates the “debt” that devs must then return and fix.

When code is messy and reaches a point of overcomplexity where it’s unreadable or unmanageable by developers, it’s too complex. This leads to difficulties for other devs reading the code, a horrible maintenance experience, and a much higher likelihood of bugs, faults, and defects.

How to Prevent Overly Complex Code

All software development projects contain some degree of complexity in their codebases and it’s sometimes impossible to refactor or reduce overly complex code without rewriting an entire project. However, the way to manage these features is by identifying which aspects of the complex code have the biggest impact on the end users to focus resources and efforts there.

Project managers and client liaisons should also use their roles to empower their development teams to help clients understand what’s reasonable and feasible when complex additions arise. The development team should also ensure that their timelines are fair enough to handle any overly complex areas before pushing to production.