which programming language is best to learn?

Yesterday on Twitter, @Sara_Mooney asked:

If you had to pick one of the following to learn, which would it be & why? Perl, PHP, Java, JSP, Python, or Ruby?

I’ve dabbled in perl, PHP, and Python, but that plus a 140-character limit makes for an unsatisfactory answer, so I asked my software-engineer, has-coded-in-40-languages husband, Grant Gould, for a better one. (You may remember him from the Notes from a Techie Patron guest post series.) So, Sara, here’s your better answer:


Selecting a language to learn depends, foremost, on three things:

  1. The set of tasks you are contemplating — do you want to build a website, a desktop or phone application, toys, useful work, …
  2. The resources available to you — your own prior experience, knowledgeable peers, classes, etc.
  3. Your temperament — Where do you fall on the continuum from doing abstract, mathematical thinking for fun to hands-on try-it-and-see-if-it-explodes?

With that in mind, let me briefly consider each language on the list:

  • Perl — I’ll say it outright: perl is a terrible language for newcomers. While there is a great deal of dispute as to perl’s general suitability as a swiss-army-knife language for experienced developers, very few people still argue that beginners should go anywhere near it. PRO: Can do anything; CON: Not for beginners.
  • php — php is a really convenient language for writing dynamic web content. If you already know HTML and just want to write relatively simple database-backed web applications, php is a fine choice. The language itself is reasonably clear and ergonomic and integrates directly into HTML, which can be very convenient. PRO: Convenient for small (3-10 page) web applications, lots of good online tutorials; CON: Only really useful for writing web pages. Becomes unwieldy for large sites.
  • Python and Ruby — These languages are really very, very similar. Both are real, general-purpose programming languages created with clarity and ease of learning in mind. Each has a framework for writing web applications (django and Rails respectively).
    • Python is slightly more “mathy”. It is also an older and more mature language with somewhat more tutorials and online lessons. Django is designed around relatively hard-core developers and high-performance websites, and can be intimidating to learn. PRO: A sound introduction to programming fundamentals; unparalleled online resources; CON: No easy way to write simple web applications.
    • Ruby is slightly more “pretty”. It is newer and has a bit of a reputation as a hippy language. Many people consider Rails the quickest way to learn how to build a database-backed website. PRO: Ruby-on-Rails is the quickest zero-to-website tool out there; CON: A little younger and (IMO) less elegant than python; fewer and lower-quality online resources.
  • Java is a very powerful language from the tradition of the “systems programming” languages (C and C++, for instance). It is well-suited to enormous projects and can be quickly learned by experienced engineers. But its galloping complexity makes it a tough language for beginners. Java is probably your best choice only if you (1) have access to a real class with feedback and graded projects, and (2) intend to develop something big and long-lasting. PRO: Almost unmatched for large-scale, long-term development; A solid foundation for hard-core engineering; CON: Big, complex, hard to learn.
  • JSP is an attempt to put a php-like syntax on top of Java. Opinions differ widely. Generally php will be a better choice unless you need high performance or need to integrate with some unusual components like a custom data source of some sort. PRO: Lets you hang with the Java people, whose parties probably have better catering; CON: lipstick on a pig.
  • Javascript is a scripting language for writing dynamic web pages. Most things that can be done with Javascript can be done with server-side languages, but only Javascript will deliver the sort of seamless speed and interactivity that people love these days. However most websites with Javascript also have much larger chunks of back-end server code written in some other language — the javascript is the icing, not the cake. PRO: You’ll probably eventually want to learn it anyway; CON: Widely hated. Involves you in horrible microsoft-apple-mozilla standards flamewars.

In summary:

  • If you are a hands-on person and want to write a tiny little dynamic website quickly, use PHP.
  • If you want to write a less tiny but still small dynamic website, use Ruby.
  • If you are an abstract thinker and want to learn how to program, use Python.
  • Only learn Java, JSP, or Javascript if your circumstances make them appealing for other reasons.
  • Give perl a miss. Even among professionals few people are more than lukewarm about it.

By the way (and back to my own words here, not Grant’s): I am both highly mathematical in my thinking and totally inclined to build something and see if it explodes. (I find perl self-indulgently unreadable, PHP workmanlike and useful, and Python lovely.)

Anyone have anything to add to this from a library-tech perspective?

Advertisements