CodeIgniter Forums
Why can't we use static objects? - Printable Version

+- CodeIgniter Forums (
+-- Forum: Development (
+--- Forum: CodeIgniter 3.x (
+--- Thread: Why can't we use static objects? (/showthread.php?tid=62346)

Pages: 1 2

RE: Why can't we use static objects? - twpmarketing - 07-06-2015

(07-06-2015, 05:34 AM)rakibtg Wrote: Why not? proper implementation cant be bad, where-areas many developer (beginners) are using very poor auth system and also many devs just stopped using CI.

Quote:namespaces are very desirable in CI 4.0, even if it mean CI becomes more complicated for the first-time user.

well, first-time user this days learn Laravel or Symphony or Yii :=D

I wrote a long reply (rant) to this and my system crashed before I could post it...
So, this is the short version, still a rant:

Three choices:
1) Third-party auth system(s) (my personal choice and the developers choice).
2) Basic auth system built-in to CI core or library.
3) Full feature auth system, again built-in to CI.

#2 has the problem of being too simple and giving the false impression of being sufficient.  First time developers find that it will not meet their needs and complain about it later.  Most of use have written these simple auth systems and, I assume, either re-wrote them or installed a third-party, full feature system because it saved time and money.

#3 is both bloat and is limiting on the features offered.  A case of "Do it the CI way or the highway".  I want choices, not one-size-fits-all.  

RE the three other frameworks you cite, yes, I use a couple of them, but come back to CI when I want to work faster and make a smaller footprint application.   Yes, there is a steeper learning curve for those other frameworks, and some (first-time coders?) are willing to spend that time and money.  CI is better, because you can choose the features (third-party or home-grown) to integrate. 
[shorter rant off]

Please don't take this personally, it is about the work we do to make a living.

RE: Why can't we use static objects? - rakibtg - 07-06-2015

Thanks skunkbad, kilishan, mwhitney, twpmarketing for the time :-)

I am using CI since 9 or 10 month and i am still learning while developing ready to go production sites also I had to use Laravel for some projects due to the project requirements so lots of confusions step up in my mind and i learned a lot from this thread.

Wish to see some greater moves in CI4

Thanks Smile

RE: Why can't we use static objects? - kenjis - 07-06-2015

(07-06-2015, 07:19 AM)kilishan Wrote: I know that you're going to say that Laravel, FuelPHP2 and others use that and they're modern. But they don't. They still have instantiated classes in the background. Instead, they have hijacked a standard PHP language feature because they liked the clean syntax, and wrote another layer of abstraction on top of the system, called Facades, to make this work. This specifically seems to have come from Laravel, which was mostly static in L3. He got a lot of grief over it, so rewrote it in L4 to keep the syntax and be more "proper". In reality, this adds additional performance loss, more mental overhead for developers, and confuses new developers who don't realize what's going on. But does keep a nice clean syntax. Smile

In case you're wondering - no, you shouldn't expect to see Facades in CI 4.

It is not good to say "Facades", because it is Laravel only term, and it is not GoF's "Facade pattern".
Some people say it is simply abuse. At least it is very confusing to people who don't know "Facade pattern".

FuelPHP2 does not call it Facades any more, and such static call proxy is in "legacy" package. See