Modifying mehtod's input parameters
During maintenance of the legacy projects, I sometimes see constructions like: void appendFooter(Report report); or void populate(Data data); I even saw something like this: void populate(Source source, Target target); What is wrong with these statements? They’re using so called output argument. In the examples above, we’re passing a report or data variable, which usually are going to be global variables available in the scope of the whole class. These methods takes them as an argument and modify them. This idea comes from pre-OOP times and could be applied in programs written in C. Nevertheless, in Java, this technique should be avoided and is considered as a bad practice. ...