Introduction To Programming Language
This Article Is An Introduction To Types Of Programming Language
Table of contents
Introduction To Programming Language
This blog is in continuation with the previous blog. Here also I am going to share what I have learned from the 5th Video Lecture of the series Data Structure And Algorithm by Kunal Kushwaha
In This Blog, we are going to discuss:
Types Of Programming Language
1. Procedural vs Functional vs Object Oriented Programming Language
2. Static vs Dynamic Language
AND
Static Vs Heap Memory
Types of Programing Langunage
The programming language is generally categorized based on
Functionalities gave by the programming language
Which typed language it is
Functionalities gave by the programming language
Based on this factor, it is divided into:
a) Procedural Programming Language
b) Functional Programming Language
c) Object Oriented Programming Language
a) Procedural Programming Language
The code is written in well-defined steps with the idea of accomplishing a particular task.
This approach is followed by Java and C, so the question might arise if we have heard which java is which is correct, so wait a minute for further discussion.
b) Functional Programing Langunage
The code is written in such a manner that no new variable is created
This approach is generally used in the Case Of Machine Learning because we have to perform similar calculations on all the dataset
This approach is followed by C++ and Python, now still waiting for further discussion for classifying which language is of which type.
c) Object Oriented Programming Language
Here the main idea is about an object
object = code + data
It is generally used in real life, where we have to store students' data which consists of marks which are an integer, roll numbers which are decimals, and names which are strings. Because there is no specific datatype on it.
This approach is followed by Java, C++ and Python also.
So the conclusion is "If one programming language follows one approach it does not means that it cannot follow other approaches"
Static Vs Dynamic Language
Static language means performing type checking at compile time and errors will also show at compile time only, datatype should be mentioned while declaring it, more control. Eg: C, C++, Java
Dynamic Language means performing type checking at runtime and errors shown at runtime. Datatype is not declared during declaration. It is difficult to solve errors during runtime. Eg: Python
Stack And Heap Memory Allocation
While declaring a variable and storing value in it for example
a = 10
a is the reference variable and 10 is the object
The reference variable is stored in Stack memory and the object is stored in Heap memory. There is one memory only but the terms stack and heap are related to memory management.
But the imp concept is if
a = [1,2,3,4,5]
b = a
And if we change
b[0] = 55
then a[0] = 55, because a and b arrays are pointing to the same object
In Java, there is an imp concept of Garbage Collection which means if there is an unreferenced object it will be deleted by the concept of garbage collection in java, for better memory management.