Intro
In my career as a programmer, I have repeatedly come across the 3 most important principles of programming, which then became the RUM principle. This principle is the guideline for any successful collaboration between programmers and an important building block for the Clean Code aspect.
The RUM principle, which is made up of the first letters of the words “Readable”, “Understandable” and “Maintainable”, aims to create a common understanding within the team about the processes and decisions related to code.
Readable
This principle is about the readability of code. When we read code, we often develop so-called reading patterns that help us find our way around the code. These reading patterns are important and it is important that a reader can recognize and learn them quickly.
It is necessary to agree on a consistent pattern and follow it. Formatters and static code analysis often help apply these rules automatically. There are also topics such as the placement of certain code blocks, declarations and line breaks that also need to be considered.
Personally, I think it’s good to think of it like a newspaper. In it, you have headings (which should represent the file names) and subheadings (public interface definitions) where you can easily find your way around. Once it gets to the detailed implementation, everything in the file is structured by importance (public > private). This has the advantage that I can get a good overview of the flow and as soon as I want to know more I go more and more into the nesting (ideally when scrolling down the file).
But here you have to coordinate with the team and find a pattern that suits everyone and of course document it. So that new team members can understand and apply it.
Understandable
Not only reading alone is required, understanding what you read is also a very important part. Perhaps you’ve encountered this situation when reading a book that you’ve processed too much information. By the end of the page, you no longer knew what the page was about.
Our brain only has a certain capacity of free information that it can absorb and process. If the capacity is exhausted, we often need a break, or we quickly fall into a tunnel mode in which we can take in everything but can no longer process it properly.
In programming, this is a very important concept to be aware of. Understanding the code is an absolutely important factor that matters. Otherwise, errors will quickly occur that are built-in due to misunderstandings.
This principle is intended to illuminate and demonstrate just that. A well-divided code that is good for the brain to process.
When programming, one should ask oneself, in which area I am at the moment. How can I make this available to others in good portions so that they can easily understand it without having to dig through several lines of cryptic calls?
Here it is helpful to split the code well, move the code to classes/methods or files (depending on the programming language) and give the extracted logic an appropriate name that describes the context behaviour.
As a result, individual logic blocks no longer consist of multiple complex operations written under each other. Instead, they have been outsourced to individual decoupled areas that can be viewed separately as needed.
There are other topics that fall under this principle, such as avoiding condition nesting, early returns, a functional programming approach and many more.
I personally think that you should always keep the KISS principle in mind. This provides a good reference point for writing understandable code.
Maintainable
Essential points are the first two principles Readable and Understandable for the maintainability of the code. This principle is intended to put a special focus on the fact that code can change over time.
The code must be well prepared for possible changes. But this does not mean that you have to think through every case and build it so abstractly that you can put it together in a modular way (if this is not the goal/USP of the project).
Rather, it is about outsourcing critical key components and creating pipelines. This is to improve maintainability if the project is long or becomes more complex.
Examples include wrapping third-party API calls, bundling configuration parameters, creating various tests that check the system for errors, or creating a build/deploy pipeline.
The code should provide a good entry point for newcomers to the project as well as for people who have not worked on it for a long time. This can be supported by detailed documentation and standardized pipelines.
Conclusion
In my opinion, the RUM principle consists of the basics for successful programming. A code should be well readable, understandable and maintainable.
The individual principles of RUM are interdependent and complement each other. The principles take up many already existing concepts and principles and these can be assigned to the individual RUM principles.
Support
If you enjoyed this post and found it helpful, please leave a comment below.
I'm always working on something, if you're interested feel free to follow me on Twitter
Top comments (0)