Home > Programming Languages > On Choosing a Programming Language

On Choosing a Programming Language

People often ask me, “What language should I learn? PHP, Perl, ASP, Python, Java, C, C++, Objective C?” It seems like what they’re really asking is, “What is the ‘best’ language?” And the answer is that there is no “best.”

The most common reason for choosing one language over another is that a client, customer, or environment may demand one or a selection from a small set of languages. That makes the choice easy. But what if there are no such restrictions imposed? If you really have free choice, how do you choose one language over all the others?

Different languages have different strengths and weaknesses. They’ve usually been designed for a particular purpose, or to replace another language or set of tools that became cumbersome or inefficient after years of use.

For example, the C language was designed in the early 1970s as a general purpose language for writing operating systems and systems-level tools. Before C, most of this work was done in assembly language. In 1972, Dennis Ritchie was working on new operating systems at Bell Labs and needed a language that could be easily ported to different architectures and operating systems. Existing languages were either too big or not flexible enough. So, he created C (named after its predecessor, B). Because C is small, powerful, and portable, it remains remarkably popular after 40 years of use.

By the mid 1980s, a lot of systems administration tools were being created using a combination of shell scripts and other tools such as awk, sed, and grep. In 1987, an engineer named Larry Wall decided that there was a need for a more cohesive and robust tool for this purpose, so he created Perl. Since then, Perl has grown and evolved, and remains a viable language for scripting and even for mid-sized web application projects.

Today there are hundreds of languages available, dozens of which have a large enough footprint to be considered for any given project. So, given the chance, how do you choose?

Criteria for Choosing a Computer Language

First, what is your application? You will need a different kind of language for writing a desktop application, such as a word processor or a web browser, than if you are building system administration utilities, such as a whois client or configuration manager, or building web tools, such as a content management system or a database maintenance backend.

Desktop applications tend to be resource-intensive and use a lot of operating system features, such as graphics, widgets, dialog boxes, etc. These applications often require the use of a software development kit (SDK) that matches your operating system, so you will likely need to use a language that’s compatible with that SDK. For Microsoft Windows, that could be C++, or for Mac OS X it could be Objective C. Sometimes you can get around that limitation and use a different language, but it’s usually a lot more convenient to use the language that matches the SDK.

For web applications, a scripting language is usually called for. The dynamic nature of the scripting languages (Perl, PHP, Python) works well for web applications. Web servers tend to be dynamic creatures and a language that can easily move from one environment to another can be a real advantage. Also, these applications tend to get updated frequently, so the short development cycle of a scripting language that doesn’t require a separate compilation step helps a lot.

Sysadmin tools, like web applications, can also benefit from the more dynamic interpreted languages. Perl and Python were designed specifically for this purpose. Python’s superior object model makes it an ideal choice for larger sysadmin and web projects, while Perl’s long legacy and large installed base makes it a great choice for projects that require a larger programming staff or ready availability of skilled developers.

So, What Language Should You Learn Next?

Why can’t I just answer your question and tell you what language to learn?

If you’d like to learn Perl or Python, you’re in luck! I’ve just finished my Perl 5 Essential Training course on lynda.com, and I’m working on a similar Python 3 course to be released later this year. So I’m happy to recommend those languages. But I would never recommend them for systems work.

If you want to become a well-rounded programmer, I will always recommend that you start as low-level as possible, which for most people is C. You will get a great introduction to how computers work and develop skills that will serve you well as you learn other languages later on.

Where you go from there depends on your goals. For applications coding, I suggest C++ or Objective C; for web or sysadmin work, I suggest Perl and Python (both, not either). Object-oriented (OO) programming is here to stay, so C++ and Objective C will serve you well for years to come, and Python’s OO model is superb. Perl is simply essential because so much existing code is written in it, and it’s a great language for smaller projects that don’t require a lot of indirection or OO patterns.

Please note my biases here: I’ve never been a fan of PHP or ASP. These languages exist for purposes that have little to do with their merits, and their design and implementation show this. The question asks for my opinions, and my recommendations necessarily reflect them. That said, I have worked in both PHP and ASP and will continue to do so when clients or development environments require those languages.

The bottom line: learn as many languages as you can and pay attention to their distinctions and commonalities. As you do so, you will necessarily develop an eye for patterns and paradigms that can be borrowed from one environment and shoe-horned into another, making you a more effective and more efficient programmer. You will also gain satisfaction from your growing mastery along the way.

—Bill Weinman, April 2010

About these ads
  1. 2 April 2010 at 5:28 am

    And you did not even get to some of the more interesting Languages: Ruby, Erlang, lisp/Scheme and Haskall.

    Haskall and Erlang are functional programming languages. Erlang is designed for concurrent programming. And may become more popular with all of the multi-core processors around.

    Ruby is a very elegant object oriented programming language. When it gets a better engine (which should be soon) it will become more popular I would hope.

    You can compare the popularity of languages used to create opensource programs here:
    https://www.ohloh.net/languages/compare

  2. 17 July 2010 at 6:25 am

    i was a student from computer science major.
    and i think programming language is like a style of fashion
    everyone choose style that they’re comfort in

  3. Johnny
    10 November 2010 at 8:54 pm

    Very good information especially about the programming language. Also great tutorials on xhtml and html at lynda.com. Thanks

  4. Kay
    18 November 2010 at 9:14 pm

    My interest is WordPress. I’d like to be able to customize WordPress sites. Do I start with C, then move to Java then PHP? Is C essential? I’ve never programmed.

    Thanks for your answers.

    • 21 November 2010 at 9:28 am

      WordPress is written in PHP. I don’t know much about it (other than running this blog) but I would assume that you would use PHP, HTML, and CSS to create wordpress sites.

      Is C essential? Not for just working in wordpress. If you want to be a well-rounded programmer, then you should definitely learn C.

      //Bill

  5. Kay
    21 November 2010 at 11:08 am

    Okay, thanks

  6. 25 November 2010 at 11:15 pm

    Cool post! It’s a shame you haven’t written this in more than one language for others to read!

  7. 7 August 2012 at 3:56 pm

    I tried to learn several languages but every time at some point I lost the plot and couldn’t go much further. I really want to learn perl and python for sysadmin work but I feel like I have something missing. I’m totally stuck at subroutines and couldn’t use them properly. I think I need a proper roadmap to learn.

  8. Burhan Raizada
    9 August 2012 at 1:04 am

    can you just tell that which language is best for working in linux? i’ve heard python. but as you told python is just a scripting language. so i got confused. should it be c++ or something? and BTW, can you tell that if i write code in objective-c, without using cocoa’s classes or libraries. **with my own classes and libraries. so, will it run on linuxbox or windows? if not so, then why?

    • 22 August 2012 at 10:38 am

      Of course it depends on what kind of work you are doing. Python is great for a lot of sysadmin work in Linux, but for more robust applications you would want to use C or C++.

      Yes, it is possible to use Objective C in non-apple environments, but it’s far from convenient. The GNUStep project offers a cross-platform library for Objective C: http://www.gnustep.org/

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: