Help me pick a web dev language to learn.
May 29, 2008 2:31 PM   Subscribe

I am trying to decide which web language + framework to focus on for learning this summer. I am stuck between PHP, Python (with Django maybe) or Ruby (on Rails).

Basically, I am asking for people's input on all languages. They all have their ups and downs and I'm pretty sure I'll have to learn all of them at some point but I have start somewhere. Here is my initial perspective on all. Correct me, add relevant info and make suggestions.

PHP
+I actually have a passing knowledge of PHP. Not enough maybe to create something big but I have added small features, worked on cleaning other people's code
+It's very common.
-It somewhat seems unprofessional, probably because I feel like everyone and their mom has done something with it.

Ruby
+It's the new cool.
-It's the new cool.
+It seems very elegant and easy to learn, especially for developing something for the web with Rails.
+For some reason, the RoR community seems very friendly and I approve of their ideas a lot.

Python
+It's a lot more serious than Ruby, I feel like. It might be more useful for other things too as a standalone language
+Similar outlook on stuff with RoR community.
-Maybe not as big community for learning as it is with PHP and RoR. Not sure about this but others definitely have a lot of stuff.

Anyway, thanks a lot for reading along.

Also, if you would care to make a suggestion, I'd appreciate some books or websites to start things off with.
posted by the_dude to Computers & Internet (35 answers total) 17 users marked this as a favorite
 
I'm most comfortable with PHP (and would suggest Code Igniter as the best PHP framework), but the language has a number of problems and I'd suggest a beginner start off with Python.Python in a Nutshell is the book I'd start off with.
posted by null terminated at 2:47 PM on May 29, 2008


I found Python incredibly easy to learn - it was, after all, designed for programming education. I would personally recommend the free Dive Into Python for general Python learning. Django as well is very straightforward.. Python and Django both have welcoming communities, Python is commonly used in a wide variety of non-web contexts including system administration and desktop app development, python will be your friend forever, snakes are cool, google app engine SDK is out first for python, etc etc.

Like null terminated says, PHP has problems from a language design standpoint, but it can't be beat for ease of deployment and available sample code. There are some great PHP coders as well, but I've found the large amount of novices means there's plenty of bad advice to be found.

If you are on a Windows machine, the easiest to get going will be PHP, i suspect followed shortly by Django with Rails in last place.. Rails folks, enlighten me if I'm wrong - I haven't used Rails since 1.2 and that was on a mac.

(disclaimer: i write python code, most of it using the django framework, professionally)
posted by thedaniel at 2:58 PM on May 29, 2008 [2 favorites]


Ah, also Dive into Python is less useful if you don't already have experience programming in other languages.
posted by thedaniel at 3:01 PM on May 29, 2008


I hate PHP with a passion. I use it when I have to, but not happily. Rails is very pretty; it's not that far off from Django, so you could learn one and pick the other up fairly easily. I'm told that Rails is a bit tricky to set up on Windows (not sure why thedaniel thought that was relevant, but maybe I missed something in the question), but it's really easy on anything Unix-based. Python is almost certainly more useful for non-web stuff than Ruby, so that may influence your choices.
posted by spaceman_spiff at 3:03 PM on May 29, 2008


I wouldn't even consider PHP. Ruby has jumped the shark. Python is fun, easy and powerful and it's here to stay. Learn Python.
posted by caek at 3:10 PM on May 29, 2008


Response by poster: @spaceman_spiff

I don't do anything on Windows luckily. It's all Mac + Linux for me.
posted by the_dude at 3:10 PM on May 29, 2008


Response by poster: I probably should have included this;

I know a fair bit of Java and C. I'm not a great coder by any means but I have a good knowledge of usual algorithms and data structures.
posted by the_dude at 3:13 PM on May 29, 2008


PHP is a mature choice and there are certainly many frameworks to choose from there. Unfortunately most PHP code isn't very fun to look at and most PHP projects seem to head towards spaghetti, although I'm sure many people have figured out how to do this better.

Ruby and Python are much more well thought out languages, and if you want your programming knowledge to apply to more things, I would choose one of them. Note that both Ruby and Python are supported languages for Cocoa development on OS X for example, while PHP (and even Java) are not.

Python is my personal preference, and specifically Django is a very nice framework to use. Many things I found that I really wanted to do on the last website I helped create I found that Django already provided. Another thing to note is that Google App Engine only supports Python. As a budding web developer interested in "the new cool", you might be interested in working with that. It's somewhat based on Django I hear, although I've not had a chance to check it out.

The good news is there is probably no wrong choice for you. All three options have many fine tutorials, books, and screencasts.

That said, I encourage you to try Python. Django, Twisted, and the many, many libraries available make the language a joy and a very practical choice.
posted by metajack at 3:17 PM on May 29, 2008 [2 favorites]


In agreeance with everyone else who suggests abandoning PHP; I'm a Rails developer (and loving every moment of it), but the reality is that the correct tool is the one that makes you happiest. Spend a couple of days playing around with each and see which one grabs your fancy more. They're both perfectly viable options.
posted by cheaily at 3:17 PM on May 29, 2008


I recommend Django. Start by reading the book.
posted by signal at 3:29 PM on May 29, 2008


Python is becoming a very common utility language in much the way that Perl was seven years ago. However, Python web applications often (to me) have the feeling of a Mod_Perl CGI Application -- it feels like one of those carnival rides. You can actually detect all the jerks and slow parts. Building lots of small things seems to be Python's strength, building something that is large and accomplishes a lot seems to be very, very difficult from an engineering point of view.

Rails doesn't feel that way, but doing anything really useful with rails (oh, god, holy war here I come) and hoping for it to scale is apparently difficult. There have been several major flame-outs/wars within the developer community about various items and the framework seems to be losing focus.

PHP is becoming more and more usable as a utility command-line language. It's also managed to maintain a relative smoothness of execution as a web language through several major revisions while keeping backwards-compatibility intact. Computer science purists generally loathe it, but I've found that PHP skills are consistently useful and salable. Applications built with PHP are, even with horrible coding practices, continuously stable and scalable. PHP integrates well with all of the major brands of web servers including IIS (unlike Rails where you pretty much need to run it on a custom httpd server) and PHP is compatible with everything from Oracle to MS-SQL to MySQL/Postgres to BDB and mSQL.

I'm currently a big fan of the Zend Framework because unlike CodeIgniter and CakePHP, it's using the full power of the very recent editions of PHP's object oriented structure. It's a very elegant, scalable framework that gives you a lot of tools but doesn't force you into one way of doing something. (Of course, that power comes with a learning curve as a price...) It has a good community and Zend, the company sponsoring the development of ZF, is the owner of a lot of the intellectual property behind the PHP engine and community. Even though I also do some coding in Symfony, I don't recommend Symfony as a framework because the company sponsoring it (Sensio) has recently lost some key players, and really seems to be orienting Symfony towards their own needs as opposed to the needs of the community at large. There are some things the community needs (but Sensio doesn't) that either aren't getting integrated or are left in the dust as Sensio moves on.

Hopefully that gives you some guidance. I know Perl, Python, and PHP and end up using PHP the most. My perl these days is limited mostly to Nagios check scripts. I'm using Stackless Python as the data processing engine for one of my projects, but that's just a collection of small thread-spawning worker processes and a central controller. PHP is really the most *useful* long-term language to invest time in learning right now.
posted by SpecialK at 3:34 PM on May 29, 2008


I'd suggest Python because the new Google App Engine is all-Python all-the-time. Plus it's not that far off from Ruby in terms of support for functional programming and other dynamic stuff.
posted by GuyZero at 3:36 PM on May 29, 2008


PHP is unprofessional for more reasons than the fact that lots of low-skilled people use it. It's a language that grew from a simple template system in a gradual and nondirected fashion, and is riddled with ugly, theoretically questionable, hyper-pragmatic design choices. Even its designers tend to admit as much. On the other hand, if you want to work with CMSes, blogging systems and pretty much any other type of web software package except MVC frameworks, it's got by far the widest range of stuff available of the three you're asking about (for now).

So assuming we can rule out the hideous stepchild that is PHP, of the other two, I would also say Python/Django, because Python is considerably more popular as a general-purpose language (I'm assuming you may want to do something other than web programming in the future) and Django seems to be growing quickly and may match Rails in popularity soon. Ruby is a nicer language in many ways, though, so I'd encourage you to ultimately learn both.
posted by abcde at 3:40 PM on May 29, 2008


Best answer: What you really want to do in the future should dictate which language you choose.

You want a job? Learn ASP, JSP or PHP. Maybe Python. Rails is slightly useful in this arena since it's "the new fun thing", but it has already lost its luster in most areas. Reason being it doesn't scale for shit.

You want something scalable to large applications? ASP, PHP, JSP, Python.

You want to just be able to build fun, lightweight applications quickly? Fine - learn Rails.

There's plenty of PHP haters in here, but the reality of the situation is this: There are more practical applications of learning PHP than any of the other choices mentioned above. ASP and JSP cost money, which is one barrier that PHP does not have.

Most cool open source CMS and other tools are written in PHP. If you want to be able to start with a cool framework and modify it to your liking, PHP is the way to go. (Examples: Drupal, Joomla, Wordpress)

If you want Nerd-cred, go learn Python. It's awesome and has its benefits over PHP for sure.


The point of this disjoint insanity? The answer to your question lies in what you really want to use the language for.

My personal recommendation? If you're not exactly sure what you want to do, learn PHP. It opens the most possibilities for you.

Does PHP have reasons why it sucks? Yes. However, none of those reasons will affect someone who's still learning to code. The biggest reason people hate PHP is because they run into so much poorly written PHP code and just decide that the language sucks. Sorry folks - PHP is here to stay whether you like it or not.

Rails is a fad that has already practically passed.

Python is simply cool amongst programming snobs. Not that it doesn't have legitimate reason to be, but it won't get you many jobs.
posted by twiggy at 3:53 PM on May 29, 2008 [1 favorite]


PHP is crap in a lot of non-trivial ways, don't let that be your choice unless you line up a really sweet job with it or something.

Most people really love either Ruby or Python, but seldom both. I think you should give both a surface treatment and see which clicks for you. The Python Challenge is a lot of fun, and you can really solve it in any language, with the exception of a few puzzles. (It'll be clear which ones if you solve in Python first).

Ruby has a much less intellectually stimulating overview in the form of Try Ruby you could take for a spin. I find it much more satisfying than Python but it mostly comes down to different dressings of basically the same ideology.

Ruby and Python are growing together in a lot of ways, and although everyone seems to want to do their own bytecode implementation for the time being, eventually I believe they will compile to the same virtual processor instructions like .NET languages do, and at that point the only practical difference will be your own preference, so I wouldn't worry too much about which is "serious" or which is "web" vs. "desktop".
posted by moift at 3:54 PM on May 29, 2008


Django is fun, and I've built an application with it. But, ROR is very popular, and a lot of people use it so that the community is way bigger. I think that trying Ruby/ROR would be the best option for you...
posted by majikstreet at 4:05 PM on May 29, 2008


PHP has come a long way in the past few months, not to mention years. Some of the people saying it's crap and it's unprofessional need to revisit the language. And if you're still writing it the way you have for the past few years, you're about to very rapidly become a dinosaur as PHP6 comes out.

As for Google Apps being all Python, all the time -- Google Apps supposedly has a PHP version in the works. They just did it with Python first. Python is admittedly a good language, but to me it's better at "data processing" than it is at "web dev", and the OP asked for web dev.

To the OP: As you can see, there's a lot of dated information out here. Look around and THEN make your choice.
posted by SpecialK at 5:42 PM on May 29, 2008


This is probably not the answer you're wanting but ... for what it's worth, I wouldn't be so quick to count out Microsoft's ASP.NET. It is an awesome framework and you can certainly get started with the free Express versions of the tools. There is an enormous amount of good tutorials and documentation online. Choose either VB.NET or C# as your language. I'm a C# fan myself.

I've used PHP and have nothing against it. Once you learn the basics you should definitely use a framework. e.g, CakePHP.
posted by tetranz at 6:44 PM on May 29, 2008


If all you care about is web dev, then go with PHP. You can do more non-web-related with Python, but PHP will give you a better opportunity to br a consistently employed web developer.
posted by thisjax at 6:51 PM on May 29, 2008


Django has the advantage because the book is online for free and there are many good online resources for learning python. Of course, the Symfony PHP framework's book is online for free as well.
posted by PueExMachina at 6:59 PM on May 29, 2008


Seconding CodeIgniter for PHP. It's a framework similar to CakePHP or Ruby on Rails, which addresses some of the issues that people have mentioned.
posted by kirkaracha at 7:05 PM on May 29, 2008


The Zend Framework for PHP is quite nice, and since you already have experience in C-style languages, you'll find it easy to pick up.

Zend Framework has a powerful MVC system, powerful ORM tools, and many other features (Google data classes, classes for encapsulating web form logic and validation, support for various AJAX techniques, etc. The framework is fully modular, so you can use as much or as little as you need (compared to RoR where it's all RoR or nothing). Deployment is a snap. Upload your files to an apache web server with PHP 5.2 or higher installed, adjust your database connection parameters. Done.

PHP as a language has many, many warts. This can be off-putting and frustrating if you *heart* beautiful languages. However it has improved very much since version 5 was released and has now become widely available at various hosting providers.

If you have access to a Windows installation, Microsoft provides some "lite" versions of Visual Studio (called "express" editions or some such) for free (as in beer). These tools allow you to do 'real' development without the full features of a Visual Studio License (source control, installation packages, etc) I've used these tools in small projects myself with success (on my Mac in Parallels no less)

If you decide to take a look at ASP.Net, avoid VB.Net like the Black Death and use C#. (C# is effectively Microsoft Java - the syntax will be easy to learn)

Ruby On Rails simplifies certain aspects of development for you, but only if your project is working within a very narrow range of parameters. This article details that in friendly terms: http://alistapart.com/articles/gettingstartedwithrubyonrails

What would I tell you to do? Learn the basics of web dev with PHP...it's free and preinstalled on your Mac. Once you've played with some MVC and written a few items "from scratch" or sans framework, then look for a project and pick the technology you think is the most appropriate.
posted by device55 at 7:30 PM on May 29, 2008


Best answer: I'm a doofus. This link has the Rails "sweet spot":
http://alistapart.com/articles/creatingmoreusinglesseffortwithrubyonrails

The previous link is a "Hi welcome to rails" article.
posted by device55 at 7:33 PM on May 29, 2008


Response by poster: First of all, thanks to all for providing all these input.

If anyone is still reading this, here are a few details.

-I am interested in web development as a career but mostly in terms of usability and user experience. However, I also want to be comfortable with web development's back end too.
-As much as I appreciate .NET, I'm not really considering switching (yeah, sounds weird) to any sort of Microsoft environment anytime soon. Not really a personal choice either, the environments I'm working in will all be Linux for a while.
-I somewhat *heart* beautiful languages.

I'm currently leaning towards RoR and Python for now, I think. I'll work on stuff with Ruby for a while, I think.
posted by the_dude at 8:21 PM on May 29, 2008


"PHP is crap in a lot of non-trivial ways"

Missing the implicit "...that I'm not going to explain because then I'd have to defend the statement and I just read this on some Ruby forum somewhere and actually have no idea what I'm talking about."



PHP 5.0 is a huge step forward. Zend is excellent and elegant. Rails jumped the shark about the time that people realized they couldn't scale even the simplest applications worth a damn on it.

I do a lot of work in PHP but I've also really liked what I've seen with Python. If you like "beautiful" (whatever that means) take a look at Zend and, if it's not pretty enough, try python.

...or go learn perl.
posted by toomuchpete at 8:37 PM on May 29, 2008


Ruby has jumped the shark.

Care to elaborate, caek?
posted by lukemeister at 9:33 PM on May 29, 2008


Ruby on Rails is not only good for rapid development, but its formal adherence to the model-view-controller architecture will get you thinking a lot about an application's structure and keep you away from producing huge monolithic globs of code. That's something you can take with you, even if you end up working in another framework later. I think it's to web frameworks what Scheme is to traditional programming languages in that sense.
posted by ignignokt at 9:38 PM on May 29, 2008


Best answer: Missing the implicit "...that I'm not going to explain because then I'd have to defend the statement and I just read this on some Ruby forum somewhere and actually have no idea what I'm talking about."

I write PHP for a living, unfortunately:
  • The PHP community is terrible. Awful. Take a look at any PHP forum for evidence.
  • PHP 6 introduces namespaces, finally, but the main namespace is already polluted with multiple work-around prefix conventions that can't be changed without breaking backward compatibility.
  • Speaking of multiple conventions, it's impossible to surmise anything about method names when you're beginning because PHP accreted rather than being designed: nl2br, strtolower, cal_to_jd, wtf?
  • Bolted on OO: adding in Java Lite doesn't a proper OO language make. Internal functions generally don't use exceptions, they either raise errors you have to catch with a wonky workaround or they return an error code. Only a few of the more recent libraries provide an OO interface. It's just dressing, not an cohesive mechanic.
  • 1/4-assed OO would be fine if PHP at least supported functional programming, but no dice: create_function is a pain to use and isn't a real lambda function anyway. Writing higher-order functions in PHP is essentially wasted effort
  • PHP is lax with types to the point of absurdity: false == 0 and "false" == 0, but false != "false"
  • Most of PHP's development time seems to be devoted to extricating the language from the idiocies of past revisions (register globals and magic quotes down, variable variables and the mysql_* functions yet to go). The only real big change coming with PHP6 that's not a correction of an existing cock-up is real Unicode support. Thank God for that anyway. We'll see how much of the core really works with multibyte characters.
  • PHP hemorrages memory. They deprecated some useful functionality with references to slow the bleeding in PHP5.
  • PECL can't be trusted to provide decent, secure code like CPAN or Ruby Gems or Boost C++ or any other equivalent I've ever worked with.
If you can live with all that and the other myriad annoyances I (mercifully) can't recall at the moment, have at it.
posted by moift at 9:59 PM on May 29, 2008 [6 favorites]


Nothing moift mentions has any bearing on someone who is out to learn a language.

I doubt that the PHP6 namespace issue, writing higher-order functions, types, reported memory issues will have any bearing on what you are trying to achieve.

The backwards compatibility issue again is a furphy. Again the leaking memory. Some PHP builtins may leak memory, but again, is not something that will affect you in the slightest.

As a beginner programmer, CPAN or Boost C++ is really not the place to start, and is really just noise in the signal.

He is incorrect to state that the "The PHP community is terrible...." The PHP site itself has a lot of excellent resources. A good place to start.

PHP or Python for sure. I'd say PHP syntax is more common amongst programming languages, and better supported online.

Ruby is a cult.
posted by mattoxic at 10:57 PM on May 29, 2008


I learned Python and Django. PHP is awful and spaghetti-like, even with things like CakePHP. Ruby has perl-like syntax. Rails forces you to do lots of configuration once you step outside the small automagic features. Python made more sense to me and django is way better planned than Rails.
posted by beerbajay at 12:01 AM on May 30, 2008


With the danger of getting into chatfilter/sounding like a php evangelist, PHP syntax is ecma based, which means it is syntactically similar to java, c#, javascript, even c.

If you are finding PHP to be awful and spaghetti-like, perhaps revising the way in which one writes code is more the point. No matter the language, if code is spaghetti-like it's the code, not the language.

Java is a language that is well worth learning, though it will take some more learning time to get it on the web.

c# is also a nice language, but webform syntax pretty hideous and worth avoiding- though when properly done is passable.
posted by mattoxic at 1:35 AM on May 30, 2008


Nothing moift mentions has any bearing on someone who is out to learn a language.

I don't think that's necessarily true. Learning web programming in a language with all the problems of PHP allows a person to pick up a lot of bad and idiosyncratic habits. The way that PHP does OO, namespaces, and typing are going to be an issue from day one, and be detrimental in the long run especially when going on to other languages that handle these thing properly.

My vote's for Python.
posted by Who_Am_I at 6:15 AM on May 30, 2008


I think learning Rails first actually might be a good way to go, although I'm personally much more of a Python aficionado. I think you should have the long-term goal of learning all three, but with that in mind, RoR has a lot of excellent resources geared towards getting you started with learning the environment, and all the magical scaffolding stuff makes it really easy to play around with stuff, and I agree that it will give you a solid foundation in MVC design.

Once you feel comfortable with RoR, I might suggest trying out TurboGears / Pylons when you head over to Python-land; one of its features is that it's easy to mix and match different components (eg, templating engine or database ORM layer), as opposed to the Rails / Django approach where the framework gives you everything.

With regards to PHP, I agree entirely with moift's assessment above, but it's so omnipresent that it's still a very good language to know. I would definitely suggest starting with Python or Ruby before trying to pick up PHP, though. There may be good frameworks for PHP, but when you're learning the basics of MVC-based development you'll want to do it in a language that is more idiomatically suited to it (eg, object-oriented).
posted by whir at 11:10 AM on May 30, 2008


Response by poster: Well,

I think the discussion is going a bit out of hand but I just wanted to add a few final words.

-I'm not that inexperienced as a programmer that I'd necessarily pick bad habits. I have done a lot of work with Java, C and functional programming languages like SML (among others). The reason I was asking was I want to get in Web Dev. eventually and wanted some guidance in that direction.
-And that is why i kind of *heart* beautiful languages and PHP does not seem to make the cut for me, at least for now. It's omnipresent and there are a lot great things done with it but the others, at least, seem better for what they offer. But then I've learned a lot about things such as CodeIgniter and Zend Framework and I'm sure they'll be helpful in the end as well.
-I think I'm going to focus on Ruby on Rails since it seems the easiest way to go for now. Once I get comfortable with it, I'll start learning some Python, I guess.

Again, thanks to everyone. I've added this to my feed reader so I'll be able to follow the comments in the future.
posted by the_dude at 4:23 PM on May 30, 2008


I'm starting a company and I recently had to grapple with similar questions with how to move forward as a team. Here are my $.02

Ruby: Not a language that you're going to use in any other context than Rails. This is hot and will get you a job right now. You can build a site very quickly, and you will look like a master very soon. But if part of that job is scaling a site to anything larger than a small internal app, it can prove to be a major pain in the arse. Lots of the free functionality you get is poorly implemented, and the excess "magic" can prevent you from truly understanding some important principles. There's lots of internet chatter about Twitter's recent failings having to do with problems with RoR, but not sure how much of that is just chatter. I've heard mixed things about the community. I saw the founder of CDBaby at a conference, and he said he hired a core Rails developer (a guy who helped get RoR off the ground) for a RoR rewrite of the site. Despite te access to talent, CDBaby had to scrap their year-long rewrite project because of issues with Ruby not integrating well with pre-existing systems. If you want to do webapps exclusively, and you don't have to build anything that scales or integrates with other crap, feel free to go with this.

PHP: Incredibly mature. Well documented. Good community. But it's incredibly easy to write code that makes you want to jump of a cliff, i.e. a pain to read and maintain in the future. God help you if you land a job with someone else's PHP spaghetti. No one's going to think you're cool for being a PHP hacker, but it's still really useful.

Python: Completely disagree with the assessment of Python as not being good for employment prospects. Between several sexy tech positions in the SF Bay Area and my research position that paid my way though grad school, I can tell you that Python is great for finding jobs. I can tell you, it feels something like this. Django has some issues, esp with ORM. But I find myself using python for a whole bunch of tasks, not just web stuff. I'm going through _Python in a Nutshell_ and I'm finding out new things. Python, specifically Pylons ended up being the choice for my startup.
posted by k7lim at 11:14 PM on June 4, 2008


« Older Gameboy (original) games in Atlanta?   |   Mashing up government data Newer »
This thread is closed to new comments.