In engineering, maintenance means to tear a machine apart, clean it, replace broken parts, oil it and put everything together as it was before. Maintenance is needed to ensure the longevity, the quality of service and also the safety of a machine.
Some people say, that this is not needed for software. Bits do not wear out or break and bits do not need recurrent lubrication. You know what: they are right. This is not what happens in software development. But, as with many other analogies in software development, it is not that easy. You have to think about the goal of maintenance instead: make sure that the software is useful for a long time. Useful means in terms of software, that you are able to change the behavior of the software, either to fix bugs, or to react to changes in the requirements of the software.
Some people say, if you practice clean code development with due diligence, the software is always in shape for changes. But concepts, structures and algorithms wear out over time. When requirements change, the existing implementation does not fit anymore. The many small changes that accumulate over time dillute the original architecture. While the code in detail might be in perfect clean shape, the bigger picture will show some flaws after a certain period.
Some day you will come into the situation where you have to take apart your application and replace some of its parts with better fitting implementations. This is for sure. The problem most of the time is to realize this situation and actually do what is necessary instead of taking a shortcut. And this is the secret of successful software maintenance. Its not about fixing bugs and adding new features until a single change is more expensive than writing everything from scratch. Its mainly about doing those changes that keep the big picture in shape. Its about being able to fix bugs and add new features forever.
By the way: having clean code makes maintenance much much easier, because you only have to take care of the big picture’s shape. If you don’t do clean code development, start now! No really, do it! Now!