The requirements of software are useful to keep in mind. That way, when you apply Clean Code & Programming Principles, you can do it with the right goal in mind, rather than applying programming principles even if it’s detrimental to your project.
Additionally, if you’re still learning programming principles and how to write good code, understanding the fundamental motivation of software should help. You’ll better understand what you’re actually trying to accomplish when you attempt to write clean code and apply programming principles. Additionally, when learning something new, if you can connect it to something you already know, it makes learning easier. In that sense, if you can see how a programming principle helps meet the goals of software, it should be easier to understand and grasp.
Definition of software
Let’s start with the definition.
"Software" is a combination of two words:
Soft means malleable, easy to change etc. In our case, it means that the code we produce must be easy to change.
Ware means a product, goods, etc. In our case the product we produce is a system of code.
Both of those words perfectly describe our requirements / what we’re aiming to achieve when making software:
- A system of code.
- Which must work as intended.
- Which is easy to modify.
Explanation for our requirements
The "ware" part should be pretty clear. Obviously we produce systems of code and the code has to work as intended.
Why software changes often
But the "soft" part may not be immediately obvious. Here is why it’s necessary:
Code needs to change all the time, for many reasons.
- Requirements change all the time.
- We constantly revise and modify the code during development.
- Software needs constant maintenance and improvement, both in terms of bugs and new features.
Because it needs to change so often, we must make sure it is easy for us to change.
Here are the reasons code needs to change in more detail:
Requirements change all the time
We constantly revise the code during development
This is how we work.
If we could design the code upfront perfectly and then just write it, we would be done significantly faster. We would also probably use waterfall and everything would be much better. Unfortunately, it’s not possible for us to do that.
We have found through experience that working on software in iterations is much more effective. This is also what agile advocates. It’s just the nature of our work that we constantly need to revise our code and modify it.
Gall’s law also supports this. It essentially states that we can’t create a system of code in one go, we have to continually revise and build it up.
Software needs constant maintenance
Even after initial development is finished and the stakeholders have accepted the product, software still needs constant maintenance and improvement. See software evolution.
This means we have to continue making changes to the code, potentially indefinitely.
The requirements of software are:
- It should work as intended.
- It should be easy to modify.