Прав си...
0 отговора
0 прегледа
Прав си...
... МНОГО е готин езикът!
накара ме да си мисля че до сега съм хапвал го... ммм не-хубави-работи
освен това документацията кърти мивки:
Programming Ruby, HTML edition:
...We're correctly displaying the value of the @lyrics instance variable. To do this, the subclass directly accesses the instance variables of its ancestors. So why is this a bad way to implement to_s?
The answer has to do with good programming style (and something called decoupling). By poking around in our parent's internal state, we're tying ourselves tightly to its implementation. Say we decided to change Song to store the duration in milliseconds. Suddenly, KaraokeSong would start reporting ridiculous values. The idea of a karaoke version of ``My Way'' that lasts for 3750 minutes is just too frightening to consider.
...ахахахаха! на пръв поглед просто подминах изречението... ама после щях да се попикая от смях!


накара ме да си мисля че до сега съм хапвал го... ммм не-хубави-работи
освен това документацията кърти мивки:
Programming Ruby, HTML edition:
...We're correctly displaying the value of the @lyrics instance variable. To do this, the subclass directly accesses the instance variables of its ancestors. So why is this a bad way to implement to_s?
The answer has to do with good programming style (and something called decoupling). By poking around in our parent's internal state, we're tying ourselves tightly to its implementation. Say we decided to change Song to store the duration in milliseconds. Suddenly, KaraokeSong would start reporting ridiculous values. The idea of a karaoke version of ``My Way'' that lasts for 3750 minutes is just too frightening to consider.
...ахахахаха! на пръв поглед просто подминах изречението... ама после щях да се попикая от смях!