Looking for an OO PHP mentor
Moderator: General Moderators
-
jeffrydell
- Forum Commoner
- Posts: 77
- Joined: Thu Jan 17, 2008 4:39 pm
- Location: Menasha, WI
Looking for an OO PHP mentor
I have a rather elaborate project which was developed using procedural scripts. It works fairly well, but I'm now at the point of needing to rewrite the application and realize that OO is essential to making it do everything that needs to be added.
In reading about OO Php (and trying code from time to time), I have had little success in figuring out how to design & implement the application.
If you would be willing to answer questions about designing an OO multi-step form processor and sometimes give feedback as I walk through the process of building the necessary classes, please PM me or send an e-mail to phpdn (at) cjrenterprises.biz
Thanks if you can help - I'll keep my requests to a minimum, but I DO need some guidance.
Jeff
In reading about OO Php (and trying code from time to time), I have had little success in figuring out how to design & implement the application.
If you would be willing to answer questions about designing an OO multi-step form processor and sometimes give feedback as I walk through the process of building the necessary classes, please PM me or send an e-mail to phpdn (at) cjrenterprises.biz
Thanks if you can help - I'll keep my requests to a minimum, but I DO need some guidance.
Jeff
Re: Looking for an OO PHP mentor
I think it's better if you posted questions about specific design problems here in the forum, you will get plenty of guidance for sure. Just try to focus on one problem at a time and be specific in what it is you are trying to achieve.
-
jeffrydell
- Forum Commoner
- Posts: 77
- Joined: Thu Jan 17, 2008 4:39 pm
- Location: Menasha, WI
Re: Looking for an OO PHP mentor
The first one is a pretty big question ... how to break the project down in to classes. Do you really think putting the whole (14 Form) project outline on the forum is a good idea?pytrin wrote:I think it's better if you posted questions about specific design problems here in the forum, you will get plenty of guidance for sure. Just try to focus on one problem at a time and be specific in what it is you are trying to achieve.
Re: Looking for an OO PHP mentor
Start with a general description of the project, your current design problem (for example, how to implement a multi-form with an OO design) and hopefully someone would give you good advice.
Thinking about how to properly and elaborately explain your problems to others is half way towards finding a solution (you will find things will become much clearer after you've written down your problem in a way others could understand it).
Thinking about how to properly and elaborately explain your problems to others is half way towards finding a solution (you will find things will become much clearer after you've written down your problem in a way others could understand it).
Last edited by Eran on Wed Dec 10, 2008 12:23 pm, edited 1 time in total.
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: Looking for an OO PHP mentor
No, just start describing the Domain and we can sort it out as a group.jeffrydell wrote:Do you really think putting the whole (14 Form) project outline on the forum is a good idea?
(#10850)
-
jeffrydell
- Forum Commoner
- Posts: 77
- Joined: Thu Jan 17, 2008 4:39 pm
- Location: Menasha, WI
Re: Looking for an OO PHP mentor
I'm looking on thoughts about how to break this project out in an OOP environment:
This project is a multi-page form which branches & loops based on the event being entered and the user's responses. It takes reservation information for events, stores the data in a MySQL Database, hands the user off to PayPal, Google Checkout, or an info screen with 'Pay by Mail' instructions, and (on demand) outputs the event reservation data to an XML file for the event secretary to download and use with one of three desktop applications that manage these events.
The web application is currently in use (all procedural scripts - went live in August '07) on about a dozen websites across North America by way of iframes on my clients' websites. This seemed to be the best way to implement the program when I developed it a year or so ago because it meant simply adding one line of code to the client site's template page. Recently I have been told that AJAX may be a better solution for getting this application on the clients' sites, but I don't know enough about AJAX to know how that will impact the club's "ease of implementation" or just how difficult it would be for me to put together version 2 of my application.
Here's the registration process:
Upon a call from a client site, we look up any 'open' events. If none are open, a 'no events available' screen is presented, if one or more events are available, a list of events is presented for the user to select which one they are entering.
Once an event is selected, a basic info page which gives a brief overview of the application is presented. I would like to also present a link on this page so first time users can watch a more detailed tutorial of the application (where to find help, what icons mean, etc.).
Next Step: Owner Information is collected (Name, Addy, Phone, E-mail)
Next Step: Consent to a 'Hold Harmless' Agreement is required. (Check box after the event-specific Agreement is presented). The check is required for the application to proceed (electronic signatur), Date/Time stamp and IP address are captured at this point.
Next is a loop which can be repeated:
First: Get the registration number of an event participant.
Then: Look up that number in the database. (If a matching record is found, grab related info for default values of the next form, if not - no default values.)
Add / Edit form for participant info (Name, height, age, etc.)
Next: Event participation info is requested from the next form (what the participant wants to do, how skilled they are at that activity, etc.)
Finally: A confirmation page is presented at this point - showing Owner, Participant, and Activity info as it has been entered. A link is provided next to each area so the user can go back and edit info if necessary. If the user hits submit, then a list of participants entered up to this point is presented and they are given the option of entering another participant in this event (go back to the top of this loop) - or go on to payment (taking them out of the loop / on to the next step).
Next Step: The charges for the entries in this event are calculated and presented for review (possible discounts, etc. are available in a worksheet format) Once the user clicks on Continue, line items for an invoice are generated.
Next Step: The invoice is displayed for review and the user is presented with the option to pay online or pay by mail.
Next Step: Upon selection of payment method, all info is inserted in the db and the user is handed off to the payment processing provider OR presented with info on how to pay by mail.
In reading about OOP form generation with php, I have come across ZervWizard and think this my be a good 'base class', but don't know if that's the best "Controller" class for this application. Anyone have thoughts on ZervWizard, what to do with this, or how to 'break it down' for OOP development?
This project is a multi-page form which branches & loops based on the event being entered and the user's responses. It takes reservation information for events, stores the data in a MySQL Database, hands the user off to PayPal, Google Checkout, or an info screen with 'Pay by Mail' instructions, and (on demand) outputs the event reservation data to an XML file for the event secretary to download and use with one of three desktop applications that manage these events.
The web application is currently in use (all procedural scripts - went live in August '07) on about a dozen websites across North America by way of iframes on my clients' websites. This seemed to be the best way to implement the program when I developed it a year or so ago because it meant simply adding one line of code to the client site's template page. Recently I have been told that AJAX may be a better solution for getting this application on the clients' sites, but I don't know enough about AJAX to know how that will impact the club's "ease of implementation" or just how difficult it would be for me to put together version 2 of my application.
Here's the registration process:
Upon a call from a client site, we look up any 'open' events. If none are open, a 'no events available' screen is presented, if one or more events are available, a list of events is presented for the user to select which one they are entering.
Once an event is selected, a basic info page which gives a brief overview of the application is presented. I would like to also present a link on this page so first time users can watch a more detailed tutorial of the application (where to find help, what icons mean, etc.).
Next Step: Owner Information is collected (Name, Addy, Phone, E-mail)
Next Step: Consent to a 'Hold Harmless' Agreement is required. (Check box after the event-specific Agreement is presented). The check is required for the application to proceed (electronic signatur), Date/Time stamp and IP address are captured at this point.
Next is a loop which can be repeated:
First: Get the registration number of an event participant.
Then: Look up that number in the database. (If a matching record is found, grab related info for default values of the next form, if not - no default values.)
Add / Edit form for participant info (Name, height, age, etc.)
Next: Event participation info is requested from the next form (what the participant wants to do, how skilled they are at that activity, etc.)
Finally: A confirmation page is presented at this point - showing Owner, Participant, and Activity info as it has been entered. A link is provided next to each area so the user can go back and edit info if necessary. If the user hits submit, then a list of participants entered up to this point is presented and they are given the option of entering another participant in this event (go back to the top of this loop) - or go on to payment (taking them out of the loop / on to the next step).
Next Step: The charges for the entries in this event are calculated and presented for review (possible discounts, etc. are available in a worksheet format) Once the user clicks on Continue, line items for an invoice are generated.
Next Step: The invoice is displayed for review and the user is presented with the option to pay online or pay by mail.
Next Step: Upon selection of payment method, all info is inserted in the db and the user is handed off to the payment processing provider OR presented with info on how to pay by mail.
In reading about OOP form generation with php, I have come across ZervWizard and think this my be a good 'base class', but don't know if that's the best "Controller" class for this application. Anyone have thoughts on ZervWizard, what to do with this, or how to 'break it down' for OOP development?
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: Looking for an OO PHP mentor
Conceptually in the Domain you have Events and Reservations -- so you will want to model those. It seems like Orders are beyond the last page. This kind of thing is usually handled with what is called an Application Controller. There is a classic article around the web somewhere called "Objects versus the Web" or something like that by Knight & Dai, which might help you understand the intricacies. The general ideas is that you have a Controller that controls Controllers (so controlling the program flow of things that control program flow). Usually you use an object stored in the session to hold the state and provide rules to determine when they are allowed to the next step.
(#10850)
-
jeffrydell
- Forum Commoner
- Posts: 77
- Joined: Thu Jan 17, 2008 4:39 pm
- Location: Menasha, WI
Re: Looking for an OO PHP mentor
Yeah, this is why I was hoping for someone who could work with me one-to-one, a little more at my level. My eyes are glazed over and I feel like a deer in the headlights.arborint wrote:Conceptually in the Domain you have Events and Reservations -- so you will want to model those. It seems like Orders are beyond the last page. This kind of thing is usually handled with what is called an Application Controller. There is a classic article around the web somewhere called "Objects versus the Web" or something like that by Knight & Dai, which might help you understand the intricacies. The general ideas is that you have a Controller that controls Controllers (so controlling the program flow of things that control program flow). Usually you use an object stored in the session to hold the state and provide rules to determine when they are allowed to the next step.
Thanks for your insight "arborint". I'm sure this is very helpful to those who have a lot more training than me.
I'll try to sort through the reply and figure out what I need to learn so that I can understand what I need to learn so I can figure out what you have told me. Then I'll research the actual content to understand what you're trying to tell me.
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: Looking for an OO PHP mentor
Which parts are confusing? Start with the first sentence. "Domain" is design jargon for the specific problem that you are solving. In your case it is Events and Reservations. The more you talked about it the more we would know about the Domain. For example, there might be Venues or Speakers that would be part of Events. Once you understand the things in your Domain, then you start to identify specifics about each thing. For example, a Event has a start and end date, perhaps a start and end time. Events may all have different schedules or the same or that information does not need to be known by this system. Likewise a Reservation needs to know what type it is (if there are several types) and all the information about the person (plus billing information if different), and of course what Event it is a reservation for. Start answering these question and what is called a Domain Model starts for form.jeffrydell wrote:I'll try to sort through the reply and figure out what I need to learn so that I can understand what I need to learn so I can figure out what you have told me. Then I'll research the actual content to understand what you're trying to tell me.
(#10850)
Re: Looking for an OO PHP mentor
It would help if you stated what you tried and learned thus far. Are you familiar with design patterns? what about separation of concerns? and the common pattern to solve it in web applications - Model-View-Controller (MVC)?
-
jeffrydell
- Forum Commoner
- Posts: 77
- Joined: Thu Jan 17, 2008 4:39 pm
- Location: Menasha, WI
Re: Looking for an OO PHP mentor
I have tried nothing other than to mess around with extending ZervWizard because I don't have a clear picture of how to go about this. I HAVE read about MVC and have some grasp of what that's about. But ultimately, the problem appears (to me) to be more in APPLYING the princples than in debating them. I have outlined what I want to do above. We can talk theory and concepts I guess, but quite honestly that's not moving this thing forward at all. After a year of reading and asking general questions I'm kind of getting anxious to start putting the next version of this thing in to existence.pytrin wrote:It would help if you stated what you tried and learned thus far. Are you familiar with design patterns? what about separation of concerns? and the common pattern to solve it in web applications - Model-View-Controller (MVC)?
Re: Looking for an OO PHP mentor
Before you can apply them you need to understand them. Arborint gave you some directions to start at, but you didn't seem to really connect to what he was saying and so I think you need to clarify some concepts first. Once those are clear to you we can help you apply them to your current project.the problem appears (to me) to be more in APPLYING the princples than in debating them
-
jeffrydell
- Forum Commoner
- Posts: 77
- Joined: Thu Jan 17, 2008 4:39 pm
- Location: Menasha, WI
Re: Looking for an OO PHP mentor
As I see it - Arborint is saying I need an MVC structure. I see ZervWizard handling the "Controller" duties, but it's not really effective as a Model class because the steps need to be defined on instantiation which does not provide well for conditional branching and makes it flat out impossible to call a loop on the fly. ZervWizard is flat out lame regarding any control of the View, so a new class for that task would also be needed.
My thought on how to do this is to have a class EXTENDING ZervWizard for each of the following:
Event
Owner (which could include the Hold Harmless Agreement)
Participant
Activities
Payment
My "Model" Class would call each of these classes listed above in order based on the state of each class (including whether to loop Participant / Activities or proceed to Payment). When each class above is instantiated, they would determine the appropriate ZervWizard "Steps" for that class. This type of conditional instantiation is necessary so we can determine where to branch & where to loop and how many steps in the class are necessary based on the event info established at the top of the process.
When it comes time to present a form on screen, I was originally considering a "ViewFinder" class which would examine the event info and instructions from the Model as to 'where we are' in the process. The recommendation I recently received, however, was to consider coding the View as an AJAX project. I'm not sure if that would add a lot of development time to the project as this has been 'lingering' for quite a while. Perhaps I develop this all as php-driven code for now and revise the View class later to utilize AJAX.
Is this more what y'all want to see from me - or am I still not making a strong enough case for help?
My thought on how to do this is to have a class EXTENDING ZervWizard for each of the following:
Event
Owner (which could include the Hold Harmless Agreement)
Participant
Activities
Payment
My "Model" Class would call each of these classes listed above in order based on the state of each class (including whether to loop Participant / Activities or proceed to Payment). When each class above is instantiated, they would determine the appropriate ZervWizard "Steps" for that class. This type of conditional instantiation is necessary so we can determine where to branch & where to loop and how many steps in the class are necessary based on the event info established at the top of the process.
When it comes time to present a form on screen, I was originally considering a "ViewFinder" class which would examine the event info and instructions from the Model as to 'where we are' in the process. The recommendation I recently received, however, was to consider coding the View as an AJAX project. I'm not sure if that would add a lot of development time to the project as this has been 'lingering' for quite a while. Perhaps I develop this all as php-driven code for now and revise the View class later to utilize AJAX.
Is this more what y'all want to see from me - or am I still not making a strong enough case for help?
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: Looking for an OO PHP mentor
Perhaps you should find someone who has experience with ZervWizard to help you. No, you don't need to use MVC. I obviously would highly recommend that you separate your Presentation from you Domain Data/Logic/Rules, but whether you want to separate the View code is up to you.jeffrydell wrote:As I see it - Arborint is saying I need an MVC structure. I see ZervWizard handling the "Controller" duties, but it's not really effective as a Model class because the steps need to be defined on instantiation which does not provide well for conditional branching and makes it flat out impossible to call a loop on the fly. ZervWizard is flat out lame regarding any control of the View, so a new class for that task would also be needed.
I don't think you want to extend ZervWizard to create the Models. You will load an use Model classes in each step that ZervWizard controlls -- I recall they are methods. Models are objects in a lower layer than you "regular PHP application code" are contain the methods to load and save data, know the state of a thing, and hopefully to high-order operations like "Is Reservation Approved" type things.jeffrydell wrote:My thought on how to do this is to have a class EXTENDING ZervWizard for each of the following:
Event
Owner (which could include the Hold Harmless Agreement)
Participant
Activities
Payment
My "Model" Class would call each of these classes listed above in order based on the state of each class (including whether to loop Participant / Activities or proceed to Payment). When each class above is instantiated, they would determine the appropriate ZervWizard "Steps" for that class. This type of conditional instantiation is necessary so we can determine where to branch & where to loop and how many steps in the class are necessary based on the event info established at the top of the process.
It should not matter much whether you request via full posts or Ajax. It will only change what is being sent -- not the structure of the app. (not sure what a ViewFinder is except part of a camerajeffrydell wrote:When it comes time to present a form on screen, I was originally considering a "ViewFinder" class which would examine the event info and instructions from the Model as to 'where we are' in the process. The recommendation I recently received, however, was to consider coding the View as an AJAX project. I'm not sure if that would add a lot of development time to the project as this has been 'lingering' for quite a while. Perhaps I develop this all as php-driven code for now and revise the View class later to utilize AJAX.
jeffrydell wrote:Is this more what y'all want to see from me - or am I still not making a strong enough case for help?
(#10850)
-
jeffrydell
- Forum Commoner
- Posts: 77
- Joined: Thu Jan 17, 2008 4:39 pm
- Location: Menasha, WI
Re: Looking for an OO PHP mentor
Thanks for the feedback regarding ZervWizard. I guess I wasn't clear enough, however, as to why I posted my outline regarding that class. The post with the detail of the classes for each 'task' was put up to let you know what I was thinking of doing - not to dictate that I felt this HAD to be the way it was going to be done. Certainly other thoughts on how to approach this would be appreciated!
ZervWizard is not mandatory for this project - it's just 'the best that I could come up with'.
Are there any other decent development tools that might be helpful in putting this together? Is there a better class to facilitate this? Any IDE's that wouldn't take a year to learn before producing some fruitful results?
I'm very open to new ideas (that's why I was looking for guidance). I simply need the input to be actionable - rather than bogging me down further in the theoretical as the clock is ticking.
Thanks for whatever you have to offer!
ZervWizard is not mandatory for this project - it's just 'the best that I could come up with'.
Are there any other decent development tools that might be helpful in putting this together? Is there a better class to facilitate this? Any IDE's that wouldn't take a year to learn before producing some fruitful results?
I'm very open to new ideas (that's why I was looking for guidance). I simply need the input to be actionable - rather than bogging me down further in the theoretical as the clock is ticking.
Thanks for whatever you have to offer!