It very much depends on the quality of the code base. In fact, you can define it even more narrowly - it depends on how clear the code is and how well commented on it (and I write it as a person who has repeatedly been in the position of inheritance of poorly documented outdated code bases).
The worse the code base, the more you will need to get its functioning outside - if you cannot understand what the function is doing, you can at least figure out what the GUI seems to imply that it does. Having an RMI interface can be a blessing in that it gives you a simplified picture of what a GUI should see - abstracting from a remote interface is a very good idea.
If the code base is really bad, unit tests are unlikely to help you, as you can test for something wrong, even if it is implemented correctly. An example from the last thing I inherited: (names and descriptions are deleted intentionally - they were not useful in the original in any case)
public static int[] a (List<int[]> input){ ... lots of opaque rubbish return b(input); } public static List<int[]> b{ List<int[]> input) { ... more crap.... return some horribly mangled list of int[]; }
As it turned out, to execute a, it was necessary to sort arrays by the value of their second element. Testing b to behave correctly would be futile in this case.
Suggestions to help you stay smart:
- remove code that is not explicitly used.
- Try to specify any "magic numbers"
- find the links to the hardcode file, path or resource, and add them to properties or any other central, general way to deal with them.
- try to find out if the application really works as it should have been - it’s not uncommon for some really complex function that you cannot force the head or tail to actually represent something that users felt “never worked correctly” " .
- Find the original documentation or specifications when it was first developed.
- Since you mentioned 1.4, summary maps can clarify which objects pass. if you have an object supported by HashMap, and how it is filled is a mystery, it can really simplify your life to determine that it is actually a line map for integers - which is often much easier to understand than what actually supposed to do.
Of course, most of this is not required if the code is well written, but then your work will be much easier anyway. And good luck.
Steve B.
source share