Welcome Guest, Not a member yet? Register   Sign In
My Codeigniter Observations
#7

[eluser]Negligence[/eluser]
I don't use CI any longer, but at one time I did use it extensively for developing enterprise applications. As a note to your general MVC recommendations, I take issue with a few of your points. I write this because I want to ensure that new developers reading this take your suggestions into consideration, along with alternatives.

Quote:Your views are just that, views. Don't put any application logic in here at all. If you need to do anything in your view which is starting to look like php, check that this couldn't be better achieved by using a helper.

You can't get away from putting application logic/PHP code within a View, it's the nature of the beast. Helpers don't really change this, they only add to the complexity and the creation of generalized functions. Don't shy away from using code in a view, it is not a bad thing. Of course, if you're executing queries from a view, then we've got an issue.

Quote:Your controllers are the daddy of the application. They receive input from the client, sanitize and validate it, and then pass it onto the model. The data they receive back from the model should be wrapped as php objects which then get passed onto the view (see next point).

Two things:
- I use the Model to validate data, since a Model's sole purpose is to deal directly with data. The Model validates and returns the results back to the controller. But this is just how I do it.

- You're over-complicating things significantly by suggesting that you should return an array of objects, instead an array of records. Not only are you creating extra overhead that isn't required, but you are requiring an additional library just to use the model.

In fact, the Customer library you suggested is doing the job of the Model, so you've kind of invalidated the concept of a separation of duties.

It is a better approach to keep things stored in arrays for most people. All the advantages you claim to gain by using a wrapper, you could just as easily do within the Model, and you still only have to change it once. You're abstracting things to the point where you've gained nothing more than what you started with.

Otherwise, you've given some good advice here.


Messages In This Thread
My Codeigniter Observations - by El Forum - 01-21-2008, 05:30 AM
My Codeigniter Observations - by El Forum - 01-21-2008, 06:15 AM
My Codeigniter Observations - by El Forum - 01-21-2008, 06:46 AM
My Codeigniter Observations - by El Forum - 01-21-2008, 04:36 PM
My Codeigniter Observations - by El Forum - 01-22-2008, 04:04 AM
My Codeigniter Observations - by El Forum - 01-22-2008, 06:24 AM
My Codeigniter Observations - by El Forum - 01-22-2008, 07:29 AM
My Codeigniter Observations - by El Forum - 01-22-2008, 08:17 AM
My Codeigniter Observations - by El Forum - 01-22-2008, 09:04 AM
My Codeigniter Observations - by El Forum - 01-22-2008, 09:35 AM
My Codeigniter Observations - by El Forum - 01-22-2008, 10:01 AM
My Codeigniter Observations - by El Forum - 01-22-2008, 02:29 PM
My Codeigniter Observations - by El Forum - 01-22-2008, 02:59 PM
My Codeigniter Observations - by El Forum - 01-22-2008, 04:31 PM
My Codeigniter Observations - by El Forum - 01-23-2008, 12:00 PM
My Codeigniter Observations - by El Forum - 03-19-2009, 10:42 AM
My Codeigniter Observations - by El Forum - 07-13-2009, 07:19 AM
My Codeigniter Observations - by El Forum - 07-14-2009, 03:09 AM



Theme © iAndrew 2016 - Forum software by © MyBB