Advertisment

It's time to be a Polyglot

author-image
PCQ Bureau
New Update

Shashank Tiwari, Technology Entreprenuer and Innovator

Advertisment

Let's start by defining what a polyglot is. The Oxford

English dictionary defines a polyglot as someone who knows or uses several

languages. The meaning is in the context of the natural languages we as humans

speak but the concept also applies to the languages we program in. So, what I am

suggesting here is that it must be your endeavor to learn and use more than one

programming language, at least two, ideally three and possibly four or more. On

top of it, I am making a claim that there would be no better time than now to be

a polyglot programmer. With that said, let me try and convince you with a

rationale and a reason to accept my suggestion.

Direct Hit!

Applies To: Programmers



USP: Understand the benefits in learning multiple programming
languages



Primary Link: NA


Search Engine Keywords: Polyglot

Our programming language often gets decided by the type of

company we decide to work for and in a majority of cases it ends up becoming

Java, C# (.Net), PHP or the good old C and C++.  If we are enterprise or

consumer centric application developers, we also learn to interact with a

database, most likely a relational database, which teaches us some SQL. If our

applications are Internet or web applications we learn HTML, CSS, JavaScript or

ActionScript. If we are the so called system programmers, who write device

driver codes, protocol stacks or program the embedded devices, we are happy with

C and C++.  If we don't belong to any of the classifications so far, then we end

up being die hard Ruby fans, shell script writers, Perl hackers or Pythonistas.

Few, if any, of us fall outside the line and adopt the plural beauty.

Advertisment

Most of us, programmers, take pride in being a certain type

of a programmer, say Java programmer, .Net programmer, C++ programmer or such.

Worse still we get overly attached to specific layers of an application stack,

frameworks that help programmers get productive or programming interfaces of

specific packaged products. I am sure we have a lot of Spring developers, Rails

developers, Java Servlet programmers, Cognos developers and Drupal developers

among us.

So what am I saying? Is it all bad to be a Java Servlet

programmer, an Android developer or any such specialized programmer? Absolutely

not! Specialization is important with the ever growing complexity of software

programming languages and tools. Equally important though is the need to

understand different programming paradigms, use the right tool for the right job

and above all create software that does what it was expected to do. Should the

choice then shift in favour of a language that is general purpose and the one

that supports multiple programming paradigms?

Unfortunately, that doesn't solve the problem either. If it

did, for the most part we wouldn't need so many languages. What then becomes

relevant is to learn more than one language and use the one that best suits to

solve the problem at hand, thereby leveraging the right tool for the right job.

This brings us to a totally new debate then.

Advertisment

If a programmer learns more than one language, would he or

she be able to become an expert in even one of them? If they don't then what are

the career or growth prospects of making the extra effort to learn so many

languages. Common public belief, which is grounded in little if any facts,

states that to be an expert in a language we must devote and dedicate our

undivided attention to one subject or domain, which in the world of programming

translates to a single language. However, what this belief discounts and

misrepresents is that diversity and exposure to multiple paradigms actually

helps you provide a better view into a subject or domain.

Learning and expertise around effectively writing computer

programs is linked closely to one's ability to analytically solve problems and

creatively modularize it into parts. It's an exercise in conceptualization,

ideation and construction. That doesn't mean you become smarter in lesser time

if you learn more than one thing but what it means is that when you spend the

right amount of effort (which as per Malcolm Gladwell's famous book Outliers

seems to be 10,000 hours) with a good amount of diversity you certainly become

really smart.

Advertisment

For example, when you learn a language that is object

oriented and another that supports functional programming, you get two

viewpoints to consider and cross leverage.

Object orientated programming encapsulates state and

behavior together and provides a great way to implement modularity and data

hiding. This helps define real world objects in programs. So you could define a

book as an object, which would have associated data like title, author, number

of pages or paper type and can define behavior to open and close it. This

provides a clean and neat single entity to interact with. Java, C++, Python,

Ruby and Smalltalk are great object oriented languages. Central to functional

programming is the idea of a function that performs a task. So you could have a

function that takes the length of a side and calculates the area of a square and

you could apply this function 6 times to calculate the area of a cube, which has

a side of the same length as the square. Functional programming belongs to a

classification of programming paradigm called declarative programming.

Declarative programming is based on the idea of telling the computer what the

problem is and not necessarily specifying how to solve the problem. SQL is the

poster child of this programming paradigm and besides functional programming,

logic programming which involves automated reasoning over a knowledge base also

falls in this category. Lisp, Haskell, Clojure and Scala are great functional

programming languages.

Using object oriented and declarative paradigms in the

right mix is an optimal way of writing programs effectively. Unfortunately, that

doesn't happen often. Instead one of the paradigms, like object oriented

programming, is used throughout. This creates overly complex programs, which are

brittle and difficult to maintain. A reason why this happened so far was that

mixing different programming paradigms on a single platform wasn't easy. This

big barrier is slowly melting away and it's becoming possible to bring in

multiple programming languages and constructs on one platform.

If you are a Java platform developer, adopting these

different paradigms now becomes not only possible but easy. Java is a strongly

and statically typed object oriented language, which serves well for many

general purposes cross platform programming problems. However, it gets overly

complex when applied to rapid web development, where dynamic languages like

Python (as Jython on the JVM), Ruby (JRuby), Groovy or JavaScript (Rhino)

outshine the rest. It also gets cumbersome when used for writing thread safe

concurrent programs on multi-core processors. Functional abstractions and

languages like Scala or Clojure do a better job in such cases. All the languages

I mentioned in this paragraph work like a charm on the JVM. So, your deployment

environment or the platform doesn't change but you bring in the best from

different languages in one place. If you develop for the .Net platform, you have

the likes of F# to provide the benefits of effective functional programming.

Besides, these two layers of statically typed languages (in which type is fixed

at compile time), like Java or C#, and dynamic languages (in which type is

determined at runtime), like Ruby or Python, there is a third distinct layer of

Domain Specific Languages (DSL) that easily comes to the mix. These could be

Esper EPL that helps you write window-based constraints and filters for

streaming events or Drools that helps you write business rules. A balanced

combination of the three different types of languages, with their multi paradigm

offerings forms a good combination to provide a varied repertoire.

Advertisment