Introduction to programming languages

Introduction to programming languages

Photo by Nicole Wolf on Unsplash

Hello there! I'm Rani Hirani, and I'm excited to share my very first technical blog with you. I've recently started my third year of B.Tech, and I began my programming journey shortly before my first semester. Right now, I'm exploring the big world of computer science and engineering, with a focus on DSA (Data Structures and Algorithms) and web development.

Python

Python is the initial programming language I ventured into. It stands as one of the most widely embraced programming languages, acclaimed for its straightforward syntax, robust web frameworks, and sophisticated attributes extensively applied in artificial intelligence and machine learning domains. When embarking upon any programming language, a fundamental step post installing the necessary prerequisites is familiarizing oneself with its keywords. Python 3.11 comprises a total of 35 keywords. Below is a code snippet designed to provide you with an exhaustive list of these keywords in the Python language.

import keyword
print(keyword.kwlist)
print("\n Total number of keywords:", len(keyword.kwlist))

C

C is one of the first popular programming languages and it was the first programming language that I explored in depth because it was a major part of my college's syllabus. It is a low-level programming language and its syntax is not as easy as Python. However, it is not used so much in the modern tech world. Yet, many colleges and schools prefer teaching C to the students for its efficiency, portability, well-define structure and rich standard library (for file handling, memory management and string management)

Here is a code snippet that shows how the basic datatypes of C are used.

#include <stdio.h>
int main() {
    int age = 25;
    char grade = 'A';
    float height = 5.8;
    double weight = 70.5;
    printf("Age: %d\n", age);
    printf("Grade: %c\n", grade);
    printf("Height: %.2f\n", height);
    printf("Weight: %.2lf\n", weight);
    return 0;
}

C++

C++ is an extension of the C programming language that adds object-oriented features and more advanced programming paradigms. It was designed to combine the efficiency and low-level capabilities of C with high-level abstractions for better code organization and reusability. C++ is commonly used in systems programming, game development, and performance-critical applications.

#include <iostream>
using namespace std;
int main() {
    int age = 25;
    char grade = 'A';
    float height = 5.8;
    double weight = 70.5;
    cout << "Age: " << age << endl;
    cout << "Grade: " << grade << endl;
    cout << "Height: " << fixed << height << endl;
    cout << "Weight: " << fixed << weight << endl;
    return 0;
}

As you can see the syntax of C and C++ is quite similar.

JAVA

Java is renowned for its "write once, run anywhere" approach, facilitated by the Java Development Kit (JDK), which includes essential tools for code compilation and execution. Key features of Java include its object-oriented nature, automatic memory management, and robust exception handling. Java's multi-threading capabilities enable concurrent execution, enhancing performance in applications by allowing them to handle multiple tasks simultaneously.

The syntax of Java is a bit detailed and explicit as compared to Python, C and C++. Let's have a look at an example.

public class Main {
    public static void main(String[] args) {
        int age = 25;
        char grade = 'A';
        float height = 5.8f;
        double weight = 70.5;
        System.out.println("Age: " + age);
        System.out.println("Grade: " + grade);
        System.out.println("Height: " + height);
        System.out.println("Weight: " + weight);
    }
}

JavaScript

JavaScript is the most used programming language in the world. JS is a high-level scripting language mainly used for web development to add interactivity and dynamic behavior to websites. It's executed in web browsers and allows for client-side scripting. With the rise of Node.js, JavaScript can also be used on the server side for building scalable and efficient network applications.