Python, Ruby, or PHP? (My Take On Answering The Question)

A friend I know has been developing desktop applications with .NET for quite long time. He wanted to improve himself even more by going out of his comfort zone learning more stuff he’s not familiar with. So, he spent some time learning client side web technologies and wanted to add some “non” .NET server technologies to the mix. He emailed me asking for recommendations on what to learn,: “Ruby, Python, or PHP ?”.


After sending the answer, as with other previous emails, I thought maybe I’d share it with you here.


Let’s start with Python, since it’s the language I know least about (take that as a disclaimer against everything I claim about it next). Note that Python also has similar options to Ruby (maybe even earlier than Ruby had for some of them) even the MVC application frameworks (like django), but they aren’t booming as much as, say, Ruby..

Python’s real power is that it’s one of the old languages with great standard library doing networking and several pieces of functionality, in a way closer to C++ than it is to .NET or Java. I think also it’s runtime is historically has better performance and wider platform support than, Ruby.

I’d argue though that those benefits are usually less important in the web world, where you worry about web specific features (templates, personalization, AJAX support, etc…), than library features really, and only have a known set options for the platform hosting the web app/.


Here Ruby comes to play, with similarly old-enough-to-be-mature age, more web friendly (ex: white-spaces significance is optional), and generally getting a sense of dynamic features with C#/Java familiar syntax as "option" syntax style (rarely used). The ease of catching calls to non-existent members by one handler (method_missing or something) inspired a lot of nice syntax APIs.


The key attraction around Ruby world is not Rails. It’s actually Ruby gem, the "package manager" inspiration for NuGet and alike.This made sharing Ruby libraries and frameworks really easy, like other scripting languages, they allow you to extend the console features as well and add commands that perform repetitive tasks and code generations and so, which is an area .NET capability is still lacking much in.


Another killer thing about Ruby is the integrated eco-system. People would be using Git, github, Ruby, Ruby Gem, Rails, MongoDb, SASS (for CSS), CoffeeScript (for JavaScript), Heroku (cloud hosting),… and al of them have a specific workflow (or series or workflows) that make development much easier. This is also one main area in addition to console extensions that you’ll be blown away with.


Obviously, most people working with Ruby use Rails, the MVC framework for it, which has its own common workflows using specific options for ORM, mails, and other common tasks. It’s the opposite of .NET where we care about multiple options, they "do" have multiple options, but they care about the awesomeness of the experience with the option they choose rather than the ability to replace this option in the future. Quite another mindset shifting.


I’d suggest you don’t start with Rails. Start with Sinatra instead. Sinatra is like a basic web framework that just handles routes and templated views and few other things. People loved it for its simplicity and a lot of people build proof of concept and prototype startup ideas using it, especially when things don’t involve DB, or a lot of DB work. It’ll also introduce you to the way you depend on scripting a lot to perform various tasks in development.


Don’t get too deep into Sinatra, once you get to the point you think you understand its pieces well, move on to the next level, Rails (next in terms of number of features built-in, not in terms of better). Build something with it, usually people choose to create To-Do list or a Blog as those are the hello-world apps in web world, right? Try to discover which gems most Rails developers use most and really teach yourself to follow the workflow most tutorials and users will suggest. Expect a lot of "you are doing it wrong" times :)


A note on PHP: The reason PHP is still strong and won’t die any time soon is the amount of awesome web apps built with it over the years. WordPress, Drupal are the obvious names, but hey, the examples are uncountable. PHP has been trying to adopt to recent trends and copy features from other languages (like everybody else do), but I think it’s just causing it to lose it’s original power, which is being a simple lightweight language.

Modern PHP developers have created their own common workflows as well and those moved beyond going MySQL-PHP to REST and MVC framework and more, but the workflow for something like Ruby feels more "natural" rather than "addition" and hence makes more sense the more you apply it in your coding practices.


Another option you haven’t mentioned is NodeJS, or server-side JavaScript.A lot of people who do Ruby for long time mix bits of other languages in their workflows, like Scala and Clojure and others. So, being used to this, many Ruby guys actually turned to become NodeJS guys.

They copied the usual workflows pieces to their usage of Node, like git, and NPM (the Node equivalent of Gem or NuGet), and even equivalents of Sinatra (which is almost standard, called ExpressJS) and Rails (various options). Some mix it with CoffeeScript and DB tools (although JavaScript doesn’t have special features to create ORMs like Ruby method_missing and mixins), and it’s quite booming recently.


It’s also a good time to consider it since Windows support just recently became good enough to use (earlier it didn’t have NPM support for example, which is like Ruby without gem, pure key piece of the workflow missing and making the platform pretty much useless).


I think Node will bring you some of Ruby workflows via ExpressJS and brothers, and make you more fluent in JS (which is becoming THE universal language of the web), and blow your mind in the special way it handles creating the web app (although ExpressJS makes it more like just handling routes in ASP.NET MVC or Sinatra).


So, I’d go for long term spending on Ruby then Rails (going a b it of Sinatra), or do some plain Node stuff for a while and then start learning ExpressJS. Whatever you do, keep an eye on what’s usually called "workflow" in these areas, which is like "best practices" in our own terms. Whenever you do something and it feels harder than it should, it’s likely because you are not following another piece that makes it easier for other people who do both.

Share With Friends:

P.S. Please help me out by checking this offer, then look below for a small Thank You.

How did I learn that?

As a bonus for coming here, I'm giving away a free newsletter for web developers that you can sign up for from here.
It's not an anything-and-everything link list. It's thoughtfully collected picks of articles and tools, that focus on Angular 2, ASP.NET 5, and other fullstack developer goodies.

  • Python & Ruby appeared at the same time (early 1990s). Python was more popular in USA & Europe while Ruby was more popular in Japan, but Ruby became mainstream in 2006 because of Rails.

    Ruby is known by its killer toolkit: it started with Rails, but now you find Chef (automated deployment), Cucumber & RSpec (functional testing), Sinatra (micro web framework), Gems (automated installation of packages & dependency management). Learning these tools will help you learn these techniques because they are on the edge, and they are made by the pioneers of these techniques. Also these tools are popular among Linux developers because Ruby syntax is very similar to Perl & Shell scripts.

    On the other hand, Python tries to be a ‘readable’ language, to make maintenance & understanding easier. It’s really easy to look at a Python script & know what it’s doing even without knowledge of the language itself. Python has been used in more areas than Ruby, like scientific computing (SciPy), natural language processing (NLTK), network software (original bittorrent, twisted, tornado), Games (PyGame) and desktop applications (Tkinter, PyQt, wxPython, and many others).

    Ruby is more popular now because Ruby community are much better at marketing than Python community :). One part of it is the significant white-space in Python. This was one of the things which make Python readable, but for some reason it a lot of people hate this, though you end up writing the white-spaces anyway. I hated the white-space when I first learnt Python, but after I got over this it didn’t affect me at all.

    The choice between the two is depends on what you want to do. If only you want to learn it to increase your knowledge, then learn both: not just the languages but their ecosystem as well. If you want to learn it for desktop development, then learn Python. 

    From a theoretical point of view, PHP is not interesting at all, but it’s easy & allows you to get things done, and it has a lot of reusable web apps.

    Node.js became popular because of it’s performance & asynchronous programming, which means that it can be used in web applications handling a lot of requests. My suggestion here is to learn JavaScript itself better, both on the client & server, and go beyond jQuery.