Categories
Programming

Top 5 Programming languages to learn in 2020

Programming is one of the most important skill to be mastered in today’s world. If you are new to the field of software engineering, the very first question comes to your mind is β€œWhat’s the best Programming Language to Master ?” that’s an important question to decide your programming career. There are many popular programming languages to learn in 2020. Let’s find out the best 5 programming languages to master.

Disclaimer :

The information provided in this article is my own personal opinion and it’s no mean of degrading any programming languages available today. Feel free to share your opinion in the comment section.

#1 Python

Python

Python is a high-level, general-purpose programming language which has been emerging in 2020 as one of the most frequently used language in the area of data science, Artificial Intelligence and Machine Learning. Created by Guido van Rossum. Python has been a growing programming language ever since the release. Python is largely used in web applications, desktop apps, network servers, machine learning and more. Python is considered to be the fastest language and it’s very easy to learn and it has fewer syntactical constructions than other languages.

Learn Python via Learn to CODE

Data scientists and people from Computer Science have involved in scripting based open-source language. to use it for their ML algorithms, techniques, and Jobs in Data Science.

Python is comparatively easy to learn and code with minimal syntax. It provides a huge array of in-built libraries and frameworks for Data Science which consist of Bokeh, Pandas, Numpy, Scipy, Matplotlib, StatsModel with extension framework for Deep learning include

  • Theano.
  • Lasagne.
  • Blocks.
  • TensorFlow.
  • Keras.
  • MXNet.
  • PyTorch.

Here is an example for a simple Python β€œHello World!” program:

 print ("Hello World!")
Code language: PHP (php)
Learning CurveEasy to Learn
Job opportunityHigher

#2 JS

JS

JavaScript is used as the β€œfrontend” programming language in web apps. It’s most commonly used as a client-side scripting language. If you have mastered any other programming languages before, then learning JavaScript will be much easier for you.

Why JavaScript is Used?

JavaScript is commonly known for its usability for the front-end of the web. Although JS is used for many other areas. Along with the front-end of the web, It’s been widely used for the following areas.

JS powered Mobile Applications

Most of the Mobile Applications are developed using Native Languages which are provided by their OS (Operating System). Although Cross-Platform Development is widely used to get rid of the pain of coding more than once. The mobile JS frameworks like React Native and PhoneGap are created to facilitate Android and iOS development with one single code base. This helps the developers to use JS to build mobile applications easily.

Web Applications

JS is not only limited to front-end development for the interactive web. But the development of new frameworks and libraries are allowing users to develop a lot of back-end programs with JS. which includes interactive web apps and server apps. JS is widely used in previous years and it continues to grow because of its flexibility and speed. These are few of the JavaScript frameworks popularly used by developers today.

Games

Most of the developers are very familiar with JS than other languages. Due to this, It’s possible to develop games via JS. When it comes to the modern browsers They have the capability of rendering WebGL, they can render complex 3D and 2D graphics without the need for third-party applications. These are some of the JS engines to build games.

Here is an example of a simple JavaScript β€œHello World!” program:

<script>
document.getElementById("demo").innerHTML = "Hello JavaScript!";
</script>
Code language: HTML, XML (xml)
Learning CurveIf you are fluent in any other languages. then it’s easy to learn.
Job opportunityHigh

#3 Java

Java is a general-purpose, high-level programming language. It’s intended to let application developers β€œwrite once, run anywhere” (WORA), meaning that compiled Java code can run on all platforms. Java was originally developed by James Gosling at Sun Microsystems (which has since been acquired by Oracle Corporation) and released in 1995.

Java is also widely used in Mobile Application Development, Web Application Development and Creating Desktop Applications.

  1. Desktop Base Applications :Desktop Applications can be created using libraries like Java Swing or JavaFX. They provide components to create text boxes, graphics and buttons for the GUI.
  2. Web Base Applications : Java provides support for web application through Servlets and JSPs.
  3. Mobile Base Applications : Native Android Applications are written in Java. Furthermore, Android Studio provides development tools for developing in Java.

Here is an example of a simple Java β€œHello World!” program:

 class Hello {
 public static void main(String args[]){
     System.out.println("Hello World");
 }
}
Code language: JavaScript (javascript)
Learning CurveIf you are good at OOP. then, It would be easy to learn.
Job opportunityHigher

#4 Kotlin

Kotlin

Kotlin is founded by JetBrains and it has been open source since 2012. It’s an Open Source, General Purpose statically typed pragmatic programming language for the Android and Java Virtual Machine. You can find the Open Source Kotlin Project on GitHub. Kotlin is becoming one of the trending languages in 2020.

Google Announced the support for Kotlin in Android Studio IDE three years back at I/O 2017. Which led the long-time preferred language Java for Android to switch into Kotlin.

The Syntax of Kotlin is minimal, clean and modern. It’s very easy to learn Kotlin because of it’s minimal and easy to understand nature. It’s similar to Apple’s Swift Language.

Here is an example of a simple Kotlin β€œHello World!” program:

println("Hello World!")
Code language: JavaScript (javascript)

The support of Kotlin Multiplatform aims to extend the compatibility to other platforms and it incorporates the developers to reuse the code and their expertise by reducing the tasks to implement twice or thrice.

With the swift growth of its presence among the developers, Kotlin is already in a phase of adapting to Data Science. Some of the following tools and libraries are now supporting data science as listed below.

  • Apache Spark & Apache Zeppelin: Kotlin is used in Spark Java API from both Jupyter and Zeppelin.
  • Jupyter: Now you can use Kotlin kernel for Jupyter notebooks by accessing third-party data science frameworks written in Java and Kotlin.

Learn the basics of Kotlin with Learn to CODE

Learning CurveRelatively easy to learn when comparing to other languages. The syntax is similar to JAVA.
Job opportunityHigh

#5 Swift

Swift is a high-level, Open Source, General-Purpose, Compiled programming language created for iOS Development, OS X, watchOS by Apple. Swift language is based on Objective-C, which was used for NeXTSTEP development. It’s an alternative to the Objective-C language which was the most popular language for building apps for Apple Platform.

Swift is easy to use and with syntactic simplicity to match Python. Which can be used to build apps much faster with less learning curve.

Here is an example of a simple Swift β€œHello World!” program:

import Swift
print("Hello, World!")
Code language: JavaScript (javascript)
Learning CurveSoft Learning Curve.
Job opportunityHigh

That ends the list of top five programming languages in 2020. If you like the article please share with others and drop your ideas and suggestions in the comment section.

Categories
JS

JSON in JavaScript

This tutorial is created to provide you with an introduction to working with JSON (JavaScript Object Notation) in JavaScript. JSON is mostly used with AJAX (Asynchronous JavaScript) and XML. It’s a lightweight format to serialize and transmit structured data over a network connection.

JSON for JavaScript is generally used in some of the following scenarios :

  • Data Storage (Storing Data).
  • Data Analysis
  • Data transfer from user / server to relevant medium.
Json
  • Keys and Values

JSON consist of two primary parts as key and value. Together they make a key/value pair.

  1. Key : It’s always a string enclosed in quotation marks.
  2. Value : It can be a string, number, boolean expression, array, or object.
  3. Key/Value Pair : It follows a specific syntax, with the key followed by a colon followed by the value. Key/value pairs are comma separated.

Syntax & Structure

{ "key": "value" }
Code language: JSON / JSON with Comments (json)

JSON array consist of many data types. Here is an example of an array with different data type:

[
    "Bishrul",            // string
    {                     // object
      "id": "01",
      "name": "BH"
    },
    True,                // Boolean
    5.7                  // number
]
Code language: JSON / JSON with Comments (json)

The following data types can be used with JSON:

  • Strings (in double quotes)
  • Arrays
  • Numbers
  • Objects
  • Booleans (true or false)
  • null
  • Working with JSON in JavaScript

Here’s the JSON data we’ll use in this example:

{
  "details" : [
    {
      "name" : "Bishrul Haq",
      "born" : "1994"
      },
    {
      "name" : "Bill Gates",
      "born" : "1955"
      },
    {
      "name" : "Dennis Ritchie",
      "born" : "1941"
      },
  ]
}
Code language: JSON / JSON with Comments (json)

In this step, We’ll use JavaScript to take the above JSON data and output it to the HTML document as shown below :

<!doctype html>
<title>JSON Sample | BH</title>
<script>
    function displaydetails() {
        // JSON Details
        let data =
            {
                "details": [
                    {
                        "name": "Bishrul Haq",
                        "born": "1994"
                    },
                    {
                        "name": "Bill Gates",
                        "born": "1955"
                    },
                    {
                        "name": "Dennis Ritchie",
                        "born": "1941"
                    },
                ]
            }

        let output = "<h1>Detaills</h1>";
        output += "<ul>";

        // Loop through the artists
        for (let i in data.details) {
            output += "<li>" + data.details[i].name + " (Born: " + data.details[i].born + ")</li>";
        }

        output += "</ul>";
        document.getElementById("detailList").innerHTML = output;
    }

    window.onload = displaydetails;
</script>

<!-- output -->
<div id="detailList"></div>
Code language: HTML, XML (xml)
  • Convert a JavaScript object into a String

The JSON.stringify() function converts JS object into a string. Strings are lightweight and it’s faster to use between client to server.

Let’s assign the JSON.stringify() method to following variable output.

<!doctype html>
<title>JSON Sample | BH</title>
<script>
    function displaydetails() {
        // JSON Details
        let data =
            {
                "details": [
                    {
                        "name": "Bishrul Haq",
                        "born": "1994"
                    },
                    {
                        "name": "Bill Gates",
                        "born": "1955"
                    },
                    {
                        "name": "Dennis Ritchie",
                        "born": "1941"
                    },
                ]
            }

        let output = JSON.stringify(data);
        document.getElementById("detailList").innerHTML = output;
    }

    window.onload = displaydetails;
</script>

<!-- output -->
<div id="detailList"></div>
Code language: HTML, XML (xml)

To convert a JSON String back into a function, We use JSON.parse() function.It helps to access the data like a regular JavaScript object.

let output = JSON.parse(output);
Code language: JavaScript (javascript)
  • Nested JSON Objects

In this Step, We’ll use a JSON file with Deeper Nesting. Not only does this file have details about users, but each user has a number of skills. So we need to loop through the users, and also loop through each users’ skills.

<!doctype html>
<title>JSON Example | BH</title>
<script>
    function displayUsers() {
        // JSON data
        let data =
            {
                "users": [
                    {
                        "name": "Jhon",
                        "born": "1994",
                        "skills": [
                            {
                                "skillname": "Java Programming",
                                "experience": "2 Years"
                            },
                            {
                                "skillname": "Laravel",
                                "experience": "1 Years"
                            },
                            {
                                "skillname": "React Native",
                                "experience": "3 Years"
                            }
                        ]
                    }, {
                        "name": "Bishrul Haq",
                        "born": "1994",
                        "skills": [
                            {
                                "skillname": "Android Development",
                                "experience": "2 Years"
                            },
                            {
                                "skillname": "Angular JS",
                                "experience": "1 Years"
                            }
                        ]
                    },
                ]
            };

        let output = "<h1>Users</h1>";

        // Loop through the users
        for (let i in data.users) {
            output += "<h2>" + data.users[i].name + "</h2>";
            output += "<ul>";

            // Loop through the user for their skills
            for (let j in data.users[i].skills) {
                output += "<li>" + data.users[i].skills[j].skillname;
            }
            output += "</ul>";
        }
        document.getElementById("usersList").innerHTML = output;
    }

    window.onload = displayUsers;
</script>

<!-- Output -->
<div id="usersList"></div>
Code language: HTML, XML (xml)

Hope this tutorial helped you! Feel free to drop your opinion at the comment section.