3
For novice programmers, it is difficult to decide on which programming language to learn first, or which one to try out next? The choice is vast and the complexities many. The author analyses various programming languages, and suggests making a choice based on the programmers’ interests and current software trends. A s developers and engineers, our day-to-day work involves writing code and we use a particular language to express our solutions (whether it is adding features or fixing defects). When new languages come up, or there is a new release of a major language, we are eager to know more about them. A lot is happening in the world of programming languages and I avidly watch the changes in it. As a language aficionado, I have tried spotting major trends that are emerging in the programming languages space. Naturally, my views are biased in favour of languages like C, which is one of my favourites. Without much ado, here are the major trends I have found in the languages landscape: JavaScript is becoming the de facto platform for the Web. Java and .NET are becoming two major target platforms for a large number of languages. Dynamic languages are on the rise. Functional languages are becoming popular. Open source languages are on the rise. Old languages are reborn in new forms. C continues to be a dominant language. Let us discuss these trends in greater detail. And the question, “Which language should I learn next?” will be answered towards the end of the article. For U & Me Insight www.OpenSourceForU.com | OPEN SOURCE FOR YOU | JANUARY 2015 | 29

Which programming language should you learn next?

Embed Size (px)

Citation preview

Page 1: Which programming language should you learn next?

For novice programmers, it is difficult to decide on which programming language to learn first, or which one to try out next? The choice is vast and the complexities many. The author analyses various programming languages, and suggests making a choice based on the programmers’ interests and current software trends.

As developers and engineers, our day-to-day work involves writing code and we use a particular language to express our solutions (whether it is

adding features or fixing defects). When new languages come up, or there is a new release of a major language, we are eager to know more about them.

A lot is happening in the world of programming languages and I avidly watch the changes in it. As a language aficionado, I have tried spotting major trends that are emerging in the programming languages space. Naturally, my views are biased in favour of languages like C, which is one of my favourites.

Without much ado, here are the major trends I have found

in the languages landscape: � JavaScript is becoming the de facto platform for the Web. � Java and .NET are becoming two major target platforms

for a large number of languages. � Dynamic languages are on the rise. � Functional languages are becoming popular. � Open source languages are on the rise. � Old languages are reborn in new forms. � C continues to be a dominant language.

Let us discuss these trends in greater detail. And the question, “Which language should I learn next?” will be answered towards the end of the article.

For U & MeInsight

www.OpenSourceForU.com | OPEN SOURCE FOR YOU | JaNUaRY 2015 | 29

Page 2: Which programming language should you learn next?

the Windows platform. With Microsoft making the platform available for Linux and Mac OS, it can now be deployed in powerful Linux servers. And with Microsoft collaborating with Xamarin, .NET will be available for building mobile applications as well. With this development, the Java platform now has a serious competitor.

Dynamic languages are on the riseStatically typed languages have ruled the language world for many decades (e.g., Fortran, C, C++, etc) but dynamically typed languages are slowly and steadily becoming more popular (Python, Ruby, Objective-C, etc). Dynamically typed languages have their own appeal and advantages. The quicker edit-run-debug cycle helps to develop code faster. Historically, dynamically typed languages are mostly scripting languages. However, there is no doubt that these languages are suitable for developing general-purpose applications. Dynamically typed languages also support meta-programming features (e.g., introspection) more easily than statically typed languages. Such benefits of dynamic typing have resulted in even statically typed languages acquiring some form of dynamism. For example, C# 4.0 introduced the ‘dynamic’ keyword. Languages like Groovy were inspired by the productivity offered by dynamic languages like Python and Ruby. Note that static typing has its own benefits - for instance, finding type conversions-related defects early in the development cycle. For this reason, even Groovy supports optional static type checking and static compilation. Given all this, the underlying general trend is clear - dynamically typed languages are on the rise.

Functional languages are becoming popular From early languages like LISP to languages like Scheme and Haskell that appeared later, functional languages aren’t new to the programming language community. However, what is surprising is the growing popularity of functional languages in the last 10 years. The main reason for this is concurrency. Writing correct concurrent code in the presence of mutable state is incredibly hard using libraries or language features in object-oriented as well as procedural languages. Functional programs don’t change state. This characteristic makes the functional paradigm a suitable approach for writing concurrent programs. These days, even smartphones have multi-cores; so concurrency is here to say.

New functional languages like Clojure have attracted wide attention in the programming community. Clojure is used extensively in Big Data circles, and its code can be compiled to run in JVM, .NET, or JavaScript. Other mainstream languages like C++, Java and C# have adopted functional programming features (mainly ‘closures’/ ‘lambda functions’). Many new languages (e.g., Elm) are functional programming languages. These developments indicate a clear trend - functional programming languages are becoming popular.

JavaScript is becoming the de facto platform for the Web I remember a time in the late 90s when JavaScript developers wouldn’t be taken seriously. If you developed in C or C++ (or better, if you programmed in Assembler), you were considered a serious developer. But if you were developing in PHP or JavaScript, you were ignored! Times have changed with the widespread adoption of the Web and the rising popularity of JavaScript’s powerful frameworks and libraries. JavaScript is now used even in non-Web contexts—for example, in PDF documents. Its rising popularity, combined with its weaknesses, has prompted companies such as Google (with Dart) and Microsoft (with TypeScript) to attempt replacing JavaScript, but JavaScript continues to rule the roost.

Recently, I visited a company that develops software for set-top boxes and TVs, and was surprised at the extent that JavaScript code runs in these devices. There is a large list of languages that compile to JavaScript. There are also translators or adapted languages for major languages such as Java, C#, Ruby and Python that compile to JavaScript. I attended a talk on the Elm language and came to know that it compiles to JavaScript. I was amazed by what you can do with Elm, and I’ll leave it to you to go and discover the magic of these new languages. I’ve also come across the Hack language, created by Facebook in an attempt to replace PHP. But it is too early to gauge whether this attempt has been successful or not. However, generally speaking, it is clear that JavaScript is here to stay.

Java and .NET: Emerging as target platforms for innumerable languages Most language experts believe that compiled and statically typed languages have an edge over interpreted and dynamically typed languages when it comes to building large-scale enterprise applications. Statically typed languages such as Java, C# and C++ have long been used for creating commercial as well as open source applications. Though the Java platform was originally designed to run code written in the Java language, because of its all-pervasiveness, it has become a target platform for numerous other languages too. For instance, Scala compiles to the Java platform. Groovy extends Java and compiles to the Java platform. Languages such as Jython and JRuby are ports of Python and Ruby languages that target the Java platform. With its support for invokedynamic byte code and other features, it is easier for dynamic languages to compile to the Java platform.

Unlike the Java platform, the .NET platform was designed from the ground up to serve as a platform for a large number of languages. Other than C#, some important languages that translate to .NET are VisualBasic.NET, C++/CLI and F#. Older languages and other languages have ports to .NET as well — for example, Eiffel, IronPython and IronRuby. One of the disadvantages of .NET is that it primarily supports

For U & Me Insight

30 | JaNUaRY 2015 | OPEN SOURCE FOR YOU | www.OpenSourceForU.com

Page 3: Which programming language should you learn next?

Open source languages are on the rise Microsoft’s announcement last year that .NET was going open source attracted considerable attention. This was not a one-off event, but what I see as a general trend in the programming languages community. Java was initially a proprietary language; later, Sun released most of it to the open source community. Languages designed from the ground up, such as Go and Dart (both from Google), TypeScript and F# (both from Microsoft) are also open source. A large number of languages developed in the last two decades are open source. In other words, languages going open source is a clear trend that is here to stay.

Old languages are reborn in new forms Just like living beings, languages are born, grow up, age and die. What is surprising is the rebirth or rejuvenation of old languages in a new form. The relationship between these new and old language pairs is unmistakable—Elixir and Erlang, Clojure and LISP, Swift and Objective-C, etc. In other words, newer languages such as Elixir, Clojure and Swift render corresponding older languages such as Erlang, LISP and Objective-C in a form that is compatible to the new realities. I won’t be surprised if older languages such as APL, Simula, SNOBOL, or even Fortran, are reborn as newer languages.

C continues to be a dominant languageSo far we have discussed factors that are changing or emerging. This is a new world with emerging fields like Big Data, cloud computing and the Internet of Things (IoT). The computing world is moving towards increased concurrency and ever shrinking devices. With all these changes, one constant surprises me - C continues to stay relevant in this ever-changing world! With the exploding number of mobile devices that are getting connected to the Internet, the devices are still programmed in embedded C. Low-level utilities such as protocols and device drivers are still written in C. There aren’t many rivals for C though Go appears to be an attractive alternative - so if you develop low-level code (e.g., device drivers, virtual machines, protocols, etc), it is better to learn Go. However, the underlying trend is clear—C continues to be relevant and popular.

Other languages to watch out for The programming languages world is one where so many things are happening that I have FOMO (Fear Of Missing Out). You may be interested in many other languages that I haven’t covered here. Some important ones are D from Digital Mars, Ceylon from Red Hat, Chapel from Cray, and Opa from MLState.

So, what language should you learn next? With this, we have completed our quick safari in the language jungle. It is time to answer the question: “What language should I learn next?”

This question is as difficult to answer as these two questions: “Which book should I read next?” or “Which movie should I watch next?” Why is it difficult to give specific answers to these questions? Because the answer depends on your interests as well as personal preferences! So, here is my answer based on your likely preferences and the overall trends we have discussed so far. � If you have programmed only in statically typed

languages (such as C++ or Java), learn Ruby or Python. � If you do not know Web programming yet want to learn

how to program for the Web, learn JavaScript. � If you develop systems software and have programmed

mostly in C or Assembler, learn Go. � If you don’t know C, learn it!

No matter what kind of programming you do, learn a functional programming language (or at least learn to use closures if the programming language you regularly use allows that).

Also, try using a new language (it’s important that it is not a mainstream language) to solve problems you encounter on a day-to-day basis. For example, if you are a game developer and use languages like C++, try using Elm. If your work involves lots of mathematics and you use Fortran, try using languages like Julia or J. If your work involves querying information to find answers using regular expressions, try using Prolog or R. By trying out unusually effective solutions to the problems that you try to solve on a day-to-day basis, you’ll be surprised by an ‘Aha!’ moment that could permanently change the way you think about problem solving!

By: Anil Kumar PugaliaThe author is a corporate trainer and independent consultant based in Bengaluru. He is a co-author of the book ‘Refactoring for Software Design Smells: Managing Technical Debt’ published by Morgan Kaufmann/Elsevier, 2014. You can reach him through his website www.designsmells.com.

By: Ganesh Samarthyam

By: Anil Kumar Pugalia[1] List of languages that compile to JavaScript: https://github.com/jashkenas/coffeescript/ wiki/List-of-languages-that-compile-to-JS

[2] The Elm language home page: http://elm-lang.org [3] The Hack language home page: http://hacklang.org [4] Java Virtual Machine Support for Non-Java Languages:

http://docs.oracle.com/javase/7/docs/technotes/guides/vm/multiple-language-support.html

[5] Microsoft Open Sources .NET, saying it will run on Linux and Mac: http://www.wired.com/2014/11/microsoft-open-sources-net-says-will-run-linux-mac/

[6] Go language home page: https://golang.org/

References

By: Anil Kumar PugaliaI thank Raghu Kalyan Anna for his thoughtful and detailed feedback on an earlier draft of this article.

Acknowledgement:

For U & MeInsight

www.OpenSourceForU.com | OPEN SOURCE FOR YOU | JaNUaRY 2015 | 31