Stuck at the design part of creating a shopping cart class

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

User avatar
raghavan20
DevNet Resident
Posts: 1451
Joined: Sat Jun 11, 2005 6:57 am
Location: London, UK
Contact:

Post by raghavan20 »

i think you have made things complex. It is good to use design patterns but it is very easy to misuse it. i am not good at design patterns but i am still sharing a word of caution.

i tried to model something simple and similar, may be you should have a look at this
logical model.

i have not filled in all attributes and methods but I know you can understand what I am trying to say from the model.

Thanks.

feyd | switched [img] to [url]: 1066×718 @ 65K.
Last edited by raghavan20 on Mon Dec 18, 2006 11:03 am, edited 2 times in total.
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Post by Kieran Huggins »

Premature optimization is the root of all evil!

Make it work before you worry too much about your database server load ;-)

If my suspicions are correct, your users won't be staring at past order summaries so often that those extra queries will matter a whole lot. Besides, if the case for optimization is strong once you've got it working, I would just buffer the results for each order, all but eliminating subsequent database expenses.

Cal Henderson has a really good section in Building Scalable Web Sites that deals specifically with this concept. The book is amazing, btw.

Cheers,
Kieran
Post Reply