Dear programmers of the information super space highway web,
I need your guidance.
I've been trying now for a long time to wrap my head around OOP. I see its advantages. I've read many, many tutorials and watched an equal amount of videos on the subject. I get the animal/cat/dog examples, I get the car/drive examples. What I'm struggling with is how to apply these concepts in a real-world application. So, I've set out to build one using OOP.
I am not asking for help with syntax or writing specific code — I can find that myself in documentation and by searching forums etc.. What I really need is some guidance, and a push in the right direction every now and then. Are there any seasoned programmers willing to mentor me?
As my learning project I would like to build a simple classifieds "web app". Something similar to Craigslist but way watered down in terms of scope. I would like to use PHP5 and MySQL, because I am familiar with them.
Let's say there are only these 2 use cases:
- Posting something for sale
- Browsing/searching for something to buy
What "things" should be objects? I can imagine that each item could be an object, but at what point? And why?
So for example, the user fills out the "post item for sale" form, should that form get turned into an object which gets passed to another object which inserts the values into a database?
What about when another user is browsing and requests to see all items of category C? Does it make sense that whenever the app has to connect to its database it creates a database object and then gets a bunch of item objects and displays them on the page? …writing this out certainly makes me realize how clueless I still am about OOP. Please help me fix that.
If in your opinion this is not a good project to start wading into OOP with, please feel free to suggest another idea!
Thank you.