Hi all, does anyone know of a site which I can download all of the code, etc that has been built pretty much entirely using OOP? I understand the basics of OOP but struggle in deciding what needs to be, what functions to create, etc.
For example I’m making an e-commerce site; I have a cart class but then on the product page itself, I don’t know what I would need, maybe a class function to calculate the VAT but the product image, description, etc seems to be more logical to do in a procedural fashion. Any help would be really appreciated, struggling to get my head around this!!
There a few, but nearly all are awful and wouldn’t really put you on the right path. Still, they may help you decide what objects to use I guess…
I’m hesitant to really recommend any to be honest, I think I’d be doing more harm than good right now.
Hi dude, cheers for the reply, yeah sure I get your gist, probably best not to confuse me anymore lol! I guess things such as this will come in time…fingers crossed
I think there is where you’re setting yourself up for trouble; by setting that constraint, you’re looking for something where someone is forcing OOP to work in situations where it wouldn’t normally be used - which isn’t what you’re trying to learn.
Hi StarLion, thanks for your reply. Yes, I think your right, maybe OOP isn’t always the right way to go and doing it for the sake of it probably isn’t a wise idea. Thanks for the help
Yer, OOP isn’t necessary for everything. It will definately complivate things aswell, if you try to ‘force’ the use of it.
Try OpenCart: it’s mature, fully functional, it was built using OOPHP, with MVC architecture, by almost only ONE guy. My hero.
It’s open source and free, so you can download it, break it in little pieces and examine them very carefully under a magnifying glass.
It has classes, and is OO but I’d certainly take the responsibilities of each object with a pinch of salt; I personally find it quite poorly designed.
That’s because you’re a PHP God. For us mortals, it’s a pretty good starting point
Hi Anthony… I’m trying to become a PHP God myself now
Can you please please post me to relevant topics that discuss this issue? I’ve been all over the OpenCart forums. A couple of posters who gave suggestions and feedback about the code structure were beheaded by Mr. Kerr He loves his app very much, and so the discussions have not been too fruitful.
I’ve tried searching Sitepoint with Google for keywords “Opencart” and “Opencart Design”… and there were only a couple of threads that have vague reference to the apparent awfulness of OC… but no in-depth analysis.
Now, it is most unfair to expect you to post a blow-by-blow of description of everything that is wrong with OC - that’s a journey best left for me to go through - but if you could just drop a few high level hints, I will be grateful. I will probably have no idea what you’re talking about But reading your answer, learning stuff to make sense of it, and then reading through OC code and wait for the blinding light to turn on is an immensely enjoyable experience… Thanks in advance if you choose to reply
I’m always shocked how Magento is hardly ever mentioned on these boards, I haven’t worked with a TON of php software, however it seems to be by far the best designed I have worked with. Many who come from an actual software engineering standpoint, to web, have a lot of respect for Magento since it shows a lot of things they had never seen done with PHP. Unfortunately, learning how to work with it is quite the task, it’s ~300 database tables and has a crazy file count/folder structure.
I have two problems with Magento:
They don’t care for you if you don’t have InnoDB. Shared Hosts don’t allow InnoDB. Tough luck.
It’s slow. I downloaded it and ran it on my local wamp, and it was SLOW. Wow. I mean if something Drupal can be built to be lightning fast and light enough to run on shared servers, Magento - a narrow, specific functionality app - has no excuse to be so slow. And oh yes, there is a solution - some groovy company that makes a plugin that makes Magento work faster! And we have to pay $$$ for that! Why?!
However, Magento is the most comprehensive PHP cart solution out there. It would be imperative to go through it and understand what’s going on… thanks for reminding me about it I think I’ll start today…