The past week , I have been doing more refactoring in the Tong Hin’s inventory module , to allow maintainable code in the project .
Writing maintainable code simply means code that is easy to modify, read or extend , not just to be understood by ourselves so the program “runs” but easy to be read by current/future users involved in a project . In other words , not causing an immense grief to other group members .
Aside from the classic practices for newer developers such as writing comments , giving meaningful variable names , writing testable code , clean coding etc . Trust me , it really ain’t enough .
Any software developer will get into these situations where we face an “endless loop” of errors when creating a feature . Fixing an error from one part and another pops up within this feature , while repeatedly adding more messy if-else null checking statements to avoid/fix each error , and “forcing” maintainable code while losing our sanity on top of it.
In these situations , we should realize that simplicity is part of the answer , that no user interaction is also the best user interaction . Ask ourselves if it needs to be done at all ? Because throwing away 30% of the problem for 70% of the solution may fix the problem .
With that said , maintainable coding is really easier said than done . It requires us to think out of the box , which cannot be taught to anyone . There are cases where we can avoid/fix the “endless loop” of errors by trying weird things , adding/removing a button , twisting and avoiding the root problem and out of nowhere get the answer .
