Choosing right open source programming language

1
301

Choice and decisions: businessman thinking with question marks written on adhesive notes stuck to a brick wall

Selecting a programming language is often a daunting task as the choices are vast. In this article, novices attempting to learn coding get a bird’s eye view of the top programming languages, allowing them to examine the simplicity or complexity of coding and then weigh the pros and cons of each language.

The world of technology is expanding immensely with each passing year. The competition in the market is getting keener as every company tries to hold on to the highest position. To face up to the competition, every IT organisation requires programmers, Web developers and app developers who are well versed with programming languages. Various open source and commercial programming languages are available today, each with distinct features and functionalities.
The backbone of software development is the source code, which is made up of thousands of lines of instructions that programmers write for computers to interpret. The source code instructs the application what to do and how to do it. The source code is the blueprint of the program.
In order to code, what language the programmers decide to use is important, as so many are available. Some of the programming languages are open source and some are commercial. The trend right now is for every IT enterprise to shift towards open source. As per the latest survey, more than 80 per cent of the enterprises are using open source technology to build all sorts of applications.
Some of the top open source programming languages are given below, along with a short description to  get the reader acquainted with them.

1. Google’s Go
Google’s Go programming language, often referred to as golang, was created by Robert Griesemer, Rob Pike and Ken Thompson. The main objective of Go language, along with its accompanying tools, is to be expressive and efficient in both compilation and execution, and be perfectly effective in writing reliable and robust programs. Go is a statically-typed language with programming syntax similar to C programming. It provides garbage collection, type safety, dynamic typing capabilities and many advanced built-in types like variable length arrays and key value maps.
Go is expressive, concise, clean and efficient. Its concurrency mechanisms make it easy to write programs that get the most out of multi-core and networked machines, while its novel type system enables flexible and modular program construction. Go compiles quickly to machine code, yet has the convenience of garbage collection and the power of runtime reflection. It’s a fast, statically typed, compiled language that feels like a dynamically typed, interpreted language.
The latest version of Go is 1.6.3.
Here’s the syntax for the ‘Hello World’ program in Go:

package main
import "fmt"
func main() {
          fmt.Println("Hello World”)
}

The advantages of Go

  • Go language is very fast in compilation and execution, compared to other languages, and even the compiler compiles the program really fast. It’s a great modern language with high performance.
  • Go is regarded as a highly powerful language with built-in concurrency and a high degree of abstraction. It is equipped with Go routines to start concurrent work and the concept of channels to permit both communication and synchronisation.
  • Go, being a high level language, has standard documentation features and a powerful rich standard library that contains a full-fledged, working Web server.
  • Go has an active community that offers support for any sort of problems.

The disadvantages

  • Go, being a new programming language, does not have enough libraries, so developers work hard to develop libraries on their own.
  • Go does not have enough resources in terms of books, research articles and other online resources for users to learn in a systematic manner.
  • Go is a tough language to learn and error handling is a tedious task.

2. Swift
Swift is a new general-purpose, multi-paradigm, compiled programming language for iOS and OS X, watchOS, tvOS and Linux. It is being built by Apple Inc., on the best of C and Objective-C, without any  of the constraints of C compatibility. The development of Swift was started by Chris Lattner with other programmers at Apple, by taking into consideration ideas from many programming languages like Objective-C, Rust, Haskell, Ruby, Python, C# and CLU. Swift was basically developed to work with Apple’s Cocoa and Cocoa Touch frameworks, and has an inbuilt LLVM compiler framework included in Xcode 6, using the Objective-C runtime library.
The latest version of Swift is 3.0 Preview 2.
The syntax for the ‘Hello World’ program in Swift is:

import Cocoa
/* My first program in Swift */
var myString = "Hello, World!"
println(myString)

The advantages of Swift

  • Swift is comparatively easy to read and write because of less overhead and syntax requirements, and it is the friendliest language for beginners.
  • Swift programs are overall shorter in length, which gives programmers unique advantages in terms of passing functions as variables. Swift enables developers to write highly generic code, which can perform lots of different things and reduces repetition.
  • Swift compiles directly to native code and utilises both Objective 2.0 runtime as well as Apple’s ARC memory management technology.
  • Swift is less error-prone as its syntax and language construction exclude several types of mistakes, thereby making it relatively free from crashes and unexpected behaviour.

Swift’s disadvantages

  • Most of the examples which come inbuilt with Swift are written in Objective C, so to begin Swift programming, one has to learn Objective C.
  • Swift is still undergoing a major paradigm shift as newer versions are coming out with lots of changes, which sometimes become hard for professionals and newbies to understand.
  • Developers can use Swift only for iOS and OS X app development, so it has limited programming platform opportunities.
  • Swift is slower than Objective-C, which means for all modern syntax, simplified code construction, playground app simulation and testing, Swift programming code has a longer execution time period.

3. Hack
Hack is an open source general-purpose programming and scripting language for HipHop Virtual Machine (HHVM) created by Facebook as a dialect for PHP. Hack is specially designed for Web development, and can be easily integrated with HTML. Hack supports fast development for PHP by enabling programmers to use both static and dynamic typing which, in turn, is called gradual typing.
Hack provides various important features, some of which are listed below.
Type annotations: This feature allows code to be explicitly typed on parameters, class member variables and return values.
Generics: This allows classes and methods to be parametrised in a manner similar to C# or Java.
Nullable types: This feature enables Hack to deal with nulls in a safer way by making use of the ‘?’ operator.
Collections: This provides first class, built-in parametrised types such as Vector, Map, Set and Pair.
Lambdas: This allows the definition of first class functions.
Here’s the syntax for the ‘Hello World’ program in Hack.
After installing HHVM, start it by typing the following:

Hhvm –m server –p 8080
<?hh
Echo “Hello World!”;

The advantages of Hack

  • Hack code is mixed with PHP code. Instead of using <?php in PHP, use <?hh in Hack, which makes for a smooth migration between Hack and PHP.
  • Hack runs with HHVM, which has a type-checking phase that verifies the consistency of the code.
  • Hack is used to build complex websites at great speeds by ensuring proper organisation and error-free code, and gives programmers a unique safety advantage to write bug-free code.

Hack’s disadvantages

  • It contains abandoned features that make PHP a simple language.
  • HTML code cannot be directly embedded into Hack and code can’t be written outside of a function or class.
  • Being a new language, Hack has lots of bugs and errors which, right now, make it an unstable language.

4. Rust
Rust is regarded as a general-purpose, multi-paradigm system programming language that is designed to meet three main objectives: safety, speed and concurrency. Rust was designed by Graydon Hoare from Mozilla Research, and uses LLVM as its backend. The design of the language has been refined due to the developer team’s experience of writing the Servo Web browser layout engine and the Rust compiler. Rust, being an intelligent open source language, has an edge over other programming languages by having a number of compile-time safety checks, which generate no runtime overhead and eliminate all data traces. Rust has the inbuilt functionality most needed for concurrent execution on multi-core machines, making concurrent programming memory safe without garbage collection. And it is the only language that does this job.

The latest stable release for Rust is 1.10.
The syntax for the ‘Hello World’ program in Rust is:

fn main() {
    println!("Hello, world!");
}

The advantages of Rust

  • Rust is suitable for developers and projects where safety and stable execution, in addition to low-level optimisation and performance, are required. Rust adds lots of high-level functional programming techniques, making it feel like a low level and a high level language at the same time.
  • Rust has an enlarged standard library, which is expanding constantly, focusing on file system access, networking, time and collections APIs.
  • Rust is supportive of multi-platform development, ranging from Windows, Android and even ARM devices, apart from other platforms.

Rust’s disadvantages

  • Rust is a bit harder and more complex to learn and code. Error handling is a complex task, especially for newbies.
  • Rust is a very immature language in terms of documentation, which is not available.
  • Rust is currently not being adopted too much in the industry.

5. Scala
Scala (Scalable Language) is regarded as a general-purpose programming language designed to define programming patterns in a concise, elegant and type-safe way. Scala was developed by Martin Odersky in 2001 by using the Funnel programming language as the base. Scala basically integrates the features of object-oriented and functional languages, making programmers more productive and effective in writing source code. Scala has many of the features of functional programming languages like Scheme, Standard ML and Haskell, in addition to currying, type inference, immutability, lazy evaluation and pattern matching. Scala is more advanced compared to Java because it integrates other features like operator overloading, optional parameters, named parameters, raw strings and no checked exceptions. Scala and Java are related to each other by the fact that they are compiled to a bytecode and use the JVM. Scala is completely interoperable with Java.
The latest stable release of Scala is 2.11.8.
The syntax for the ‘Hello World’ program in Scala is:

object HelloWorld extends App {
   println("Hello, World!")
 }

The advantages of Scala

  • Scala enables developers to write simple and straightforward text, as it requires two-thirds less code than Java and that code is more flexible. This, in turn, makes the code human-readable and easier to understand.
  • Scala enables quick implementation and enhanced performance, as it reduces various thread-safety concerns and treats functions on first priority.
  • Scala solves various concurrency issues because it is well equipped with the Actor library.
  • Scala has the fastest growing ecosystem compared to any other language in the current scenario, as the IDE tools, testing tools, documentation and even the libraries are improving, while its capabilities are getting enhanced.

Scala’s disadvantages

  • Scala is right now very hard to learn as the language is completely different from pure Java and the programming environment is also different, requiring more professional developers to understand and start building up the logic and developing bug-free code.
  • Even today, there are very few projects written purely in Scala. In a nutshell, we see projects with a hybrid composition of both Java and Scala, and mixing up these two is somewhat time consuming and slow. And testing becomes a pain.
  • Because of limited backward compatibility, Scala is not compatible with previous versions, which creates problems when the development time period is short. So, Scala is not recommended for projects with time constraints.

6. Dart
Dart is a class-based, single inheritance, object-oriented-cum-general-purpose programming language originally developed by Google and later approved as a standard by ECMA (ECMA-408). Being an open source programming language enables Dart developers to build more complex, high performance and scalable-rich apps for the modern Web. Dart comes bundled with a Web Component Library, which contains Web code comprising HTML and JavaScript, which can be used in different pages or projects.

Dart has tools such as:

  • Dartboard: Enables the developers to write and run Dart code in the Web browser.
  • Dart Editor: Enables the developers to create, modify and run Dart apps.
  • SDK: Contains command-line tools such as a Dart-to-JavaScript compiler, a Dart virtual machine, etc.
  • Dartium: Contains a built-in Dart VM.

The latest stable release of Dart is 1.18.
The syntax for the ‘Hello World’ program in Dart is:

void main() {
  print('Hello, World!');
}

The advantages of Dart

  • Dart is regarded as more than just a programming language, providing a good platform for Web developers and a new feature set that includes optional typing and isolates.
  • Dart core libraries provide functionality including collections, dates, math, HTML bindings, server-side I/O like sockets and even JSON.
  • Dart’s VM has been built from scratch. It can run on the command line for server-side applications, and can be embedded into browsers for client-side applications.
  • Dart has other useful features like mixins, implicit interfaces, lexical closures, lexical this, named constructors, string interpolation, online functions and noSuchMethod.

Dart’s disadvantages

  • Dart’s SDK doesn’t provide access to SQL based databases at the server level. Third party packages come to the rescue.
  • Dart is currently not very successful in generating consumable JavaScript. The entire app build in Dart has to be built in JavaScript at once, for now.
  • Dart is not entirely interoperable with JavaScript right now as the Dart JavaScript library is not stable. It is currently in the development stage.

7. Clojure
Clojure is regarded as a dynamic, general-purpose programming language that combines the approachability and interactive development of a scripting language with efficient and robust infrastructure for multi-threaded programming. Clojure is closely related to Lisp, which was created by Rich Hickey. It operates on the Java VM and is integrated with Java. It fully supports calling Java code from Clojure and vice-versa. Clojure supports functions as first class objects, a read-eval-print loop (REPL) and a macro system. It encourages the use of first-class and high-order functions with values, and comes with its own set of efficient immutable data structures. Clojure offers innovative solutions to the challenges inherent in concurrency and parallelisation.

The latest stable release of Clojure is 1.8.
The syntax for the ‘Hello World’ program in Clojure is:

On repl
Start repl. When you use Leiningen, type lein repl on Terminal (Command Prompt):

bash-3.2$ lein repl
nREPL server started on port 59553 on host 127.0.0.1
REPL-y 0.2.1
Clojure 1.5.1
    Docs: (doc function-name-here)
          (find-doc "part-of-name-here")
  Source: (source function-name-here)
 Javadoc: (javadoc java-object-or-class-here)
    Exit: Control+D or (exit) or (quit)
 Results: Stored in vars *1, *2, *3, an exception in *e
user=>
Type below on repl:
user=> (prn "Hello World")
"Hello World"
nil
user=> (println "Hello World")Hello World
nil
user=> (pr-str "Hello World")
"\"Hello World\""

The advantages of Clojure

  • Clojure code can be used on any Java library. Clojure libraries can, in turn, be used from Java and Clojure applications can be packed like Java applications and deployed anywhere.
  • Clojure is part of the Lisp environment and it retains the best features of Lisp. Clojure contains macros, which is regarded as an important approach to meta programming and syntactic extensions.
  • Clojure, being a functional programming language, enables developers to use first-class and high order functions with values, and comes with its own set of efficient immutable data structures.
  • Being a dynamic programming language, it supports updating and loading of new code at runtime, either locally or remotely.

Clojure’s disadvantages

  • Debugging in Clojure with regard to error handling and removal is a tedious task.
  • Clojure can only run on the Java virtual machine.
  • Clojure is hard to master for newbies, and sometimes even developers take a lot of time when using it for core and professional program development.

8. Haskell
Haskell is a modern, standard, non-strict, purely functional programming language, and is built with features like polymorphic typing, lazy evaluation and higher order functions. Haskell features a type system with type inference and lazy evaluation, and also includes type classes. It is purely based on semantics, but not the syntax of the language of Miranda which focused on the efforts of the initial Haskell working group.

Haskell has a strong, static type system based on the Hindley–Milner type inference. Haskell’s principal innovation in this area is to add type classes, originally conceived as a principled way to add overloading to the language, but since then this function has been found to address many more uses.

Haskell has an open, published specification, and multiple implementations exist. Its main implementation, the Glasgow Haskell Compiler (GHC), is both an interpreter and native-code compiler that runs on most platforms. GHC is noted for its high-performance implementation of concurrency and parallelism, and for having a rich type system incorporating recent innovations such as generalised algebraic data types and type families. Another interesting feature of Haskell is that all functions are treated as values like integers and strings.

The latest version is Haskell 2014.

The syntax for the ‘Hello World’ program is:

module Main where
main :: IO ()
main = putStrLn "Hello, World!"

The advantages of Haskell

  • Being a purely functional programming language, Haskell enables users to get things done by giving the computer a sequence of tasks and then executing them. While executing, the tasks change state.
  • Haskell is a lazy programming language and will not execute functions and calculate things until really forced to show the results. It goes well with referential transparency, and allows  developers to think of programs as a series of transformations on data.
  • Haskell is elegant and concise. Its programs are shorter compared to other programming languages and debugging becomes a lot easier.

Haskell’s disadvantages

  • Haskell is not suitable for making time-critical applications.
  • Being a new programming language, it is very difficult to understand, compared to other languages like C or C++, and has limited community support and documentation.
  • There are very few platforms where Haskell code has been used.

9. Apache Groovy
According to its website, “Apache Groovy is a powerful, optionally typed and dynamic language, with static-typing and static compilation capabilities, for the Java platform aimed at improving developer productivity, thanks to a concise, familiar and easy-to-learn syntax. It integrates smoothly with any Java program, and immediately delivers to your application powerful features, including scripting capabilities, domain-specific language authoring, runtime and compile-time meta-programming and functional programming.”

Apache Groovy is a dynamic language and has features similar to other programming languages like Python, Ruby, Perl and Smalltalk. Groovy also supports modularity, type checking, static compilation, Project Coin syntax enhancements, multi-catch blocks and ongoing performance enhancements using JDK7’s invoke dynamic instruction. Groovy provides native support for various mark-up languages such as XML and HTML, accomplished via an inline DOM syntax. This feature enables the definition and manipulation of many types of heterogeneous data assets with a uniform and concise syntax and programming methodology.

The latest version of Apache Groovy is 2.4.7
The syntax for the ‘Hello World’ program is:

class Hello {
    String name;
        void say Hello() {
        Systematisation("Hello "+get Name()+"!");
    }
        void set Name(String name) {
        pathnames = name;
    }
        String get Name() {
        return name;
    }
        static void main(String[] rags) {
        Hello hello = new Hello(); Hellenisation("world");
        Hellenisations();
    }
}

The advantages of Apache Groovy

  • Apache Groovy is easy to learn and code, especially for Java developers, as it contains closures, builders, runtime and compile time meta programming, functional programming, type inference and static compilation.
  • Groovy has a rich and vibrant ecosystem in terms of Web development, reactive applications, concurrency, parallelism library, test frameworks, build tools, code analysis and GUI building.
  • Groovy supports smooth Java integration, and also interoperates with Java and other third party libraries.

The disadvantages

  • When used with lots of dynamic features like duck-typing, dynamic code, meta-programming, etc, Groovy demands more processing at runtime and this results in a slow performance.
  • Groovy lacks documentation as well as online resources, so there’s not much help for newbies. Also, it has not been implemented in high-end and critical applications.

1 COMMENT

LEAVE A REPLY

Please enter your comment!
Please enter your name here