6 points · by mikeyur · 17y ago · 14 comments
"PHP is more scalable than Ruby and most languages"
//start old post Let me preface this with: I'm not trying to start a language war.
I have very little experience coding, but have learned enough (some may say 'caught') PHP to get by.
I want to take it a step further but I'm getting thrown in a thousand different directions. I want a language/framework that's fairly straightforward and somewhat scalable.
I am looking at Python/Django, but getting pulled towards Ruby/Rails by friends - and some people saying that PHP is more scalable than either Python or Ruby and I should be looking at the Cake or CodeIgniter frameworks.
Can someone push me in the right direction? I want to invest the time in a language but I'm not sure which to start with. //end old post
Take it from me: I've worked on a Java site with over 2 million monthly uniques. I built a Ruby on Rails app from the ground up that grew to over 15 million pageviews a day. I also helped build a PHP-backed api the handled a few million hits a month.
I'm sick and tired of the "X scales better than Y" debate. It's pointless.
In reality, the most a language or framework can provide is a slight head start in terms of absolute performance. The dominant factor will always be nature of the application.
In other words: database, database, database.
I can only confirm this, scaling app servers in virtually any language is trivial compared to scaling databases.
First the easy advice: If you have friends pulling you toward Ruby and Rails... learn Ruby and Rails. Momentum is a good thing. Comradeship is a good thing. Don't worry: If it turns out in two years that we'd all rather be using Python and/or Django, we can switch. It will still be there.
Now we begin to edge toward personal opinion: I'd avoid sticking with PHP. Not merely because PHP is often like a parody of a programming language, but because variety is the spice of life. Learn something different. Take a look at how other languages do things.
Now, if you really want to stay out of a language war, ignore anyone who goes on about the "scalability" of their chosen language. Most of those claims are just posturing, backed up with no relevant data. [1] If your PHP friends won't shut up about their language's unbeatable super speed, show them the first fifteen minutes or so of Yehuda Katz's Merbcamp keynote:
http://www.merbcamp.com/video/katz3.mp4
... and once they're done rending their garments and throwing things at the screen tell them to take some data and go argue with someone who cares. You've got better things to do.
---
[1] Why do most language scalability arguments have such dubious data to back them up? Because, as others have taken pains to point out, languages don't scale: application architectures scale. If your webapp is much more complex than "Hello, World" its efficiency will depends on a host of factors, of which the speed of any particular language construct is usually a tiny one.
Spend some time reading online rails and django documentation. Either one will be fine for you to learn.
My personal opinion is that Python is easier to learn for a beginner, but not by much. Ruby has http://hacketyhack.net/ which is a fun way to learn, and Python has http://www.diveintopython.org/ which is a tremendous (and free!) resource.
I say flip a coin and roll with it. They're both great languages and both frameworks are great for learning.
[Errr... The submission changed after my response was entered, sorry if it seems a bit off-topic.]
It is possible to write software in any language that scales poorly as well as to write software that scales very well.
Right now I'm working on a site that pulls in about 1/2 million uniques daily written in Java (chosen by the programmer before me), before that that same site was written in PHP.
Ruby, perl, PHP they're all just different hammers, a good programmer should be able to write scalable web applications with all of the above, but will find a matter of personal preference (or historical accidents) to make the decision.
In the beginning it is probably smarter to learn how to program in a language for which there is a market, not to focus so much on scalability issues because when just starting out getting paying work is probably more important.
Another issue when learning how to code is to learn how to write clean code, I know I'm showing my age here but you could do worse than to have a look at the source code to the GNU utils package, there is a ton of 'good' code in there that will help you to develop a legible style. That will come in handy in any language, scalable or not :)
Rather you should consider what platform you think you can get the most done in the shortest amount of time - having friends that use the same platform counts for a lot. Similarly, many people think (including myself,) that you can get more done faster using RoR or Django than you can PHP, particularly if your project has any complexity.
Basically I know enough PHP to get by and if it's possible to code some awesome, and scalable, apps in PHP then I might as well expand my knowledge of PHP instead of starting with something new and completely foreign.
Rails is like a rounded rectangle and PHP is like a ball of nails.
When I say that PHP is a ball of nails, basically, PHP is just this piece of shit that you just put together put all the parts together and you throw it against the wall and it fucking sticks.
Putting aside the comparison between a framework and a language (maybe he really meant Ruby rather than Rails, I don't know), These quotes really rung true to me as a person who has some experience with PHP and Ruby on Rails.
PHP is ugly, no one will really disagree with that. But when used in the domain is was designed for (websites) it gets the job done. It's a ball of nails that sticks to the wall. Until recently at least, Rails was a bit more hassle to deploy, PHP is ever present, even on super cheap shared hosting packages and more "plug and play" in deployment. The fact that PHP is so popular means there's a massive amount of pre-existing apps and help (of varying quality) only a Google search away. This is true for any language, I guess, but PHP more so than most.
But Ruby (like Python) is a bit more general purpose and compared to PHP just seems more thought through to me. More consistent. I've always felt that aside from any other factors, this possibly also has to do with the age of the languages and what time they "grew up" in. But in any case, I actually find it easier to conceptualise more in depth concepts when using Ruby and Rails. So Ruby - and by extension - Rails is more like a rounded rectangle, it feels nice with no sharp bits, somehow balanced and symmetrical in my mind. But I feel the initial learning curve of Ruby (and I assume Python) might be a little steeper than PHP. Maybe that's just because I had gotten more ambitious by the time I'd hit Ruby.
Hopefully my ramblings have helped you a little. But to more directly answer you, yes it is absolutely possible to code some awesome and scalable apps in PHP. Just look around, the Internet is full of them. But would you benefit from learning some Ruby or Python along side your existing PHP knowledge, the answer is again absolutely yes. I probably don't have to add it, but just to be clear, you can of course also code some awesome and scalable apps with Ruby or Python.
I don't think these choices are as "either or" as a novice might generally think. Many concepts are similar regardless of which language you use. Putting time into one language does not necessarily mean that time is wasted if you later choose to switch.
The only problem for a beginner is that you'd have a hell of a time finding any decent code to learn from. This can be a problem in any language to some degree, but PHP is the worst, followed shortly by Javascript.