It's all about complexity
2024-11-06 08:44
Status: #adult
Tags: #philosophy #software #design #books
It's all about complexity
Complexity is anything related to the structure of a software system that makes it hard to understand and modify.
- How does a piece of code work?
- Hard to implement small improvement...
- Not clear what parts to change to make the improvements?
- Hard to fix a bug without introducing another
At the end of the day, we want to understand how a system works and how to modify it and if we can achieve that then the system is simple.
People often tend to describe large and sophisticated systems as complex; in reality, these systems should not be described as complex if they are easy to understand and modify. Needless to say, there is often a correlation between the latter and the size of the program/codebase.
One must also note that systems are made of parts and those parts do vary by the amount of interaction. If a system has one complex component that will not be touched more than once a year then this will contribute less to the complexity status of such program.
One could use the following mathematical relation to describe such relationship:
The overall complexity of the system (C) is determined by the complexity of each part p weighted by the fraction of time developers spend working on that part. Isolating complexity in a place where it will never be seen is almost as good as eliminating the complexity entirely.
Complexity is more apparent to readers than writers. If you write a piece of code and it seems simple to you, but other people think it is complex, then it is complex. When you find yourself in situations like this, it's worth probing the other developers to find out why the code seems complex to them; there are probably some interesting lessons to learn from the disconnect between your opinion and theirs. Your job as a developer is not just to create code that you can work with easily, but to create code that others can also work with easily.
References
criteria_for_modularization.pdf