Seaside-Examples-Store-Model


Seaside-Examples-Store-Model Comment
WAStoreAddress
A simple model of a billing or shipping address.  Stores strings for a person's name, street, city, and country.  Apart from accessors for these, the only behavior this provides is a #validate method which will throw errors if street, city, or country is nil.
WAStoreCart
A shopping cart.  This is essentially a specialized Bag: you can #add: or #remove: WAStoreItems to it, and calculate their #totalPrice.  You can also use #countsAndItems to get a collection of associations between the items and the number of times they appear in the cart, useful for summary displays.
WAStoreCreditCard
Models credit card information - it has accessors for #name and #number (both strings), and #expiry date.  #validate throws an error if anything is missing, or if the expiry date is in the past.

This is intended to be an abstract class - the subclasses WAStoreMasterCard and WAStoreVisaCard provide further validation.
WAStoreInventory
The list of inventory items.  In a real application, this would probably have to deal with persistence, maintaining inventory counts, etc.  In this example, it just builds a collection of WAStoreItems from a hardcoded data set, and provides #allItems and #findItem: for accessing these.
WAStoreItem
Models a single item of inventory - stores a title, subtitle, fill description, and price.  The only real behavior is #matches:, which is used for search.
WAStoreMasterCard
Adds MasterCard-specific validation to WAStoreCreditCard.
WAStoreVisaCard
Adds VISA-specific validation to WAStoreCreditCard.

^top


- made by Dandelion -