|
Posted by Oliver Grδtz on 10/16/07 03:29
Jerry Stuckle schrieb:
> Oliver GrΓ€tz wrote:
>> Jerry Stuckle schrieb:
>>> Oliver GrΓ€tz wrote:
>>>> $topping2 = new withExtraTopping($topping1);
>>>> $total = $topping2->getPrice();
>>>> print $total;
>>>>
>>>> Where's the problem, it's a simple decorator example.
>>>>
>>> Several things.
>>>
>>> What's the difference between an object of class withExtraTopping and
>>> $topping1?
>>>
>>> What is the price of $topping2? Every pizza place I know charges more
>>> for the same topping on a larger pizza.
>>>
>> Changing the concept is out of scope here. I simply ANSWERED the
>> question asked by the original poster. Changing the price of extra
>> toppings and making the price dependent on the pizza size was NOT part
>> of the question.
>>
>
> It is if you're emulating the real world.
>
> Initial requirements do not always reflect final needs.
>
Yes, but you were answering to MY RESPONSE and not to the original
poster. I just DIRECTLY answered the question. Other evangelizing
answers had already been given (and I didn't need to elaborate on them)
but I personally dislike the fact that these people tend to bring up
more questions INSTEAD OF solving the problem at hand. You can bring up
your own concept, fine. But please ANSWER THE QUESTION first. What
speaks against the idea that iavian just didn't get the concept of a
decorator? Nothing, since the code he already had was well capable of
solving the questions he asked without change!
OLLi
--
Never change a running system.
Navigation:
[Reply to this message]
|