Welcome Guest, Not a member yet? Register   Sign In
why we used Model
#2

[eluser]KeyStroke[/eluser]
Sure it would work, because using Models isn't required in CodeIgniter. Models are used to represent your data structure and deal with the database directly. I prefer to use them because it makes my code more manageable and re-usable.

Right now I can think of 2 big benefits for using Models:

1. Increased re-usability: you can use your models in different applications with minimal modifications. If your queries were in the Controller, you would either re-write them in your new application or have a hard time copying them.

2. In case you change your database, change your tables' structures or do anything else that requires modifying your queries, you would only modify it them in one place (the Model), and the change will be reflected in all controllers that use it.


Therefore, I highly recommend using Models, even if CodeIgniter doesn't require them.


Messages In This Thread
why we used Model - by El Forum - 04-21-2008, 02:44 AM
why we used Model - by El Forum - 04-21-2008, 03:07 AM
why we used Model - by El Forum - 04-21-2008, 03:12 AM
why we used Model - by El Forum - 04-21-2008, 03:16 AM
why we used Model - by El Forum - 04-21-2008, 03:20 AM



Theme © iAndrew 2016 - Forum software by © MyBB