So far all of the examples of removing argument order dependencies have been for situations where you control the signature of the method that needs to change. You will not always have this luxury; sometimes you will be forced to depend on a method that requires fixed-order arguments where you do not own and thus cannot change the method itself.
Gear is part of a framework and that its initialization method requires fixed-order arguments. Imagine also that your code has many places where you must create a new instance of
initialize method is external to your application; ...
- Chapter 3. Managing Dependencies
- from Practical Object-Oriented Design in Ruby: An Agile Primer
- Publisher: Addison-Wesley Professional
- Released: September 2012
Sometimes removing argument is impossible. For example your code may use some method from an external framework. In this case it is possible to use a wrapper method or even create a wrapper class to be able to remove the order dependency.
Share this highlighthttp://www.safaribooksonline.com/a/practical-object-oriented-design/3553/