3 ms·
PHP's biggest problem is the people who demand OO features out of a procedural language. If you want classes, namespaces, anonymous functions, etc. use a diffe
by dsl 16y ago
PHP's biggest problem is the people who demand OO features out of a procedural language.
If you want classes, namespaces, anonymous functions, etc. use a different fucking language. Don't bitch when the feature you want is a shoehorned in piece of crap.
Stop polluting an otherwise useful language.
- rokhayakebe 16y agoHow do classes, anonymous functions and functions in PHP differ from those in _insert_your_language_of_choice?
- Udo 16y agoI love those features in PHP, especially OO and anonymous functions as a way to organize my code, make it more readable and maintainable. However, I'm not using them strictly in a conceptually pure way. OO was meant to lead to massive inheritance schemes, and PHP is just not a suitable environment for that paradigm. The reason why most PHP devs don't go off on massive Java-like inheritance sprees is PHP's execution model. It's strictly request-based. For every request, PHP code creates an environment to service it, and then everything gets discarded. This is one of the strengths of PHP, actually, it makes PHP apps stateless in many respects. However, this also means that it is unwise to build computationally wasteful structures like extensive OO schemes - at least for performance-conscious production environments. Contrast this to Java or ASP.NET apps, for example, where the cost of initializing massive OO frameworks is offset by the fact that they stay intact across requests. So I believe OO features are very good and important for PHP, as long as developers keep the computational cost in mind. Also, closures are awesome.
- ChuckMcM 16y agoI certainly agree with the sentiment that forces are pulling PHP where it isn't comfortable being. "You don't hammer in nails with the handle of a screwdriver." was something my Dad used to say and I thought it was pretty stupid, until I thought of it as a metaphor for all the times my 'pain' was that I had the wrong tool in my hand and was too blind to see that. People are trying to PHP in ways it can't easily go, and yet that is the requirement the user's have, thus PHP is by definition the wrong tool. Tools which do not serve a purpose as well as other tools don't get used. A language, system, or tool which nobody uses is 'dead'. QED.
- rokhayakebe 16y agoCan you give a simple example for this PHP is by definition the wrong tool ? Maybe a common problem being solved in php which should be done in another language.
- ChuckMcM 16y agoThe first part was the context, "People are trying to [take] PHP in ways it can't easily go ..." Tools make hard jobs doable, the right tool for the job can make a difficult job trivially easy. The definition of the 'right' tool can then be expressed as 'doesn't cause you pain' and the inverse works as well, if your tool is causing you pain then it is not the right tool for what you're trying to accomplish. Probably an example of tm;du (too meta; didn't understand) :-)
- voidr 16y ago"There are only two kinds of languages: the ones people complain about and the ones nobody uses." Bjarne troustrup