For example, this specific problem is harder to create in stronger-typed languages, since you would need to explicitly cast from an integer to a string.
I'm not that interested in programming, so I think it's a great language. All those years back when first learning to use it, I remember going through a book and being so happy that it did practically everything itself.
I think this sums up everyone I've met who actually likes PHP. They like that they are able to get stuff done, and look no further. It is just frustrating to those of us who know that PHP is one of the most poorly designed (and I use that word loosely) languages ever to be successful.
If you can get over the local maximum of getting stuff done in PHP, the grass actually IS greener in Python and Ruby land.
That says more about the people you associate with then with the language.
The people I know care about programming, care about doing it well, care about elegant solutions, and care about a wonderful end product. What they don't care about are stupid language wars.
> the grass actually IS greener in Python and Ruby land.
I never got serious with Ruby, so I'll confess, I might be missing something. But, going by what I see in Destroy All Software's screencasts, I don't feel like I'm missing anything.
I can't help it, but ever since Rails came on the scene, I can't help but feel like the PHP people that make up the PHP community has dramatically improved. This, of course, is purely based on the people I've met.
> I've never seriously learned a second language, so I think it's a great language
Do the people you know have experience with other comparable* languages, and still think PHP is a well-designed language and platform?
I concede that the PHP community, and PHP itself, has dramatically improved in the last few years. PHP 5 is a revelation compared to PHP 4.
[*] i.e. not "The other language I know is C, and I love that PHP is so high level!"
For the most part, yeah. There are the obvious quibbles you get with any language, but for it's domain, it's the best bang for the buck. Does that mean it's the only language in our stack? No. But for my money, for the web side, it can't be beat. If I were to do a site in a non PHP language, it would be Python hands down. That being said, it all depends on what the project is, and what it entails.
Listen, I can't help but wonder if your imparting some past on the current crop of PHP developers (and by current, I mean those that moved to PHP5 some 8 years ago). Maybe you had experiences with another group of people that focus on just one language.
The PHP community of today is far from that. It's made up of practical people, who focus on more than just PHP. More to the point, calling someone a PHP developer these days just reflects that when they do the server side web code, they are using PHP. Not that it's their only language.
To be honest, my personal experience is that everyone I've met who pans PHP and proclaims to have switched happily to Rails (because that's what they switch to first, never Ruby), or Python is that they needed the extra structure these languages enforced. Basically, the PHP code they deride so much was code they helped write.
That, of course, is just my point of view. I don't know many people who use Ruby for web development, so it would be unfair for me to suggest the entire community was like that.
Is this the only thing upon which to base your opinion of a language? As someone who's seen at least a glimpse of the world beyond PHP, I'd concede that the design of the language, especially in earlier versions, is probably not its biggest selling point. But as you and I agreed below, PHP derives its value in other areas.
Maybe it's implicit in a question like "What's your most disliked programming language?" that those other areas should be excluded from consideration, but if that's not the case, then focusing solely on language design is a bit unfair to PHP.
Keep in mind, the design of the language wasn't to create a new language, but instead, make using various libraries easily usable in a web environment. Hence the reason for the multitude of c or c-like functions. Eventually, the shift moved in a different direction.
I like to think that while PHP wasn't intelligently designed, it did evolve. And for my money, evolution beats out intelligent design.
I was just thinking this same thing. My background is mostly in PHP, C#, and more recently JavaScript.
Each of these languages is completely different from each other, but I haven't gotten to point where I curse the fact that one program is written in one language versus the other.
Each language has it features and pitfalls, but as long as you can accomplish the task you've set out on, I'm not sure that it really matters.
For example, I absolutely love the ease of passing functions around in JavaScript, but you can also make a real stinkin' pile if you don't structure things right.
Having used JavaScript, I find myself thinking about using delegates and anonymous functions a lot more in C# than I did before because I've seen the benefit of them in JS.
You can't tell a good programmer by their choice in language but in how they leverage that language to make awesome software.
You can't program if you use a broken window as a measure of whether you use the language or not. I do not know of a language without issues, ugliness, or mistakes.
I see PHP as a language comparable to English. Both languages have a bunch of inconsistencies, peculiar idiosyncrasies, a humongous base of speakers/users, etc. In both languages, a lot of what people write is not of high quality, but writing high-quality stuff is certainly possible. If I had to choose one language for the world to speak, it probably wouldn't be English, and if I had to choose one programming language to be used in a given field (say, server-side web development), it probably wouldn't be PHP. But given the reality of the situation, PHP, like English, is an incredibly useful language, and PHP code, like English writing, can be of very high quality. I think this makes it a very valuable language.
What I don't think it is, is a well-designed one. It could have been all of those other things, AND a well-designed one, it just wasn't. I think it's a shame if a generation of web programmers come of age thinking that the warts of PHP are inherent to all programming languages. (I myself once felt that way about ColdFusion, since it was the first language I learned and everyone I worked with also only knew ColdFusion.)
And, actually, it's NOT necessarily a bad thing to have a language oriented around people who don't actually care that much about programming when it's also oriented around people who want to ship something useful to an end user (who might care if it's insecure but doesn't care if the code's pretty).
I've encountered a number of orgs now that have PHP on the front speaking XMLRPC or JSONRPC or whatever to a backend daemon (either Java or Perl in the cases I've seen) and since that means messiness on the front end shouldn't be able to violate business rules, it works out really well.
In the past, of course, PHP did have magic_quotes, which was a misguided attempt at mitigating SQL injections. This has since been removed, and there's been a big push in the direction of using prepared statements/parameterized queries through a library like PDO, which I think was introduced in PHP 5.
So was the (I believe now deprecated) mysql library they shipped and the tempting ease of string interpolation.
That sort of a market generally gets swarmed by low price developers very quickly.
For example, you can use include ( ) in so many ways, autoload classes, write getters/setters and override anything, implement views, etc. Everything "just runs", or can be compiled into fast code with HipHop (or cached with APC).
OK, to be fair, I would say that PHP with a framework that takes advantage of it can be very cool. I can't exactly share our codebase, but you can see the open source version from 2 years ago : http://phponpie.com to aprpeciate some of the "beauty" of PHP
And it can be extremely expressive and powerful. Sure, it can't do everything that Node.js can do, but for serving requests it can be awesome. It isolates every script in its own memory space, so you never have to worry about anything! The one thing I do not like about PHP is that it's married to the outdated thread-based webserver model, while the new boys on the block (NGinX, Node.js and the new Apache) all use event-based programming.
Don't downvote just because I said PHP can be cool. Look at our framework at least, before voting :)
On the other hand, all of my programming horror stories and terrible hacks have been written in PHP. I remember having to use an older version of PHP that failed to support closures when it was needed in some legacy code. The code was passing functions as arguments, but because the functions were not bound in the local scope, there were issues with namespace collisions. I had to resort to global variables for a situation that should not have needed it because rewriting everything properly required a non-trivial refactoring that I did not have the time to complete. Granted, this has been addressed in more recent versions of PHP, but there are always old versions floating around where "gotcha's" like this show up.
More recently, I ran into an issue porting PHP 5 code across different linux distributions where, for some strange reason, libraries on the include path failed to be found. Debugging something like that is ridiculously frustrating. Problems like this are bound to show up with any technology you use frequently, but my work involves using many languages and technologies and, of them, PHP is the only one that leads to these sorts of problems with such regularity.
"This language really sucks." -- paraphrased, intro to PHP on Facebook's internal Wiki
It's true that most software makes me either angry or sad, but PHP (where even "==" is wrong after Perl had gotten it right) was a singularly memorable peek into Special Hell.
I think they have to use that subset so it can be compiled by HipHop down to C code.
My two biggest gripes with PHP:
1) No standard package management system. I worked with some VERY smart developers at a PHP-only company, but nearly every part of their complex system was coded in-house, from the ORM up. Rubyists practically never code things that are available as well-tested gems, saving tons of effort, debugging, and training new people. That's a huge boost to Getting Things Done.
2) Little discoverability. If you can't remember the string method you want, you'll have to Google - and make sure you notice the order of the arguments. In Ruby, you can do `'foo'.methods.sort` and see all the methods available on strings. Since it's OO, you don't have to pass in the string itself, so there are fewer arguments to know in the first place.
To clarify, I have no feelings either way. I've had to learn so many languages over the years that I just see them as another tool in the toolbox. Life goes on.
Sure, he might not be able to hire 80 programmers in one batch, but I don't think Jane Street would need to do that, or that they are worried about a shortage of OCaml programmers. Also, I would be more confident of the capabilities of an OCaml programmer than of a PHP programmer.
I'd be willing to wager that there's hardly an OCaml programmer in this world who isn't also skilled in a few other languages.
What it means is, People who learn OCaml generally have to learn something else too. Because the jobs just aren't there. Which in case the person is better off learning that something else properly.
And that is a very big problem.
Developers can learn new languages if they need to.
Would you trust your product to the kind of developer you can easily hire?
If you are hiring, you are not hiring 10000 people, you are hiring one or two people.
If you can choose between a pool of 10000 developers in PHP and 100 in Haskell (whatever...) you will probably find more candidates you want to hire in the second pool.
And it is certainly more likely that you find the appropriate candidate if you don't have to wade though hundreds of applications.
I, for example, really love APL. I would also never think of using APL as the basis of a commercial project unless there was an overwhelming reason to do so.
A friend of mine built a nice company around a product built entirely around Forth. He loved the language. And, he lived to regret making that decision. He eventually paid gobs of money to have the entire code base re-written in C. A couple of years later he sold the business for several million. Potential buyers did not want to touch him with the Forth code base. Just a reality of business.
To clarify, the potential buyers were not interested in the Forth code base because they did not use Forth themselves. Acquiring a company whose products were based around Forth would mean adding a new layer of developers to their team and, effectively, byfurcating their efforts and skill sets. A code base written in C was a no-brainier for most interested parties. With C on the table the language was just a check-box item that did not require further discussion. With Forth the discussions stopped right there.
Again, nothing to do with the merits of the language and everything to do with business realities.
If the poll were "what is the most common back-end web development language" or "what language should a startup use in order to have the easiest time finding developers", you would have a legitimate gripe with those who chose, for instance, Prolog. However, that's not the case here.
+ know PHP
+ are experienced enough to deliver a working, maintainable application
are also fluent in at least one of ruby or python, both of which are much nicer languages in general and have strong web-dev presences.
The issue with hiring "people who know PHP" just because a whole lot of people know PHP is that issues with maintainability of whatever gets written tend to be much more of a pain than with similar projects in other high-level languages.
It's not, of course, that you can't write a ball of unmaintainable mud in any language -- you certainly can. PHP is lacking in areas that make fixing that less of a nightmare, and lacking in areas -- both in the language, and in the community for lack of a better term -- that make writing maintainable stuff in the first place easier. The devs who know how to create maintainable PHP codebases, or fix unmaintainable ones tend to have experience with other languages.
This should be, in my opinion, a pretty major concern for business. While it may not be apparent at first, there tends to be diminishing returns from maintenance and development of a product if it's a giant mess. Doing PHP on new projects for ease-of-hire is inviting that mess, due to a whole bunch of little things that tend to snowball. Skilled people won't want to work for you, people that will be skilled but lack experience will leave your employ, and eventually the project will grind to an iceberg pace and stress levels will get high for everyone.
A good dev will probably not have a problem picking up whatever language, as long as you're using "general-use" languages. In the web-dev world, this is currently mostly ruby and python. Choose haskell, and you'll probably have some (read great) difficulty finding people to hire. Choose ruby or python and you'll be more likely to attract the type of devs you want, and at the worst you'll get someone inexperienced who makes a mess that is easier to fix than it would be in a PHP codebase of similar messiness.
If it was just the merits of the language, I don't think I'd have much of a leg to stand on talking from a business end. It's not though, it's a whole lot of little negative things that can make a long-term project more likely to be a failure. The language, and the tools, and the community are getting better, but that's mostly due to the efforts of people who are skilled and experienced with a variety of things improving it because it's paying their bills. It's still far, far away from any other "popular" language in terms of tools, community, available libraries, and just about any other measurement you can make other than "number of people that can say they know it on a resume"
I'm not sure I follow this. If you take one of these good developers you are referring to, and write your codebase in PHP, what about PHP makes it difficult to maintain as compared to Python or Ruby?
If you take a developer who isn't as good, or isn't as experienced, and they create a ball of mud, it's easier to get it to a maintainable point by a good dev if it's written in a language other than PHP.
Some things about PHP that make it difficult to maintain over time are things like lack of consistency in abstraction, lack of first-class objects, extreme behavioral dependency on php.ini, incomplete reflection capabilities, and so on. These types of things are much bigger of a deal when trying to refactor a messy codebase as opposed to developing on a pretty clean one. They're getting better as time goes on, but the other popular web-dev languages are miles ahead, and it's extremely likely that a good dev capable of writing PHP code is familiar with one of them.
Go/Golang is indeed an amazing language -- my favorite, in fact, even beating out Python for my #1 spot. Go's creators guarantee its type safety; what hole do you speak of?
To hopefully assuage your concerns and to make an assumption about what you may worry is a hole in Go's type safety...
Empty interfaces allow one to contain _any_ value (such as a string) in an interface{}, but in order to use such a value, one must access the underlying type of the interface{} (i.e., the aforementioned string value). To do so, a type assertion is required, thereby preserving type safety... unless I'm missing something?
The hole occurs when I want to make a generic container like say a binary tree. I can create a node interface that satisfies my needs for a binary tree. What I can't do is guarantee that at compile time every element in my container is of the type that I expect. If they ever add generics of some sort this hole will be closed. It's a very tiny one and can usually be limited to a single functions scope but it still exists and certainly not enough to make me dismiss the languange out of hand. You can see examples of the hole by looking at Go's container/* packages. Some of them had a completely separate implementation for each of the primitive types. Type assertions ensure type safety at runtime provided the programmer does their job. But it depends on the programmer doing their job so it could be better.
Go and ML were two examples that come the closest to my "ideal" language. Go just happens to be one that I have the greatest chance of actually using in a job :-)
container/* is a bit of a corner case which is rarely used, specially since append() was added to the language and container/vector was deprecated I can't remember the last time I needed anything from container/*.
> Is that new? I don't remember it from my php days. Although I'll freely admit those days were a long long time ago so "new" for me may actually be pretty old.
So, what you are really saying is:
> I chose PHP because it's gathers everything I hate about any language in one spot when I last used it... which was a least 8 years ago.
2) The community. Surely there's a lot of garbage code floating around in the community, but are we going to judge a language by its community now? Perhaps the community is so big it produces a fair amount of garbage code appropriate to its size?
4) Ugly to look at. Perhaps, if you write ugly code. Again, this is about the programmer and not about the programming language. I think I write pretty code.
Disclaimer: I am a PHPer most of the time. But I realize that PHP is probably on its way out in the long run. And I agree with your two other points.
I chose ActionScript because it's a PITA to debug. Good programming languages make it easy to find your mistakes. PHP is good at that, as are a bunch of other languages.
The community is a huge part of judging a language. You'll note that I specifically said this appears to flow from the core developers out. A sentiment many in this thread appear to have shared. That to me is a danger sign. The community often is a signal regarding how the core devs of the language approach things.
As for beauty it's completely and purely subjective so what looks beautiful to one person can look ugly to another.
function myFunc(ObjectType $arg1, array $arg2) { ... }
And it'll throw errors if you try to pass an argument of the wrong type.If the language treats a string as a number in some cases without an error then that is most definitely not type safe.
Static type safety is desirable, dynamic type safety is almost essential. But they are both type safety.
Just because php is at one extreme end of the spectrum of my preferences for type safety doesn't mean that other things can't be closer but not quite on my end of the spectrum yet.
* It has everything including the kitchen sink but nothing in the decor matches. There is no unifying principle to help you grok the language
* The Community is all about quick hacky fixes to already broken code and this approach seems to flow from the core developers out.
* It's not type safe, not even at runtime. I don't know if I ever want to work in a language that doesn't have proper type safety as a guard rail. (Note I'm not talking about compile time vs runtime type safety I'm just talking about type safety period)
* The code is just plain ugly to look at and I used to be a pretty heavy perl coder so that's saying something.
I know some of these are pretty subjective but for me php just manages to hit every single one of my top programming language gripes.
If you want to know my favourite that's a much harder question to answer. Golang has been pleasing me lately although it's interfaces have a very tiny hole in the type safety.
ML and it's varying descendants have as close to my ideal type system as I've ever seen. But the chances I'll ever get to use it for a job are slim to none and it seems the community is a little too academic for my taste.
Lisp has the most awesome metaprogramming built in and I had a brief heady love affair with it until it's lack of good type safety brought me back to earth.
I suppose all this means I'm one day fated to write my own "ideal" programming language so it can be featured in a list like this :-)