CodeIgniter Forums

Full Version: Getting it right the first time.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]auximage[/eluser]
In your opinion, when defining models for a new project, do you find it best to get more granular or try to keep your models more 'grouped'?

Case in point; while designing a code re-write in a MVC framework I have a group of systems that I interact with. While all of these are part of a 'larger' overall system, the way I interface them is essentially the same (curl requests). Would you think breaking each system out into it's own separate model makes more sense, or would one overall model be best to deal with them?

This has been nagging me because I have no way to see what will come down the development pipe in the future, and don't know if it's worth it to have 3 small models, or one larger model.

What would you do?

El Forum

[eluser]nelson.wells[/eluser]
If I question whether I should break anything up or if I should leave it as one big something, I usually break it. The more experience you get, the more accurate you'll become at making that call, but as a rule of thumb smaller modules are easier to read/write/debug than larger ones.

El Forum

[eluser]stuffradio[/eluser]
I generally do one file per table, unless I'm doing something in a bigger picture. If I'm doing something with users, I'll stick all user related stuff in one file.

El Forum

[eluser]auximage[/eluser]
Thanks for those that viewed/commented. I decided to go ahead and break it out into individual models. Seeing how I won't know for sure what might eventually be needed for those individual systems, and that they themselves could get quiet large in the long run.

Now the question is really how to I pull elements out of those individual models that are similar across each and make them reuseable. I'm thinking some type of controlling model that will call the individual models when needed.

Thanks again!

El Forum

[eluser]Brandon Beasley[/eluser]
[quote author="stuffradio" date="1278757981"]I generally do one file per table, unless I'm doing something in a bigger picture. If I'm doing something with users, I'll stick all user related stuff in one file.[/quote]

Me too. I usually have a model for each table.

El Forum

[eluser]auximage[/eluser]
The fun part really though is that some of these aren't database tables at all but SOAP calls providing data back to my application.. o.O