Welcome Guest, Not a member yet? Register   Sign In
Sticking to CodeIgniter practices vs. making things easier for new developers to pick up
#3

[eluser]Rick Jolly[/eluser]
[quote author="charlieD" date="1188295538"]
For example, when adding a general function to deal with an array task, CodeIgniter's rules would say this would be added as a 'helper'. However, I personally would find it easier to follow if the function is wrapped in a 'Utils' class, e.g. $this->utils->doSomething(); rather than doSomething() makes it easier to follow and find the doSomething() method.
[/quote]

Since you probably don't need an instance of the Utils class you could call methods staticly: Utils::doSomething();. CI doesn't have any obvious way to create static classes. If you made a library CI would instantiate it. You could create a helper though, and instead of defining functions you could make it a class. That way CI wouldn't instantiate it and you could call methods statically: HelperClassName:ConfusedomeStaticMethod();.


Messages In This Thread
Sticking to CodeIgniter practices vs. making things easier for new developers to pick up - by El Forum - 08-28-2007, 12:23 AM



Theme © iAndrew 2016 - Forum software by © MyBB