4 ms·
1. Opened http://docs.phalconphp.com/en/latest/reference/tutorial.html http://docs.phalconphp.com/en/latest/reference/tutorial.html 2. Saw lots and lots of sta
by nikic 14y ago
1. Opened http://docs.phalconphp.com/en/latest/reference/tutorial.html http://docs.phalconphp.com/en/latest/reference/tutorial.html
2. Saw lots and lots of static method calls
3. Closed page again.
This way of judging frameworks has never failed me.
- kyriakos 14y agohow's having a lot of static calls making it a bad framework?
- eckyptang 14y agoI think that might be because people who are used to writing typical object-oriented code somehow assume that an instantiation is required before you can do /anything/. There is nothing wrong with a static call under a lot of conditions (not stateful, no override requirements etc). The same people also tend not to complain about C paradoxically.
- kyriakos 14y agoSome things are just static by nature. There's no point instantiating to use their html helpers for example.
- nnq 14y ago...because you can use functions and namespaces instead? (no, it doesn't make it "bad", but it's a hint that somewhere behind it there might be some overarchitectured OO monster - I admit, it's just because I'm not that much of a fun of OOP and I don't want more objects and classes than it's strictly necessary for the "backbone" of a MVC application)
- pytrin 14y ago* You can't extend a static method call - ie, it will always refer to a specific class, you can't replace it with another without changing a lot of calls. * Lots of static calls are indicative of function classes - classes as namespaces for functions, and not a real OOP approach There's nothing wrong with static calls per-se, but lots of them is a code smell in most cases.
- rmccue 14y ago> You can't extend a static method call You can as of PHP 5.3 with late static bindings. `static::function()` will use the inheritance chain to find `function`
- pytrin 14y agoThat's an inner method call, that's not the use case I was referring to. When you call a static function from a different class, you put the class name before the call, and make it different to substitute it - which you could easily if you were dealing with an instance. Example MyClass::func(); func() Is tied to MyClass. if you extend it, you will have to hunt down all of those calls and replace it
- encoderer 14y agoOne trouble with judging PHP like that is that the namespace features are so very new and almost universally loathed* that classes are/were the only widely-used form of namespace encapsulation. In a language like Python, it's not uncommon to be far more discriminating about what is a class and what is just implemented using functions. That design is lost on PHP really. *I disagree with the loathing. The backslash is a bit ugly but life goes on.