Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-08-2010, 12:41 AM   PM User | #1
robertfyffe
New Coder

 
Join Date: Oct 2010
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
robertfyffe is an unknown quantity at this point
OOP Project Structure

Hi everyone,

I have just started learning OOP and I am looking for some help/advice.

To help learn I am going to create an event booking system. I have the most of this working using standard PHP but since I am learning OOP thought it might be good to convert it.

Ok so to start, I am planning to create the 4 individual classes below:

Events (Event name, date, location)
EventTickets (Ticket type, price & qty)
EventBookings (booking name, email, telephone)
EventPayments (Card type, number and expiry date)

Q1. Should I create 4 classes like above or structure it different?
Q2. How should I set up Inheritance?
Q3. This might answer the above two questions but how would you start this project?

I am looking for any advice on creating this project. I will share my progress as I go along and hopefully help anyone else who is new to OOP.

Thanks in Advance
Robert

Last edited by robertfyffe; 10-08-2010 at 12:42 AM.. Reason: Spelling mistake
robertfyffe is offline   Reply With Quote
Old 10-08-2010, 04:14 AM   PM User | #2
_Aerospace_Eng_
Supreme Master coder!


 
_Aerospace_Eng_'s Avatar
 
Join Date: Dec 2004
Location: In a place far, far away...
Posts: 19,292
Thanks: 2
Thanked 1,044 Times in 1,020 Posts
_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light
What would each class do? I know you kind of told us but how much work would each class be doing? You could even just make one class and use the functions in there but it might be easier to understand with multiple classes. Whatever you do, make a backup of what you already have so if something breaks you can go back to what works. What are you going to do to manage your database? I would use OO for that as well. I think there is a decent mysql class in the Post a PHP Snippet subforum.
__________________
||||If you are getting paid to do a job, don't ask for help on it!||||
_Aerospace_Eng_ is offline   Reply With Quote
Old 10-08-2010, 09:52 AM   PM User | #3
robertfyffe
New Coder

 
Join Date: Oct 2010
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
robertfyffe is an unknown quantity at this point
Ok this is how I would like to work. User selects an event and then all the ticket types for that event will be listed along with price and quanitity available.

So they select a ticket by choosing a quantity on it and then click next which will bring them to a page to fill out there personnel details and payment details.

The booking part will work something like how this one works:

http://www.seetickets.com/Event/ERIC...-E-C-C-/501472

So I need to relate each column in a row to grab the information selected.

So I suppose the main components would be:

1. Grab selected ticket choice
2. Store in Database


As for the functions I thought:

Events (Process event chosen and return)
EventTickets (Process ticket type chosen and return)
EventBookings (Process bookings and store in MySQL)
EventPayments (Process Payment and store in MySQL. These will erased within a few hours once processed.)

Maybe this is to much. What do you think?

Thanks
Robert
robertfyffe is offline   Reply With Quote
Old 10-09-2010, 02:04 AM   PM User | #4
robertfyffe
New Coder

 
Join Date: Oct 2010
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
robertfyffe is an unknown quantity at this point
Any more advice for me?
robertfyffe is offline   Reply With Quote
Reply

Bookmarks

Tags
classes, oop, php, structure

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:31 AM.


Advertisement
Log in to turn off these ads.