So, we've got a guy who likes to write methods that take Objects as parameters, so they can be 'very flexible.' Then, internally, he either does direct casting, reflection or method overloading to handle the different types.I feel like this is a bad practice, but I can't explain exactly why, except that it makes it more difficult to read. Are there other more concrete reasons why this would be a bad practice? What would those be?So, some folks have asked for an example. He has an interface defined, something like:public void construct(Object input, Object output);And he plans to use these by putting several in a list, so it sort of builds bits and adds them to the output object, like so:for (ConstructingThing thing : constructingThings)    thing.construct(input, output);return output;Then, in the thing that implements construct, there is a rickety reflection thing that finds the right method that matches the input/output and calls it, passing input/output.I keep telling him, it works, I understand it works, but so does putting everything into a single class. We're talking about reuse and maintainability, and I think he's actually constraining himself and has less reuse than he thinks. The maintainability, while probably high for him right now, will likely be very low for him and anyone else in the future.
Is it poor programming practice to pass parameters as Objects?
java;object oriented;type safety
From a practical point of view I see these problems:A bloat of possible run type errors -- unless a lot of dynamic type checking which could be avoided with the Java included strong type checker.A lot of unnecessary castsDifficulty understanding what a method does by its signatureFrom a theoretical point of view I see these problems:A lack of contracts of the interface of a class. If all parameters are of Object type then you aren't declaring anything informative to the client classes.A lack of overloading possibilitiesThe incorrectness of override. You are able to override a method and change its parameter types thus breaking everything which is inheritance related.