Shadab Khan5,470 Points
Question regarding Path class encapsulation
Hi, I understand Jeremy's explanation on how encapsulation can foolproof the consumers of a class should the class creator decide to use another form of an array (List for e.g.) instead of simple arrays in the future. However, what happens to the existing consumers of the class in that case ? Won't their code break in case they're still passing an 'array' of path to perform path operations. How will a List cater for an array in that case then ?
Steven Parker203,214 Points
If backwards compatibility is an issue, the implementer should leave the original method and create the new one as an overload (same name, different argument(s)).
Optionally, the body of the original method can be modified to perform any necessary conversions and then call the new method.