5 ms·
Does PHP as a language have any qualities not found in other languages? Yep. 1. Everything's a template. This is a double-edged sword. 2. mod_php is stupid s
by thomasmallen 18y ago
Does PHP as a language have any qualities not found in other languages?
Yep.
1. Everything's a template. This is a double-edged sword.
2. mod_php is stupid simple. Makes deployment is a cinch.
I'll update this list if I think of others, but these two are a boon for new and impatient developers alike.
- nir 18y agoAlso, very good user-annotated documentation (I don't know if this is still so, but it was when I started PHP) and a lot of existing code/libraries/applications (of varying quality) that you can use. The value of PHP is not in the language itself, but in the fact it is easy to pick up and easy to deploy. This often causes people with strong coding background to dismiss PHP, but empirically it seems most people care a lot more about easy deployment than, say, closures or namespaces (or even consistent function naming).
- trezor 18y agoand a lot of existing code/libraries/applications (of varying quality) that you can use My question was what qualities PHP has on its own, as a language, which would merit keeping it around if the language were to be cleaned up and break compatibility with that existing code. easy to deploy I also wouldn't say ease of deployment in PHP is in any way unique or easier than deploying for instance perl or python. Heck, even super enterprisey Asp.net can do with the same simple deployment procedure as PHP has.
- nir 18y agoThat's the thing - the choice isn't between languages, but between tools. For example, having a lot of libraries is not strictly a language feature, but it does effect choosing one over the other. On its own, as a language, PHP doesn't have much going for it. You can clean up PHP and break compatibility, but then you've lost much of its value (and what you'd get wouldn't be better than Ruby or Python anyway). I'd bet most PHP users don't even know PHP, they just install Wordpress or Drupal to run their site and maybe modified some templates etc. As for deployment, it's easier because it's already there. Almost all hosting companies support it. Most (I think) Apache installs have it on (or easily activated) by default. This is the reason other languages don't have anything comparable (in popularity, not in features) to the above CMS.
- trezor 18y agoThat's the thing - the choice isn't between languages, but between tools. For example, having a lot of libraries is not strictly a language feature, but it does effect choosing one over the other. I'm not going to be stupid enough to deny this, but my argument was that PHP as a language doesn't offer anything unique, so if they were to actually clean it up and break all compatibility there would no incentive to move to this "new" cleansed PHP platform as opposed to existing, better languages and platforms. You are pretty much in agreement with my original statement.
- mechanical_fish 18y ago3. Before the designers grafted in objects, PHP was definitively not Java. It had one data structure, the array(). (I won't go so far as to call it a simple data structure, because its semantics are kind of nutty, but it's a lot simpler than the Java class system.) You can go very far in PHP without having to know what a class is. Now that every schooled developer has been exposed to Java ad nauseum we're all blind to the fact that OO is not at all intuitive. You've got to keep a bunch of abstract hierarchies in your head simultaneously. (Classes can inherit from other classes; objects are instances of classes; objects can contain other objects.) You've got to learn a bunch of odd semantics. (Constructors look like functions but are called by the new operator. Destructors never get explicitly called at all. There's static members and public members and private members.) Then you've got to know how to use objects properly or you'll just make a mess; that involves learning a moderate amount of OO theory or reading one of those doorstopper-sized patterns books. As every DailyWTF reader knows, even a lot of ostensibly-trained professional developers do not actually understand this. It's a lot to ask of a person who just wants to learn how to rearrange the widgets on their Wordpress blog. There are, of course, a few other languages that don't impose OO on people at time zero, so this is hardly a unique feature of PHP. But it is a feature. Or it was, anyway... PHP now has a tacked-on object system that is vaguely reminiscent of Java.
- thomasmallen 18y agoI agree, coding in PHP is far less enjoyable now that the language is, in my opinion, polluted with Java-esque object orientation. Most new code that I come across nowadays feels horribly overengineered. Objects are a good thing when used sparingly, but PHP never needed design patterns to be viable. Drupal is a perfect example of robust, modular software that doesn't need verbose object syntax.
- trezor 18y ago1. Everything's a template. Hardly unique. Microsoft's (now deprecated) ASP had this. ASP.Net can also be treated like this if this is desired, although most of the time it isn't. 2. mod_php is stupid simple. Makes deployment is a cinch. As I have mentioned in another reply, the easy of deploying PHP solutions is hardly unique. Out of my mind I can think of perl, python, asp and asp.net which offers similar ease. In fact it can be argued that PHP's problematic compatibility betweens, dependency on server-settings and other similar less predictable parameters when deploying on a random hosting service makes PHP deployments more problematic than those mentioned above. My experience with Asp.net would lead me to believe that Asp.net deployments are just as easy and can be done much more reliably without encountering deployment issues.
- ssharp 18y agoYou're forgetting the popularity of cheap shared hosting plans. PHP is offered on many hosting plans for $10 or less dollars a month and "just works" in that you upload a PHP file and it works with zero extra configuration. Most cheap hosts don't offer this low barrier to entry with Python, ASP, ASP.NET, RoR, etc.
- trezor 18y agoI'm fully aware of this, but that can hardly be accounted for as a feature of the language itself, which was what I was asking about.
- davidw 18y ago> Out of my mind I can think of perl, python, asp and asp.net which offers similar ease. Back in the day, Damon Courtney and I created mod_rivet ( http://tcl.apache.org/rivet/ http://tcl.apache.org/rivet/ ), which utilizes Tcl. It was very fast, because it cached the byte-compiled versions of scripts/pages in memory. It also let you do either template pages (.rvt) or pure Tcl files (.tcl), so you could construct things in a slightly nicer way than all templates all the time.
- thomasmallen 18y agoHardly unique. Microsoft's (now deprecated) ASP had this. ASP.Net can also be treated like this if this is desired, although most of the time it isn't. ASP is not supported, so throw that out. And every language with template engines built for it can be treated like this; that doesn't prove anything.