Welcome Guest, Not a member yet? Register   Sign In
codeigniter and global state
#1

[eluser]Unknown[/eluser]
As you know CI is wired around the super object, which is exposed to every aspect of your code, either using get_instance() in procedural or $this if you're inside a class.
The super object is a global state to your code, and as any programmers know, global state is bad. It shut your chance to unit test your class, and software without testing is prone to being buggy. You have no chance except testing with your browser and your eye.

and the special $this variable which is in every other framework and language is treated as a reference to self object, treated differently in CI by using it as a global registry. isn't that misleading ? and promote against proper Object Oriented Programming ?

is global state bad ?
is CI wired around global state ?
if so, is there anyway to prevent introducing global state to your code ?
if not, why are you all still code in CI ?




Theme © iAndrew 2016 - Forum software by © MyBB