A key focus area forward is to think sustainable through all you do, create, and maintain, both in your work life and in your personal life. But how do you do this? For me, an element that I use at work is to focus on clean code. What I mean by that is to have the discipline to follow some simple rules and structures. Take some extra time to think before you write code.
When you go for a walk in the forest and you see litter laying on the side of the path, you know that this is not good for the animals and the plants in this area. It is also something that does not fit in and disturbs the beauty of nature. When there is no litter, you can enjoy the scenery and just go on your way and enjoy. The same can be said for code. If the code you are working with has been kept clean, you can easily find your way and do your work without being disturbed by the mess left behind. When you go through the code and it is not kept clean, you know that this is not good for performance, and maintainability and is not sustainable in the long run. In the worst case, the best thing may be to make something new.
If you experience this, the best thing is to start cleaning up, and as with the environment, it is not an easy task. It requires hard work and discipline; it is a marathon, not a sprint.
Follow the metaphor of the forest path with litter on the roadside. If you think the solution to keep the path clean is that everyone stops throwing litter in nature; it is not that simple, but it will definitely help. Litter can also be spread accidentally by factors other than people, that is out of our control, like animals and wind. This can also be linked to coding. If everyone is disciplined and follows a guideline, in an ideal world, the code will have the best possible performance, be a dream to maintain and there will be no reason to replace or rewrite the code. But like nature, there is a change in technology that you cannot control. As a result of this, you will occasionally need to do a cleanup. And to be real, no one is perfect, and everyone will make mistakes once in a while.
The cleanup of code can be done gradually and when noticed, the same way as if when you go for a walk, and see some trash, you pick it up and throw it in the nearest trash can. You can occasionally set aside some time to do a thorough clean-up, like if you go out plogging. Meaning that you go for a jog with the intention of picking up trash.
Start writing clean code
Now on to how you can get into writing clean code. There are several ways to become a cleaner and a more professional programmer. It is a difficult and a never-ending learning experience since there are many ways to write clean. You will probably also work with different technologies and people that will influence how to write clean code. This is a subject you cannot master fast; it is hard work and probably requires new ways of thinking when coding.
To start with, I will recommend reading articles or a book on more specific ways of writing cleaner code. After reading you will probably realize how you can implement this knowledge when coding. If appropriate, refactor what you are working on to put into practice what you have learned. Read up on different structures and best practices and improve testing. Discuss with your colleges and spread your knowledge so that eventually everyone is working clean. Constantly be aware of how you write new code and refactor existing code.
In my experience cleaner code will make everything you are working on easier to maintain and make it more sustainable and durable. If you follow through on this, you will be proud of what you are creating and you can with confidence say that you are making software better and more sustainable.