Welcome Guest, Not a member yet? Register   Sign In
MVC - Controller Questions
#6

[eluser]jleequeen[/eluser]
@Colin

I see what your saying. When I first started with CI objects were what I thought of. Unfortunately I had very little OO experience so it's taken some time to grasp the entire concept. Coming from a procedural page based approach background and never having used MVC has made for a tough introductory. But I do understand most of the concepts and I wouldn't be here if I didn't want to write better code. I'm sure once I have a couple of apps under my belt it will really help me hone in my skills.

Obviously for me, views are easy, models are easy, but the controllers have been the sticking point. It makes sense if you are designing by objects, to have everything in one controller. Maybe my problem with objects based design is I'm stuck on page based approaches and that has obviously made me design by a actions based approach.

Maybe part of my problem is deciding exactly where I get my objects from. I guess that is why some prefer to use there database to help them figure that out. Even that can be confusing for me though because a database does not always tell me about objects that I may need. As in an earlier post in another thread you mentioned what all a checkout method of a cart object might do. If you had no cart table in your database, say, you had a table named order and order_details, etc. How did you decide to create a "cart" object. Do you look at your app during planning and ask certain questions to come up with these domain objects. For instance, the app needs to have a way to login/logout. Then you ask yourself, who does those actions, and come up with a "user" object. That's an easy example and I can understand that. But what about say... you have several reports that will be generated by numerous tables in your database. Obviously there is no "reports" table. Would you decide that "Reports" should be it's own object and each report would be a method, or would you have some other methodology of deciding how to group those reports, or would they stand on there own? I'm guessing that you would create a reports object and make each method a report. Oh and one other thing I have a question in regards to. Say you are creating an application and you have come up with all the domain objects that will interact. Where would you put something simple, like...a public facing view like a homepage, or about us page. These obviously may not fit into a domain object, so do you go ahead and create a controller for each one and make them domain objects? Just curious, because most of the apps I build always have a public piece along with the backend stuff.

Damn, I've written much more than I anticipated. In conclusion I suppose it's coming up with those domain objects that I need to work on. Unfortunately, not everything fits the "object/action" way of thinking, or maybe it does, the challenge as you said is coming up with how to fit these things together in my world (app).

By the way, awesome screencast series you started on Advanced Form Handling. I look forward to the continuation of it.


Messages In This Thread
MVC - Controller Questions - by El Forum - 09-27-2008, 08:40 PM
MVC - Controller Questions - by El Forum - 09-27-2008, 09:11 PM
MVC - Controller Questions - by El Forum - 09-27-2008, 11:59 PM
MVC - Controller Questions - by El Forum - 10-03-2008, 04:22 PM
MVC - Controller Questions - by El Forum - 10-03-2008, 04:44 PM
MVC - Controller Questions - by El Forum - 10-04-2008, 01:47 PM
MVC - Controller Questions - by El Forum - 10-04-2008, 04:22 PM



Theme © iAndrew 2016 - Forum software by © MyBB