Little new functionality is implemented as new syntax; most of it is done with functions or things that look like functions. That's a problem? I think it's a problem if new functionality can't be implemented as part of a library. I think it's a problem if the best way of implementing new functionality is always to have new syntax.
There's surely some middle ground, here. PHP defines constants with a function, creates functions with a function, creates data structures with a thing that isn't actually a function but is inexplicably designed to sorta resemble a function. Only now are these basic value definitions getting dedicated syntax.
PHP: A fractal of bad design
251–260 of 514 posts
Re: PHP: A fractal of bad design
#252All those words, and yet the word template only appears once. And that's to assert that PHP has: …no template system. There’s PHP itself, but nothing that acts as a big interpolator rather than a program. As if that was a bug and not a feature. PHP succeeds because there is one PHP templating syntax and it is called "PHP" . PHP started life as a templating language, and that's where its soul lies. Which is important,…
Yeah, but what drives programmers nuts is that most of the problems in the language are totally independent of that ease of accessibility. Is there something about consistent naming, or consistent behavior of different library functions, or consistent syntax and operators -- they can be lenient and type-coercing, but consistent, like Javascript's -- that would make it a worse language for people to wade into in the f…
Re: PHP: A fractal of bad design
#253Re: PHP: A fractal of bad design
#254I work with PHP everyday, and it's a fine tool. It does what I ask of it, at least. If the objective is to drive a nail into a board, you can do it with a hammer or a rock, and it doesn't really matter which. Accomplishing the goal is what matters. If you can do it in the same time, why does it matter which tool you use? So one may be more elegant. So PHP is slow as balls.
Programming isn't a religion. We don't need to be so dogmatic.
Re: PHP: A fractal of bad design
#255All those words, and yet the word template only appears once. And that's to assert that PHP has: …no template system. There’s PHP itself, but nothing that acts as a big interpolator rather than a program. As if that was a bug and not a feature. PHP succeeds because there is one PHP templating syntax and it is called "PHP" . PHP started life as a templating language, and that's where its soul lies. Which is important,…
PHP is not a good tool for quickly getting a minimum viable product. Despite its flaws it is a good weapon for fighting 'the last war' - that is to say, it makes it quick and easy to make what are essentially the CGI pages of 1996 - but if you're doing anything more complex than that (for instance interacting in any way with a database), and I would suggest that even relatively non-technical people looking to use com…
Re: PHP: A fractal of bad design
#256Earlier quoted context omitted.
I agree, but lets say your car breaks down somewhere in the middle of the road. Now you have two options. One is to learn the entirety of automobile engineering before touching your car, second is to learn enough fix the problem for the moment. Needless to say any normal person will prefer the second approach. Now some mechanical engineer may make an argument that this small quick fixes are harmful for long term mech…
The effort required to learn something better than PHP is not equivalent to learning everything about automobile engineering, its more like reading a maintenance manual. Sooner or later, the guy who fixes his car in the middle of the road without knowing anything is going to replace his brake-pads with bits of wood he found on the sidewalk (Not really his fault, someone on a PHP forum has already labeled all the bits…
Re: PHP: A fractal of bad design
#257Earlier quoted context omitted.
With PHP, creating a new "app" is a matter of sticking a .php file in a directory. There is no config file, directory structure, or server to babysit, and nothing to restart after modifications. Instead of using a complicated templating system, you just include HTML inline. This is a horrible design for a large webapp, but even as an experienced programmer, sometimes I just want a quick hacky self-contained script, l…
"Sticking a php file in a directory" is just a matter of server config, not languages. There is no reason why you can't put a quick Python web app in a single file which exposes just one WSGI application object named 'application' - so if the server complied, you could indeed just stick the .py file in a certain magical directory.
Cause as a designer who programs (mainly php) that is the number one reason why I haven't been learning a new language.
They all require way too much. Php just works for my needs. If I get bigger needs then I am sure I will make the switch to another language.
Re: PHP: A fractal of bad design
#258Earlier quoted context omitted.
Why is PHP more likely than others to be vulnerable to SQL injection attacks? Most people (and likely All newbies) will be using PDO which automatically protects them.
It's only a protection if properly used. Bound parameters don't work well for some types of dynamic queries.
Also, if you've reached the point where PDO is too restrictive for what you want to do, you should be knowledgeable enough to write your own db class that incorporates sql injection protection (since all that largely consists of is escaping strings).
Re: PHP: A fractal of bad design
#259Earlier quoted context omitted.
Does warts-and-all PHP include that eval wart, or is it more like most-warts-and-a-subset-of-all PHP ? Not snarky, just curious if there was something I missed.
What is the problem with eval? Even Python lets you do that. There are legitimate uses for it.
eval does have one huge, honking problem though: it permits text to be interpreted as code. This is just asking for code injection attacks.
If you really need incremental/multi-stage evaluation, see MetaOCaml (http://www.metaocaml.org/) for the proper way to do it (without exposing yourself to injection vulnerabilities). It's a consequence of PHP's by-the-seat-of-your-pants approach to language design that the PHP devs settled for eval instead.
Re: PHP: A fractal of bad design
#260Earlier quoted context omitted.
"Sticking a php file in a directory" is just a matter of server config, not languages. There is no reason why you can't put a quick Python web app in a single file which exposes just one WSGI application object named 'application' - so if the server complied, you could indeed just stick the .py file in a certain magical directory.
Then why haven't anyone done it? Cause as a designer who programs (mainly php) that is the number one reason why I haven't been learning a new language. They all require way too much. Php just works for my needs. If I get bigger needs then I am sure I will make the switch to another language.
What? I understand for a beginner, but come on. If you're really a programmer programming for many hours aday... you really won't take the time to learn how to wire up wsgi to a python process? It's no harder than wiring Apache up to mod_php5 and telling it where to serve out of. It just takes a very modest effort on your part to learn it.
And then you get all the benefits of... not having to use PHP and getting to use... anything else.