> > The way I try to answer these sorts of questions for myself 
> > is to ask how things would work in "real life".
> 
> ok, I think this is where I'm gettin' screwed up a bit. I'm 
> thinking how would it work in real life? You'd have your cart 
> full of items, roll it up to the checkout counter (an 
> object), the cashier removes all the items *from* the cart 
> and adds them up there on the counter. Then adds shipping, 
> asks for payment info, etc. 
> 
> So as I'm thinking it through, I'm thinking cart and checkout 
> are two separate things/objects. 
> 
> I understand what you're saying but still kinda mixed up on 
> how it should work.

I agree, these things aren't immediately obvious. But there are some objects
that are significant to your model, and some that aren't. Before you start
writing any code, you have to figure out the significant objects within your
model, and how they will interact. For example, in a shopping model, you
have customers, items to buy, and carts. Customers select items, and place
them in their cart (or take them out). Customers purchase the contents of
their cart. You want your model to be as simple as possible - but no
simpler!

If you come from a procedural background, like I do, it's worth pointing out
that your objects will mainly be derived from the things you store within
your database. In a shopping cart example, within your database you'll store
information about customers, items, orders, and lineitems. Customers and
items objects within your application might be derived directly from your
database, while cart objects are essentially orders and lineitems (before
the order is placed, of course).

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/

Fig Leaf Software provides the highest caliber vendor-authorized
instruction at our training centers in Washington DC, Atlanta,
Chicago, Baltimore, Northern Virginia, or on-site at your location.
Visit http://training.figleaf.com/ for more information!


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:233634
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to