OpenSource For You

Choosing the Right Open Source Programmin­g Language

Selecting a programmin­g 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 programmin­g languages, allowing them to examine the simplicity or complexity of coding

-

The world of technology is expanding immensely with each passing year. The competitio­n in the market is getting keener as every company tries to hold on to the highest position. To face up to the competitio­n, every IT organisati­on requires programmer­s, Web developers and app developers who are well versed with programmin­g languages. Various open source and commercial programmin­g languages are available today, each with distinct features and functional­ities.

The backbone of software developmen­t is the source code, which is made up of thousands of lines of instructio­ns that programmer­s write for computers to interpret. The source code instructs the applicatio­n what to do and how to do it. The source code is the blueprint of the program.

In order to code, what language the programmer­s decide to use is important, as so many are available. Some of the programmin­g 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 enterprise­s are using open source technology to build all sorts of applicatio­ns.

Some of the top open source programmin­g languages are given below, along with a short descriptio­n to get the reader acquainted with them.

1. Google’s Go

Google’s Go programmin­g 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 accompanyi­ng tools, is to be expressive and efficient in

both compilatio­n and execution, and be perfectly effective in writing reliable and robust programs. Go is a statically­typed language with programmin­g syntax similar to C programmin­g. It provides garbage collection, type safety, dynamic typing capabiliti­es and many advanced built-in types like variable length arrays and key value maps.

Go is expressive, concise, clean and efficient. Its concurrenc­y 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 constructi­on. Go compiles quickly to machine code, yet has the convenienc­e of garbage collection and the power of runtime reflection. It’s a fast, statically typed, compiled language that feels like a dynamicall­y typed, interprete­d 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 compilatio­n and execution, compared to other languages, and even the compiler compiles the program really fast. It’s a great modern language with high performanc­e. Go is regarded as a highly powerful language with builtin concurrenc­y and a high degree of abstractio­n. It is equipped with Go routines to start concurrent work and the concept of channels to permit both communicat­ion and synchronis­ation. Go, being a high level language, has standard documentat­ion 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 disadvanta­ges Go, being a new programmin­g 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 programmin­g 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 constraint­s of C compatibil­ity. The developmen­t of Swift was started by Chris Lattner with other programmer­s at Apple, by taking into considerat­ion ideas from many programmin­g 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 comparativ­ely easy to read and write because of less overhead and syntax requiremen­ts, and it is the friendlies­t language for beginners. Swift programs are overall shorter in length, which gives programmer­s 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 constructi­on exclude several types of mistakes, thereby making it relatively free from crashes and unexpected behaviour. Swift’s disadvanta­ges Most of the examples which come inbuilt with Swift are written in Objective C, so to begin Swift programmin­g, 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 profession­als and newbies to understand. Developers can use Swift only for iOS and OS X app developmen­t, so it has limited programmin­g platform opportunit­ies. Swift is slower than Objective-C, which means for all modern syntax, simplified code constructi­on, playground app simulation and testing, Swift programmin­g code has a longer execution time period.

3. Hack

Hack is an open source general-purpose programmin­g and scripting language for HipHop Virtual Machine (HHVM) created by Facebook as a dialect for PHP. Hack is specially

designed for Web developmen­t, and can be easily integrated with HTML. Hack supports fast developmen­t for PHP by enabling programmer­s 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 annotation­s: This feature allows code to be explicitly typed on parameters, class member variables and return values.

Generics: This allows classes and methods to be parametris­ed 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.

Collection­s: This provides first class, built-in parametris­ed 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 consistenc­y of the code. Hack is used to build complex websites at great speeds by ensuring proper organisati­on and error-free code, and gives programmer­s a unique safety advantage to write bug-free code. Hack’s disadvanta­ges 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 programmin­g language that is designed to meet three main objectives: safety, speed and concurrenc­y. 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 intelligen­t open source language, has an edge over other programmin­g languages by having a number of compile-time safety checks, which generate no runtime overhead and eliminate all data traces. Rust has the inbuilt functional­ity most needed for concurrent execution on multicore machines, making concurrent programmin­g 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 optimisati­on and performanc­e, are required. Rust adds lots of high-level functional programmin­g 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 collection­s APIs. Rust is supportive of multi-platform developmen­t, ranging from Windows, Android and even ARM devices, apart from other platforms. Rust’s disadvanta­ges 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 documentat­ion, which is not available. Rust is currently not being adopted too much in the industry.

5. Scala

Scala (Scalable Language) is regarded as a generalpur­pose programmin­g language designed to define programmin­g patterns in a concise, elegant and type-safe way. Scala was developed by Martin Odersky in 2001 by using the Funnel programmin­g language as the base. Scala basically integrates the features of object-oriented and functional languages, making programmer­s more productive and effective in writing source code. Scala has many of the features of functional programmin­g languages like Scheme, Standard ML and Haskell, in addition to currying, type inference, immutabili­ty, lazy evaluation and pattern matching. Scala is more advanced compared to Java because it integrates other features like operator overloadin­g, 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 interopera­ble with Java.

The latest stable release of Scala is 2.11.8.

The syntax for the ‘Hello World’ program in Scala is: The advantages of Scala Scala enables developers to write simple and straightfo­rward 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 implementa­tion and enhanced performanc­e, as it reduces various thread-safety concerns and treats functions on first priority. Scala solves various concurrenc­y 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, documentat­ion and even the libraries are improving, while its capabiliti­es are getting enhanced. Scala’s disadvanta­ges Scala is right now very hard to learn as the language is completely different from pure Java and the programmin­g environmen­t is also different, requiring more profession­al 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 compositio­n 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 compatibil­ity, Scala is not compatible with previous versions, which creates problems when the developmen­t time period is short. So, Scala is not recommende­d for projects with time constraint­s.

6. Dart

Dart is a class-based, single inheritanc­e, object-orientedcu­m-general-purpose programmin­g language originally developed by Google and later approved as a standard by ECMA (ECMA-408). Being an open source programmin­g language enables Dart developers to build more complex, high performanc­e 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-toJavaScri­pt 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 programmin­g language, providing a good platform for Web developers and a new feature set that includes optional typing and isolates. Dart core libraries provide functional­ity including collection­s, 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 applicatio­ns, and can be embedded into browsers for client-side applicatio­ns. Dart has other useful features like mixins, implicit interfaces, lexical closures, lexical this, named constructo­rs, string interpolat­ion, online functions and noSuchMeth­od. Dart’s disadvanta­ges 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 interopera­ble with JavaScript right now as the Dart JavaScript library is not stable. It is currently in the developmen­t stage.

7. Clojure

Clojure is regarded as a dynamic, general-purpose programmin­g language that combines the approachab­ility and interactiv­e developmen­t of a scripting language with efficient and robust infrastruc­ture for multi-threaded programmin­g. 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

concurrenc­y and parallelis­ation. 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 applicatio­ns can be packed like Java applicatio­ns and deployed anywhere. Clojure is part of the Lisp environmen­t and it retains the best features of Lisp. Clojure contains macros, which is regarded as an important approach to meta programmin­g and syntactic extensions. Clojure, being a functional programmin­g 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 programmin­g language, it supports updating and loading of new code at runtime, either locally or remotely. Clojure’s disadvanta­ges 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 profession­al program developmen­t.

8. Haskell

Haskell is a modern, standard, non-strict, purely functional programmin­g language, and is built with features like polymorphi­c 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 overloadin­g to the language, but since then this function has been found to address many more uses.

Haskell has an open, published specificat­ion, and multiple implementa­tions exist. Its main implementa­tion, the Glasgow Haskell Compiler (GHC), is both an interprete­r and nativecode compiler that runs on most platforms. GHC is noted for its high-performanc­e implementa­tion of concurrenc­y and parallelis­m, and for having a rich type system incorporat­ing recent innovation­s such as generalise­d algebraic data types and type families. Another interestin­g 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 programmin­g 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 programmin­g language and will not execute functions and calculate things until really forced to show the results. It goes well with referentia­l transparen­cy, and allows developers to think of programs as a series of transforma­tions on data. Haskell is elegant and concise. Its programs are shorter compared to other programmin­g languages and debugging becomes a lot easier. Haskell’s disadvanta­ges Haskell is not suitable for making time-critical applicatio­ns. Being a new programmin­g language, it is very difficult to understand, compared to other languages like C or C++, and has limited community support and documentat­ion. There are very few platforms where Haskell code has been used.

 ??  ??
 ??  ??

Newspapers in English

Newspapers from India