Order ShippingAddress OOAD question.

12 views
Skip to first unread message

John Whish

unread,
Jul 7, 2011, 4:55:55 AM7/7/11
to Object-Oriented Programming in ColdFusion
Hi,

I'm hoping to bounce some thoughts off you guys if you don't mind.

I have an existing e-commerce site that has ShippingAddress and
BillingAddress classes which extend an Address (abstract) class.

My Basket object has a simple reference to each. The client now wants
to be able to offer collect from store (they have multiple stores).

My first thought is to have a StoreAddress object which extends
Address. I can then pass this StoreAddress in to the
Basket.setShippingAddress() method.

Does this sound like a good idea?

Thanks,

- John

John Whish

unread,
Jul 7, 2011, 5:03:13 AM7/7/11
to Object-Oriented Programming in ColdFusion
Thinking about this a bit further, I think that I've fallen into the
trap of using inheritance, when I should be thinking of the strategy
pattern.

Thoughts still welcome!

- John

Kevin Roche

unread,
Jul 7, 2011, 6:22:48 AM7/7/11
to coldfu...@googlegroups.com

Jon,
Yes, strategy pattern would be my suggestion.
Kevin

John Whish

unread,
Jul 7, 2011, 7:22:41 AM7/7/11
to coldfu...@googlegroups.com
Thanks Kevin,

That leads me on to the next question which is how you would store the
Address in the Basket. Would you just have an array of addresses in an
address instance variable or still have seperate instance variables in
the basket to store them in?

Thanks :)

> --
> You received this message because you are subscribed to the Google Groups
> "Object-Oriented Programming in ColdFusion" group.
> To post to this group, send email to coldfu...@googlegroups.com.
> To unsubscribe from this group, send email to
> coldfusionoo...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/coldfusionoo?hl=en.
>

Kevin Roche

unread,
Jul 7, 2011, 5:31:18 PM7/7/11
to coldfu...@googlegroups.com

John,

How many adresses could there be?

If there is possibility of there being more then an array is a good choice. In fact I would most likely use an array anyway to make processing easier.

Kevin

Judith Barnett

unread,
Jul 7, 2011, 4:59:54 AM7/7/11
to coldfu...@googlegroups.com
Sounds workable if you only have one address for each store with a
pointer from the customer to the store they want to pick up from. I
wouldn't have a store address for each customer the way you have
billing and shipping.

Judith Barnett

unread,
Jul 7, 2011, 5:02:08 AM7/7/11
to coldfu...@googlegroups.com
Correction - a pointer from the basket (or order) to the store,
because it could change with each order.
Reply all
Reply to author
Forward
0 new messages