Programming Languages
Programming Languages
As the involvement of computer, automation and robotics growing in our daily life,
programming becomes highly required to control all of them. To control all of these
systems and machines and take desired output by them skilled programming languages
is necessary.
However, the area of programming language becomes how much wide but it will be
under one of the two categories of programming languages (i.e., Low-level language
and High-level language). In the early days of computing, language design was heavily
influenced by the decision to use compiling or interpreting as a mode of execution.
Depending on tools such as compilation and interpretation in order to get our written
code into a form that the computer can execute. Code can either be executed natively
through the operating system after it is converted to machine code (via compilation) or
can be evaluated line by line through another program which handles executing the code
instead of the operating system itself (via interpretation).
Programming languages are basically classified into two main categories – Low-level
language and High-level language. Every programming language belongs to one of
these categories and sub-category.
2.1. Low level languages
Low-level languages are used to write programs that relate to the specific architecture
and hardware of a particular type of computer. They are closer to the native language
of a computer (binary), making them harder for programmers to understand.
Programs written in low-level languages are fast and memory efficient. However, it is
nightmare for programmers to write, debug and maintain low-level programs. They are
mostly used to develop operating systems, device drivers, databases and applications
that require direct hardware access.
Low level languages are further classified in two more categories – Machine language
and Assembly language.
❖ Machine language: Machine language is closest language to the hardware. It
consists set of instructions that are executed directly by the computer. These instructions
are a sequence of binary bits. Each instruction performs a very specific and small task.
Instructions written in machine language are machine dependent and varies from
computer to computer.
❖ Assembly language: Assembly language is an improvement over machine
language. Similar to machine language, assembly language also interacts directly with
the hardware. Instead of using a raw binary sequence to represent an instruction set,
assembly language uses mnemonics. Assembly language uses a special program
called assembler. The assembler translates mnemonics to specific machine code.
e.g. MOV A, B > Move the contents of Memory Register A to Memory Register B
ADD A, B >>>>> Add the contents of register A to the contents of register B
The main goal of abstraction in a high level language is to handle complexity by hiding
unnecessary details from the user. That enables the user to implement more complex logic on
top of the provided abstraction without understanding or even thinking about all the hidden
complexity.
We can also classify high-level language several other categories based on the
programming paradigm.
2.3. Differences between low level and high level programming language
9 They are generally used for developing They are used to develop a variety of
system software’s (Operating systems) and applications such as – desktop
embedded applications. applications, websites, mobile software’s
etc.
Programming – Errors
Errors are the mistakes or faults in the program that causes our program to behave
unexpectedly and it is no doubt that the well versed and experienced programmers also
makes mistakes. Programming error are generally known as Bugs and the process to
remove bugs from program is called as Debug/Debugging. There are basically three
types of error: Compilation error or Syntax error, Runtime error or exception and
Logical error.
1. Compilation error
Compilation errors are the most common error occurred due to typing mistakes or if
you don't follow the proper syntax of the specific programming language. These error
are thrown by the compilers and will prevent your program from running. These errors
are most common to beginners. It is also called as Compile time error or Syntax error.
These errors are easy to debug.
Example: Typing int as Int
2. Runtime error
Run Time errors (exception) are generated when the program is running and leads to
the abnormal behavior or termination of the program. The general cause of Run time
errors is because your program is trying to perform an operation that is impossible to
carry out.
Example: Dividing any number by zero, Accessing any file that doesn't exist etc are
common examples of such error.
3. Logical error
Logical errors will cause your program to perform undesired operations which you
didn't intended your program to perform. These errors occur generally due to improper
logic used in program. These types of errors are difficult to debug.
Example: Multiplying an uninitialized* integer value with some other value will result
in undesired output.
*unitialized means object has not been initialized with a known value.