Stop writing more code

After 10 years of software development I stop writing more code and focusing on writing less. When I work on ongoing projects the number of code lines is getting smaller first before I add more code. The reason for this is simple, before I start with new functionalities I first figure out if the system design is supporting new functionalities. Most of the time I see, because of more experience, where it is super easy to refactor the system in a short period of time that I was creating in a less optimal way before.

Refactoring is like writing new functionalities

Refactoring is what? Why do I add new functionalities when I do refactoring? You expect a answer right, here it is: The system is providing more possibilities than before, because there is a meta view of software. One view is what kind of functionalities are implemented. The meta view describes what can be implemented with the system. By refactoring you are enabling the system to do more than it was possible before. Let us look to a small example of a high level of dependencies within a system. Every functionality can be used in the context for what it was written, but not more. If you want to add new functionalities you are forced to add new code, a lot of code. And how can this look like after a good refactoring? You are reducing the number of code dependencies, you can use and extend what is already there and you do not need to write more "stupid code".

Create your own pseudo libraries

To continue my thoughts I was looking for a way to practice this kind of manners. So the little thought game for today is that everything you are creating should be possible to be used as a library. If you design your code by knowing it should be possible to use it in other software projects, you motivate yourself to think of topics like dependencies, scopes, readability, inheritance, performance, parallelism, function naming and maintainability. See your software class and modules as small independent systems in itself, as independent small cells of a huge body. It will not surprise you that this code can be unit tested very easily. Having this in mind it illustrates why writing more code cannot be the solution, sometimes it is just writing it in another meta context.