Welcome Guest, Not a member yet? Register   Sign In
Don't Repeat Yourself in CI doesn't exist
#1

[eluser]gh0st[/eluser]
CodeIgniter is advertised as one of the many frameworks out there that works best with the "so-called" DRY principle.

I call it "so-called" because it doesn't exist, well not in my experience of using CI.

I've noticed not only am I repeating myself, but I'm repeating myself just as much as I was BEFORE I worked with MVC.

For example, no CRUD library is installed for CI so you end up writing controllers to add/edit/delete for every table, so you are essentially repeating yourself for every table you want to append a CRUD capacity to.

Any time you want to check whether the user is logged in, has the right priveleges, etc you enter in a if statement (probably at the constructor level at every constructor you want it in), but every time you copy/paste this code in you are repeating yourself.

In controllers you load the libraries custom to each controller to save on load time, etc -- but this again is repetition.

In some controllers they'll be pagination, but not likely in all controllers -- but any time you put it in you're repeating yourself.

---

Another issue I'm frustrated with is this concept that because I'm using CI I no longer have to worry about changing fields everywhere to make an application work.

But its still the same, I don't see anything NEW or different.

Lets say you want to list all cars, so you have a model to pull out all cars and feed this into an array, which is looped and presented in a view.

But lets say you change, or add a field in the database -- you have to add this field in every controller, every method, every view where you want/require it.

For example;
Code:
foreach ($query->result as $row):
print $row->car_name;
// any new fields have to be added to this loop, and everywhere else too where the change is require.
endforeach;

Where is the DRY in this?

Where is this fancy concept of not changing fields everywhere? It doesn't exist!

---

Finally, I always get this feeling that there is meant to be a correct way of doing MVC, DRY, etc, etc -- but I never see any code or examples of how to do it, nor does CI come automatically bundled with libraries which are meant to make it easier.

For example, if HMVC is so good, why isn't it bundled automatically? If ORM libraries/plugins are meant to be so good, why aren't they bundled automatically?

If the concept is to make development easier -- why do I have to keep going round in circles to get CI the way that its been advertised to work?


Messages In This Thread
Don't Repeat Yourself in CI doesn't exist - by El Forum - 02-24-2009, 01:46 AM
Don't Repeat Yourself in CI doesn't exist - by El Forum - 02-24-2009, 02:05 AM
Don't Repeat Yourself in CI doesn't exist - by El Forum - 02-24-2009, 02:46 AM
Don't Repeat Yourself in CI doesn't exist - by El Forum - 02-24-2009, 02:54 AM
Don't Repeat Yourself in CI doesn't exist - by El Forum - 02-24-2009, 03:11 AM
Don't Repeat Yourself in CI doesn't exist - by El Forum - 02-24-2009, 03:35 AM
Don't Repeat Yourself in CI doesn't exist - by El Forum - 02-24-2009, 05:29 AM
Don't Repeat Yourself in CI doesn't exist - by El Forum - 02-24-2009, 05:45 AM
Don't Repeat Yourself in CI doesn't exist - by El Forum - 02-24-2009, 06:52 AM
Don't Repeat Yourself in CI doesn't exist - by El Forum - 02-24-2009, 07:01 AM
Don't Repeat Yourself in CI doesn't exist - by El Forum - 02-24-2009, 07:30 AM
Don't Repeat Yourself in CI doesn't exist - by El Forum - 02-24-2009, 07:41 AM
Don't Repeat Yourself in CI doesn't exist - by El Forum - 02-24-2009, 09:29 AM
Don't Repeat Yourself in CI doesn't exist - by El Forum - 02-25-2009, 07:16 AM
Don't Repeat Yourself in CI doesn't exist - by El Forum - 02-25-2009, 07:50 AM
Don't Repeat Yourself in CI doesn't exist - by El Forum - 03-26-2009, 03:18 AM



Theme © iAndrew 2016 - Forum software by © MyBB