Meanwhile I've read a little bit further in the book. In chapter 7 this topic comes up again and Steve McConell says that there are really two camps.
The one say that you should pass just the parameters needed for the calculation because it's more loosely coupled, easier to read and that passing an object is violating encapsulation (of this parameter object). The others say that it makes the interface more stable when the method takes the object as a parameter, because the method could take into account any other attribute of that object for its calculation without changing the interface. Steve McConnel then says that both are two simple: It's more about the abstraction the method provides. Further, if you pass an object you can recognize that you should have passed the parameters instead if you create the object just for the method call, setting the parameters needed for the calculation, pass it to the method which just unwrapps the parameters from the object. If you chose to pass the parameters to the method you can recognize that you should have passed an object instead if you frequently change the signature of the method, always adding/removing a parameter that always belongs to the same type of object. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "The Java Posse" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/javaposse?hl=en -~----------~----~----~----~------~----~------~--~---
