in reply to Re^9: How could we "implement" Open Classes in Perl ?
in thread How could we "implement" Open Classes in Perl ?
As for the "future-proof ploy", the key is that it doesn't cost me anything to do things a way that allows me to have options down the road. For example, I could have a maze that shifts over time through the use of secret doors, etc. Using methods, I just have to change the method and the effect occurs at the location of the change. Using a normal design, getLeft() would have to know about all the different possible scenarios. This means that getLeft() would have updated every time a new method of changing the connections between the rooms comes up. Using this method, a new method of changing connections could be added without getLeft() ever having to be aware that it was changed. All of a sudden, we have a plugin system without any work.
|
|---|