How to enhance maintenance performance

Here are some points I keep in my mind to enhance maintenance performance

  1. Let's make it simplest
    Of course the shorter the code, the better if it can do the same thing. Because there is a limit in size for one person to look up. So I think the compactness of code and maintenance performance are directly connected. And I think OOP have a potential to keep the code very small. Some rules of OOP are, Implement one function at one place only (Same as "Don't write the same code twice"), And, Implement a function in upper class (parent class) as much as we can. To meet this rule, the function of a method should be one simple thing only, then combine them to achieve more complex ideas. (But always one single idea for one method.) If there are similar code at two places, it means the similar part can be one method and be implemented in the upper class. The size of code can be reduced with these processes. And the function should be general-purpose as much as we can so that we don't have to have multiple passes for various cases. And I think one of the important thing of OOP is, finding out the trues of the specifications. For example, If I want to build a house modeler, and plan to have like "wall class" and "window class". But I can make them into one with ideas like transmittance of air, transmittance of light. Later I may have a inherited class when I need a advanced function like "opening window" or so. With or without those minds above, I think there will be a big difference in the size of code.

  2. Naming is a big thing
    The codes are hidden In OOP. So some times it's confusing what it is doing. So the name of method is very important. I always put long name like "GetVolumeOfSpace()". I think it's a good thing that code can be read like a document even it's grammatically imperfect. The name of variables in methods should be long enough to tell its meanings as well.

  3. "Don't have a effect on the existing code" is wrong!
    It is told often in maintenance. (at least in Japan) But I think this is wrong. For example, If I need to enhance a method "GetPrice()" to get a price in Yen, people easily copy and modify it and change the name slightly like "GetPriceYen()". But I think this is evil. The code will be a labyrinth after one year of maintenance in this way. For this case I want to modify the method itself like "GetPrice( enum currency )" and replace all the existing "GetPrice()" with "GetPrice( _DOLLAR )".
    I want to say "Have a positive effect on the existing code" instead.
Home > Guideline

Copyright(C) Since 2007 DeepDigital Co.,Ltd. All Rights Reserved.