Cookie Consent by Privacy Policies Generator Vegapit
Define your programming toolbox
Last updated: 2019-02-15T07:00:00

Should you use a large pair of pliers to knock a nail into your wall? You possibly could, but it would be a silly choice of tool. If have a hammer at hand, you should use it. Picking the right tool for the right job is common sense, and the same idea applies to programming languages. Each one of them offers its own set of attributes, making it either particularly adequate or broadly inappropriate for the task at hand. That’s why it is better - in my humble opinion - to be comfortably proficient with a few rather than mastering a single one. Now, given the large number of programming languages in existence, it would be counterproductive to learn them all. For your toolbox, you just need to strategically pick a handful to get comfortable with. Here are the ones that I have picked and what I use them for. I added snippets of code for the same factorial function, in order to show the specificity of each language.

Python: The Versatile

If Python was a tool it would be a Swiss army knife. It is a very compact scripting language making it a great pick for the rapid development of low-performance backend services. It is a particularly great choice for research work with the diverse set of libraries - especially scientific ones - available in its ecosystem. The language has built such a large user base that any possible applications ever imagined probably has an open-source module. Sadly, its poor runtime performance should not be overlooked. It runs with very limited speed with an interpreter that takes a lot of disk room, making it inappropriate for real-time embarked applications.

import numpy as np

def factorial = lambda n : np.prod(range(1,n+1))

print(factorial(10))

Go: The Multitasker

Go is a modern compiled language specifically designed for excelling at concurrent operations. It is comprised of a small number of keywords, and comes with its multi-platform compiler making it easily portable across operating systems. I find it specifically relevant for designing high performance backend services, especially network based ones like REST APIs, and all sorts of microservices. It is powering the Ethereum blockchain after all, which is a proof of high performance in itself. Thanks to its Google backing, the online documentation is very extensive and language reference is clear and well organised.

package main

import "fmt"

func factorial (n int) int {
	if (n <= 1){
		return n
	}else{
		return n * factorial(n-1)
	}
}

func main() {
	fmt.Println(factorial(10))
}

Javascript: The Webmaster

When it comes to interactive web interfaces, it is impossible to beat Javascript (JS). Modern browsers support it natively making it unrivaled for front-end Web development. Over the years, the Javascript community has moved the language outside the browser with its command line interpreter NodeJS. That turned it into a complete scripting language in the likes of Python, but the most relevant application that came out of it was its Express module, a robust Web framework library. JS is basically the undisputed master of Web interfacing and should not spread itself thin in other applications.

// ES6 Version
function factorial(n){
    let a = []
    for(i=1; i<n+1; i++){
        a.push(i)
    }
    return a.reduce((total,x) => total*x, 1.0)
}

console.log(factorial(10))

C++: The Athlete

This is a veteran low-level compiled languages which has and is powering most of the high performance applications we use today. It provides total control over memory management which makes it very hard to beat (only pure C can) in terms of execution speed. C++ being the object-oriented version of C, it is the preferred language for large projects for code reuse, while C is the favourite for developing real-time systems thanks to its very optimised disk footprint. But with great power comes great complexity in programming. The language is pretty verbose and not only requires a thorough knowledge of its intricate low-level syntax, but also a good understanding of numerous linkage and compilation tags.

#include <iostream>

uint factorial(uint n) {
    if(n <= 1){
        return 1;
    } else {
        return n * factorial(n-1);
    }
}

int main() {
    std::cout << factorial(10);
    return 0;
}

Java: The Entertainer

When it comes to making applications with Graphical User Interfaces (GUIs), Java is a popular pick. It simply has great Integrated Development Environments (IDEs) support and because it has been popular for so long, it has well documented libraries and snippets. As a semi-compiled language, it is highly portable, and holds its own in terms of runtime performance. But its strict object-orientation and extreme verbosity make its code very clunky, and like C++, it is a poor candidate for rapid application development.

public class Example {

    public static int factorial(int n) {
        if (n <= 1) {
            return 1;
        } else {
            return n * factorial(n-1);
        }
    }
    
    public static void main(String[] args) {
        System.out.println(Example.factorial(10));
    }
}

Rust: The Contender

If your main language is C++, Rust is probably a little redundant. However, its language designers at Mozilla aimed at not only high performance, but also unparalleled code safety features. Anyone trying to debug a memory allocation error in C++ would truly appreciate this safety aspect. Rust also comes with a multi-platform compiler and project manager called Cargo that makes portability amazingly straightforward. No more cryptic linker and compiler options syntax. All in all, Rust could become the ultimate language of choice for system development. It is however a very hard language to learn because of its strong safety and functional programming features.

fn factorial(n: usize) -> usize {
    (1..n+1).into_iter().fold(1, |total, x| total*x)
}

fn main() {
    println!(\"{}\", factorial(10));
}

Anyone interested in programming should make their own investigation. There are hundreds of languages, but those backed a large user base will be the ones that thrive over time. As their ecosystems grow, the learning hurdle gets lowered for new comers as more modules and better documentations get written. For this reason, don’t try to be a pioneer when picking a programming language, just follow the crowd.