Professional Documents
Culture Documents
A programming language defines a set of instructions that are compiled together to perform a specific task by
the CPU (Central Processing Unit). The programming language mainly refers to high-level languages such as C,
C++, Pascal, Ada, COBOL, etc.
Each programming language contains a unique set of keywords and syntax, which are used to create a set of
instructions. Thousands of programming languages have been developed till now, but each language has its
specific purpose. These languages vary in the level of abstraction they provide from the hardware. Some
programming languages provide less or no abstraction while some provide higher abstraction. Based on the
levels of abstraction, they can be classified into two categories:
o Low-level language
o High-level language
The image which is given below describes the abstraction level from hardware. As we can observe from the
below image that the machine language provides no abstraction, assembly language provides less abstraction
whereas high-level language provides a higher level of abstraction.
I.Low-level language
The low-level language is a programming language that provides no abstraction from the hardware, and it is
represented in 0 or 1 forms, which are the machine instructions. The languages that come under this category are the
Machine level language and Assembly language.
1.Machine-level language
The machine-level language is a language that consists of a set of instructions that are in the binary form 0 or 1. As
we know that computers can understand only machine instructions, which are in binary digits, i.e., 0 and 1, so the
instructions given to the computer can be only in binary codes. Creating a program in a machine-level language is a
very difficult task as it is not easy for the programmers to write the program in machine instructions. It is error-prone
as it is not easy to understand, and its maintenance is also very high. A machine-level language is not portable as
each computer has its machine instructions, so if we write a program in one computer will no longer be valid in
another computer.
The different processor architectures use different machine codes, for example, a PowerPC processor contains RISC
architecture, which requires different code than intel x86 processor, which has a CISC architecture.
2.Assembly Language
The assembly language contains some human-readable commands such as mov, add, sub, etc. The problems which
we were facing in machine-level language are reduced to some extent by using an extended form of machine-level
language known as assembly language. Since assembly language instructions are written in English words like mov,
add, sub, so it is easier to write and understand.
As we know that computers can only understand the machine-level instructions, so we require a translator that
converts the assembly code into machine code. The translator used for translating the code is known as an
assembler.
The assembly code is not faster than machine code because the assembly language comes above the machine
language in the hierarchy, so it means that assembly language has some abstraction from the hardware while
machine language has zero abstraction.
The machine-level language comes at the lowest The assembly language comes above the machine language
level in the hierarchy, so it has zero abstraction means that it has less abstraction level from the hardware.
level from the hardware.
The machine-level language is written in binary The assembly language is written in simple English
digits, i.e., 0 and 1. language, so it is easily understandable by the users.
It does not require any translator as the machine In assembly language, the assembler is used to convert the
code is directly executed by the computer. assembly code into machine code.
The high-level language is a programming language that allows a programmer to write the programs which are
independent of a particular type of computer. The high-level languages are considered as high-level because they are
closer to human languages than machine-level languages.
When writing a program in a high-level language, then the whole attention needs to be paid to the logic of the
problem.
o The high-level language is easy to read, write, and maintain as it is written in English like words.
o The high-level languages are designed to overcome the limitation of low-level language, i.e., portability.
The high-level language is portable; i.e., these languages are machine-independent.
The following are the differences between low-level language and high-level language:
It requires the assembler to convert the It requires the compiler to convert the high-level language
assembly code into machine code. instructions into machine code.
The machine code cannot run on all The high-level code can run all the platforms, so it is a
machines, so it is not a portable portable language.
language.
Debugging and maintenance are not Debugging and maintenance are easier in a high-level
easier in a low-level language. language.
Imperative programming (from Latin imperare = command) is the oldest programming paradigm. A program based
on this paradigm is made up of a clearly-defined sequence of instructions to a computer.
Therefore, the source code for imperative languages is a series of commands, which specify what the computer has
to do – and when – in order to achieve a desired result. Values used in variables are changed at program runtime. To
control the commands, control structures such as loops or branches are integrated into the code.
Imperative programming languages are very specific, and operation is system-oriented. On the one hand, the code is
easy to understand; on the other hand, many lines of source text are required to describe what can be achieved with
a fraction of the commands using declarative programming languages.
The different imperative programming languages can, in turn, be assigned to three further subordinate programming
styles – structured, procedural, and modular.
The structured programming style extends the basic imperative principle with specific control
structures: sequences, selection, and iteration. This approach is based on a desire to limit or completely avoid jump
statements that make imperatively designed code unnecessarily complicated.
The procedural approach divides the task a program is supposed to perform into smaller sub-tasks, which are
individually described in the code. This results in programming modules which can also be used in other programs.
The modular programming model goes one step further by designing, developing, and testing the individual
program components independently of one another. The individual modules are then combined to create the actual
software.
Many programming languages based on the imperative programming paradigm are in use today.
On the one hand, this is because the approach is the original form of programming. On the other hand, despite the
existence of alternative models, the imperative paradigm still has some practical advantages.
The languages are relatively easy to learn, as the code can be read like a step-by-step instruction. Therefore,
programmers normally learn an imperative language first as part of their training.
Easy legibility is a crucial factor in day-to-day operations. Ultimately, maintenance and optimization of applications
should not be linked to a specific person; different employees should be able to do it without too much difficulty
even if they haven’t written the code from scratch themselves.
One disadvantage of procedural programming is that for more complex problems to be solved, the amount of code
quickly starts to grow. It remains easy to read but becomes confusing due to its volume.
Execution is not clearly delineated from the programming as it is in the declarative style, therefore, subsequent
interventions can produce unwanted errors. Extensions are also more difficult to implement in pure imperative code
– unlike in the declarative paradigm, where there are methods that can be used to add them separately.
Procedural (imperative) programming implies specifying the steps that the programs should take to reach to an
intended state. A procedure is a group of statements that can be referenced through a procedure call. Procedures
help in the reuse of code. Procedural programming makes the programs structured and easily traceable for program
flow.
1.C:-The C programming language was developed in 1972 by Dennis Ritchie and Brian Kernighan at the AT&T
Corporation for programming computer operating systems. Its capacity to structure data and programs through
the composition of smaller units is comparable to that of ALGOL. It uses a compact notation and provides the
programmer with the ability to operate with the addresses of data as well as with their values. This ability is
important in systems programming, and C shares with assembly language the power to exploit all the features of a
computer’s internal architecture. C, along with its descendant C++, remains one of the most common languages.
2.FORTRAN:-The first important algorithmic language was FORTRAN (formula translation), designed in 1957
by an IBM team led by John Backus. It was intended for scientific computations with real numbers and collections
of them organized as one- or multidimensional arrays. Its control structures included conditional IF statements,
repetitive loops (so-called DO loops), and a GOTO statement that allowed nonsequential execution of program code.
FORTRAN made it convenient to have subprograms for common mathematical operations, and built libraries of
them.FORTRAN was also designed to translate into efficient machine language. It was immediately successful and
continues to evolve.
3.ALGOL (algorithmic language) was designed by a committee of American and European computer scientists
during 1958–60 for publishing algorithms, as well as for doing computations. Like LISP (described in the next
section), ALGOL had recursive subprograms—procedures that could invoke themselves to solve a problem by
reducing it to a smaller problem of the same kind. ALGOL introduced block structure, in which a program is
composed of blocks that might contain both data and instructions and have the same structure as an entire program.
Block structure became a powerful tool for building large programs out of small components.
4.COBOL:-COBOL (common business oriented language) has been heavily used by businesses since its
inception in 1959. A committee of computer manufacturers and users and U.S. government organizations
established CODASYL (Committee on Data Systems and Languages) to develop and oversee the language standard
in order to ensure its portability across diverse systems.
COBOL uses an English-like notation—novel when introduced. Business computations organize and manipulate
large quantities of data, and COBOL introduced the record data structure for such tasks. A record
clusters heterogeneous data such as a name, ID number, age, and address into a single unit. This contrasts with
scientific languages, in which homogeneous arrays of numbers are common. Records are an important example of
“chunking” data into a single object, and they appear in
5.BASIC:-BASIC (beginner’s all-purpose symbolic instruction code) was designed at Dartmouth College in
the mid-1960s by John Kemeny and Thomas Kurtz. It was intended to be easy to learn by novices,
particularly non-computer science majors, and to run well on a time-sharing computer with many users. It
had simple data structures and notation and it was interpreted: a BASIC program was translated line-by-line
and executed as it was translated, which made it easy to locate programming errors.
Its small size and simplicity also made BASIC a popular language for early personal computers. Its recent forms
have adopted many of the data and control structures of other contemporary languages, which makes it more
powerful but less convenient for beginners.
6.Pascal:-About 1970 Niklaus Wirth of Switzerland designed Pascal to teach structured programming, which
emphasized the orderly use of conditional and loop control structures without GOTO statements. Although Pascal
resembled ALGOL in notation, it provided the ability to define data types with which to organize complex
information, a feature beyond the capabilities of ALGOL as well as FORTRAN and COBOL. User-defined data
types allowed the programmer to introduce names for complex data, which the language translator could then check
for correct usage before running a program.
During the late 1970s and ’80s, Pascal was one of the most widely used languages for programming instruction. It
was available on nearly all computers, and, because of its familiarity, clarity, and security, it was used for
production software as well as for education.
7.Ada:-Ada was named for Augusta Ada King, countess of Lovelace, who was an assistant to the 19th-century
English inventor Charles Babbage, and is sometimes called the first computer programmer. Ada, the language, was
developed in the early 1980s for the U.S. Department of Defense for large-scale programming. It combined Pascal-
like notation with the ability to package operations and data into independent modules. Its first form, Ada 83, was
not fully object-oriented, but the subsequent Ada 95 provided objects and the ability to construct hierarchies of
them. While no longer mandated for use in work for the Department of Defense, Ada remains an effective language
for engineering large programs.
Object-oriented programming began with the Simula language (1967), which added information hiding to ALGOL.
Another influential object-oriented language was Smalltalk (1980), in which a program was a set of objects that
interacted by sending messages to one another.
1.C++:-The C++ language, developed by Bjarne Stroustrup at AT&T in the mid-1980s, extended C by adding
objects to it while preserving the efficiency of C programs. It has been one of the most important languages for both
education and industrial programming. Large parts of many operating systems, such as the Microsoft Corporation’s
Windows 98, were written in C++.
2.Java:-In the early 1990s, Java was designed by Sun Microsystems, Inc., as a programming language for
the World Wide Web (WWW). Although it resembled C++ in appearance, it was fully object-oriented. In particular,
Java dispensed with lower-level features, including the ability to manipulate data addresses, a capability that is
neither desirable nor useful in programs for distributed systems. In order to be portable, Java programs are translated
by a Java Virtual Machine specific to each computer platform, which then executes the Java program. In addition to
adding interactive capabilities to the Internet through Web “applets,” Java has been widely used for programming
small and portable devices, such as mobile telephones.
3.Visual Basic:-Visual Basic was developed by Microsoft to extend the capabilities of BASIC by adding objects
and “event-driven” programming: buttons, menus, and other elements of graphical user interfaces (GUIs). Visual
Basic can also be used within other Microsoft software to program small routines.
Declarative languages, also called nonprocedural or very high level, are programming languages in which (ideally) a
program specifies what is to be done rather than how to do it. In such languages there is less difference between the
specification of a program and its implementation than in the procedural languages described so far. The two
common kinds of declarative languages are logic and functional languages.
Logic programming languages, of which PROLOG (programming in logic) is the best known, state a program as a
set of logical relations (e.g., a grandparent is the parent of a parent of someone). Such languages are similar to
the SQL database language. A program is executed by an “inference engine” that answers a query by searching these
relations systematically to make inferences that will answer a query. PROLOG has been used extensively in natural
language processing and other AI programs.
1.Functional language
Functional programming languages define every computation as a mathematical evaluation. They focus on the
application of functions. Many of the functional programming languages are bound to mathematical
1.Charity:-It is a purely functional, not-Turing-complete language, which means that all its programs are guaranteed
to terminate. Charity was designed at the University of Calgary, a public University in Canada.
2.Clean:-It is a purely functional programming language that supports portability across platforms, automatic garbage
collection, multiple data structures and referential transparency, which means that a function with a given input will
always give the same output.
3.Curry:-It is a functional logic programming language that implements functional and logic programming as
well as constraint programming, wherein the relationships between variables are stated in the form of
constraints.
4.Erlang:-It is a concurrent programming language that includes a sequential subset, which supports functional
programming. Ericsson developed Erlang as a distributed soft real-time and fault-tolerant language and released it as
an open source computer programming language in 1998. It is one of the most popularly used functional
programming languages.
5.F#:-It targets the .NET Framework and supports both functional as well as imperative object-oriented
programming. Don Syme at the Microsoft Research developed this language, which is now being developed at the
Microsoft Developer Division. F Sharp, as it is called, will soon be integrated into the .NET Framework and Visual
Studio.
6.Haskell:-Named in honor of Haskell Curry, a logician, Haskell is a standardized purely functional language. It
supports pattern matching, definable operators, single assignment, algebraic data types and recursive functions.
7.Joy:-It is a purely functional language that is based on a composition of functions. Manfred von Thun of La Trobe
University in Australia developed this language.
8.Kite:-It came up in 2006 with a feature set consisting of a blend of object-oriented and functional programming
features. It is a fast-running language. Interestingly, Kite uses the pipe character for functional calls rather than using
the period or arrow characters in other languages.
9.ML:-Robin Milner and his associates at the University of Edinburgh came up with ML in the 1970s. It is an impure
functional language as it supports imperative programming. Standard ML is popular among compiler writers and is a
modular, functional programming language. Alice is a dialect of Standard ML, which supports distributed computing,
multithreading and constraint programming. Caml is another dialect of ML and is a statically typed language that
supports automatic memory management. Ocaml is the implementation of Caml that is developed as an open source
project. JoCaml is a version of Ocaml based on join-calculus.
Logic programming is a type of programming paradigm which is largely based on formal logic. Any program written
in a logic programming language is a set of sentences in logical form, expressing facts and rules about some problem
domain. (Wikipedia)
2.Fril:-Fril language was designed by Trevor Martin and Jim Baldwin at the University of Bristol in the 1980s. It is
for first-order predicate calculus. It supports fuzzy sets and metaprogramming and is based on the Prolog syntax.
4.Leda:-This computer programming language is a blend of logic-based, functional, imperative and object-oriented
programming. It is thus one of the multi-paradigm languages.
5.Oz:-It is a multi-paradigm language that supports functional, logic-based, imperative and object-oriented
programming. Oz also supports concurrent and distributed programming. Constraint programming that is supported
by Oz is one of the strengths of this language.
6.Poplog:-It is a powerful multi-paradigm software development environment whose core language is POP-11. All
the languages of this development environment share a common language editor and are incrementally compiled
programming languages.
7.Prolog:-It is a general-purpose programming language that supports logic programming and is often linked with
artificial intelligence and computational linguistics. The language is declarative and the program logic is expressed in
the form of relations. Mercury is a functional logic programming language that is based on Prolog. Strawberry Prolog
is a dialect of Prolog, which is supposed to be easy to use. Visual Prolog is a strongly typed extension of Prolog that
supports object-oriented programming. It is a compiled logic-based programming language.
8.ROOP:-It is a multi-paradigm language that is built on C++. It is intended to be used with artificial intelligence
systems. Its features offer a blend of procedural, logic-based, and object-oriented programming.
Assemblers are further divided into two types: One Pass Assembler and Two Pass Assembler. One
pass assembler is the assembler which assigns the memory addresses to the variables and translates the source code
into machine code in the first pass simultaneously. A Two Pass Assembler is the assembler which reads the source
2.Compiler: It is a program which translates a high level language program into a machine language program.
A compiler is more intelligent than an assembler. It checks all kinds of limits, ranges, errors etc. But its program run
time is more and occupies a larger part of the memory. It has slow speed. Because a compiler goes through the entire
program and then translates the entire program into machine codes. If a compiler runs on a computer and produces
the machine codes for the same computer then it is known as a self compiler or resident compiler. On the other hand,
if a compiler runs on a computer and produces the machine codes for other computer then it is known as a cross
compiler.
3.Interpreter: An interpreter is a program which translates statements of a program into machine code. It
translates only one statement of the program at a time. It reads only one statement of program, translates it and
executes it. Then it reads the next statement of the program again translates it and executes it. In this way it proceeds
further till all the statements are translated and executed. On the other hand, a compiler goes through the entire
program and then translates the entire program into machine codes. A compiler is 5 to 25 times faster than an
interpreter.
By the compiler, the machine codes are saved permanently for future reference. On the other hand,
the machine codes produced by interpreter are not saved. An interpreter is a small program as compared to compiler.
It occupies less memory space, so it can be used in a smaller system which has limited memory space.
4.Linker: In high level languages, some built in header files or libraries are stored. These libraries are
predefined and these contain basic functions which are essential for executing the program. These functions are
linked to the libraries by a program called Linker. If linker does not find a library of a function then it informs to
compiler and then compiler generates an error. The compiler automatically invokes the linker as the last step in
compiling a program.
Not built in libraries, it also links the user defined functions to the user defined libraries. Usually a
longer program is divided into smaller subprograms called modules. And these modules must be combined to
execute the program. The process of combining the modules is done by the linker.
5.Loader: Loader is a program that loads machine codes of a program into the system memory. In Computing,
a loader is the part of an Operating System that is responsible for loading programs. It is one of the essential stages
in the process of starting a program. Because it places programs into memory and prepares them for execution.
Loading a program involves reading the contents of executable file into memory. Once loading is complete, the
operating system starts the program by passing control to the loaded program code. All operating systems that
support program loading have loaders. In many operating systems the loader is permanently resident in memory.
6.Header Files : The files that tell the compiler how to call some functionality (without knowing how the
functionality actually works) are called header files. They contain the function prototypes. They also contain Data
types and constants used with the libraries. We use #include to use these header files in programs. These files end
with .h extension.
7.Library : Library is the place where the actual functionality is implemented i.e. they contain function body.
Libraries have mainly two categories :
Static
Shared or Dynamic
Static : Static libraries contains object code linked with an end user application and then they become the part of the
executable. These libraries are specifically used at compile time which means the library should be present in correct
location when user wants to compile his/her C or C++ program. In windows they end with .lib extension and
with .a for MacOS.
Shared or Dynamic : These libraries are only required at run-time i.e, user can compile his/her code without using
these libraries. In short these libraries are linked against at compile time to resolve undefined references and then its
distributed to the application so that application can load it at run time. For example, when we open our game
Header files are human readable.Since they are in the form Library files are non human readable.Since they are in the
of source code. form of machine code.
Header files in our program are included by using a
command #include which is internally handle by pre- Library files in our program are included in last stage by
processor. special software called as linker.
Namespaces
A namespace is designed for providing a way to keep one set of names separate from another.
The class names declared in one namespace does not conflict with the same class names
declared in another.
Defining a Namespace
A namespace definition begins with the keyword namespace followed by the namespace name
as follows −
namespace namespace_name {
// code declarations
}
To call the namespace-enabled version of either function or variable, prepend the namespace
name as follows −
namespace_name.item_name;
The following program demonstrates use of namespaces −
using System;
namespace first_space {
class namespace_cl {
public void func() {
System virtual machines exist as fully-functional operating systems and are typically created as a substitute for
using a physical machine. In this way multiple environments can run on the same machine simultaneously. But, that
doesn’t sound like our beloved CLR and JVM.
The Common Language Runtime (CLR) and Java Virtual Machine (JVM) are both process virtual machines. That
means that rather than executing an entire operating system, they are specifically designed to run a process or
program without being dependent on the platform environment.
The CLR and JVM are both virtual machines and they both perform platform-independent operations, namely,
executing compiled source code. Essentially, these virtual machines both act as an intermediary step between the
programmer’s source code and the system’s machine code, allowing for greater usability by various types of
processors. In the image below, you can see how the high-level functions of the two are practically identical.
A diagram that demonstrates the architecture of Common Language Runtime is given as follows:
There are multiple components in the architecture of Common Language Runtime. Details about
these are given as follows:
Base Class Library Support: The Common Language Runtime provides support for the base class
library. The BCL contains multiple libraries that provide various features such
as Collections, I/O, XML, DataType definitions, etc. for the multiple .NET programming languages.
Thread Support: The CLR provides thread support for managing the parallel execution of multiple
threads. The System.Threading class is used as the base class for this.
COM Marshaller: Communication with the COM (Component Object Model) component in the
.NET application is provided using the COM marshaller. This provides the COM interoperability
support.
Type Checker: Type safety is provided by the type checker by using the Common Type System
(CTS) and the Common Language Specification (CLS) that are provided in the CLR to verify the
types that are used in an application.
JVM (Java Virtual Machine) is an abstract machine. It is a specification that provides runtime environment in which
java bytecode can be executed.
JVMs are available for many hardware and software platforms (i.e. JVM is platform dependent).
What is JVM
It is:
1. A specification where working of Java Virtual Machine is specified. But implementation provider is
independent to choose the algorithm. Its implementation has been provided by Oracle and other companies.
2. An implementation Its implementation is known as JRE (Java Runtime Environment).
3. Runtime Instance Whenever you write java command on the command prompt to run the java class, an
instance of JVM is created.
JVM Architecture
Let's understand the internal architecture of JVM. It contains classloader, memory area, execution engine etc.
1. Bootstrap ClassLoader: This is the first classloader which is the super class of Extension classloader. It
loads the rt.jar file which contains all class files of Java Standard Edition like java.lang package classes,
java.net package classes, java.util package classes, java.io package classes, java.sql package classes etc.
2. Extension ClassLoader: This is the child classloader of Bootstrap and parent classloader of System
classloader. It loades the jar files located inside $JAVA_HOME/jre/lib/ext directory.
3. System/Application ClassLoader: This is the child classloader of Extension classloader. It loads the
classfiles from classpath. By default, classpath is set to current directory. You can change the classpath
using "-cp" or "-classpath" switch. It is also known as Application classloader.
Output:
sun.misc.Launcher$AppClassLoader@4e0e2f2a
null
These are the internal classloaders provided by Java. If you want to create your own classloader, you need to extend
the ClassLoader class.
3) Heap
It is the runtime data area in which objects are allocated.
4) Stack
Java Stack stores frames. It holds local variables and partial results, and plays a part in method invocation and
return.
Each thread has a private JVM stack, created at the same time as thread.
A new frame is created each time a method is invoked. A frame is destroyed when its method invocation completes.
7) Execution Engine
It contains:
1. A virtual processor
2. Interpreter: Read bytecode stream then execute the instructions.
3. Just-In-Time(JIT) compiler: It is used to improve the performance. JIT compiles parts of the byte code
that have similar functionality at the same time, and hence reduces the amount of time needed for
compilation. Here, the term "compiler" refers to a translator from the instruction set of a Java virtual
machine (JVM) to the instruction set of a specific CPU.
There are many different technical and business use cases for IDEs, which likewise
means there are many proprietary and open source IDE options on the market.
Typically, the most important differentiating characteristics between IDEs are:
The number of supported languages: Some IDEs are dedicated to one language, and
so are a better match for a specific programming paradigm. IntelliJ, for instance, is
known primarily as a Java IDE. Other IDEs have a broad array of supported
languages all in one, like the Eclipse IDE which supports Java, XML, Python, and
others.
Supported operating system(s): A developer’s operating system will constrain
which IDEs are viable (unless an IDE is cloud-based), and if the application being
developed is intended for an end user with a specific operating system (like Android
or iOS), this may be an additional constraint.
Automation features: Even though most IDEs include the 3 key features of a text
editor, build automation, and debugger, many include support for additional features
like refactoring, code search, and continuous integration and continuous
deployment (CI/CD) tools.
Impact on system performance: An IDE’s memory footprint may be important to
consider if a developer wants to run other memory-intensive applications
concurrently.
Plugins and extensions: Some IDEs include the ability to customize workflows to
match a developer’s needs and preferences.