In the process of teaching my oldest daughter Smalltalk, we finished working through the Gilded Rose Code Kata, for now the code can be found on Smalltalkhub .
The given code is a D&D inventory system, the task is to change the update method so conjured items degrade twice as quickly as normal items. For this we wrote a simple test that degraded a conjured vest by 1 day and compared its value to a normal vest degraded by two days.
One problem which threw us off was GildedRoseImaginaryTest>>#nextDay: takes an argument, but this item must be the same item which is most-recently created by #givenItem:sellIn:quality:. Each time this is sent replaces the inventory.
Its clear that the creators wanted the task to modify GildedRose>>#updateInventory based on the comment that Item should not be modified. An interesting exercise is to support the same functionality by modifying Item and adding subclasses. This means adding a message to express how items lose value:
ItemAgedItemTicketItem ConjuredItemLegendaryItemSeveral advantages are provided by this:
#nextDay on each item. The message Item>>named:... is now a factory for choosing a subclass