0% found this document useful (0 votes)
0 views

Introduction to Programming Languages(UT)

The document provides an overview of programming languages, defining key concepts such as programs, software, and types of programming languages including low-level, assembly, and high-level languages. It discusses the differences between compilers and interpreters, as well as programming paradigms like Procedure Oriented and Object Oriented Programming, highlighting their advantages and limitations. Additionally, it explains core principles of Object Oriented Programming, including abstraction, encapsulation, polymorphism, and inheritance.

Uploaded by

dssamana1011
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views

Introduction to Programming Languages(UT)

The document provides an overview of programming languages, defining key concepts such as programs, software, and types of programming languages including low-level, assembly, and high-level languages. It discusses the differences between compilers and interpreters, as well as programming paradigms like Procedure Oriented and Object Oriented Programming, highlighting their advantages and limitations. Additionally, it explains core principles of Object Oriented Programming, including abstraction, encapsulation, polymorphism, and inheritance.

Uploaded by

dssamana1011
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Introduction to Programming Languages

Program: -

A computer program is a set of instructions arranged in a step by step


process based on some algorithm to perform a specific task.
Software: -

Software is a collection of programs and data files that are designed to


perform some operations.
Programming Language: -

Programming language is a language developed for writing programs for


a computer in a well-defined way and with a set of rules.
Types of Programming Language: -

Low Level Language:

Low level language is also called as machine level language where


instructions are written in binary code(using 1’s and 0’s). These
instructions will be executed directly.

Assembly Language:

In assembly language, programs are written using symbolic names called


mnemonics for performing operations. An assembler is a software which
converts assembly language program to machine language.

High Level Language:


High level languages use English like keywords, constructs for sequence
and use of variables and constants. Eg:-C, C++, Python.
Translators:-

The programs written in High Level Language (Source Code) are


converted into machine language (Object Code) using compiler or
interpreter for its execution. A compiler reads the whole source code
and translates it into a complete machine code to perform the required
task. An interpreter reads the source code and converts it into code line
by line.
Compiler Interpreter
Scans the entire program and Translates one statement at a
translates as a whole into time
machine language.
It takes time to analyze the source It takes less time to analyze the
code but the overall execution source code but the overall
time is comparatively faster. execution time is slower.
Debugging is comparatively hard Continues translating the program
as it displays all the errors until the first error is met in which
together. case it stops. Hence debugging is
easy.
Programming languages like C, Programming languages like
C++ uses compiler. BASIC, Ruby uses interpreter.

Programming Paradigm
Programming paradigm is an approach to programming and refers to the
style of writing programs. Computer program consists of 2 elements -
code and data. A program can be conceptually organized in two ways
that is around its code or around its data.
The two types of programming languages are: -
❖ Procedure Oriented Programming.
❖ Object Oriented Programming.
Procedure Oriented Programming:-(Organised around process)
Developing a program with process centric approach is called Procedure
Oriented Programming. It uses a list of instructions to tell the computer
what to do step by step. The problem is divided into small programs
called functions(procedures or subroutines). The primary focus stays on
the functions which will be used to accomplish the task. Procedures are
implemented on the data to perform the program hierarchy. A program
written in procedural language contain one or more procedures.
Example:- BASIC, Pascal, Fortran.
Limitations:-
The focus is on processing, the emphasis is on doing things.
➢ Procedural languages are difficult to relate with the real-world
objects.
➢ As the code gets larger, maintenance of the program becomes a
problem.
➢ Most functions share global data leaving data at risk of corruption.
➢ The module in a procedural language is dependent on each other so
that reusability is restricted.
➢ Procedural language code is not flexible to change. Since they are
interlinked the complete program should be changed if there is any
error.
Object Oriented Programming:-( Organised around data)
The object-oriented approach views a problem in terms of objects
involved rather than procedure for doing it. An object can be considered
as a partitioned area of computer memory that stores data and a set of
operations that can access that data.
Advantages: -
➢ Any real-world entity can be modelled using Object Oriented
Programming language.
➢ In Object Oriented Programming, the objects are built up in such a
that it can be used in other programs as well. So, it ensures
reusability.
➢ Programs written using OOP language are simpler to change when
the requirements for the application change.
➢ An object wraps the data and methods and ensures data security.
Principles of Object Oriented Programming: -
1) Abstraction: -
Abstraction refers to the act of representing the essential features of a
system hiding the implementation details to the user. This reduces the
complexity and increases the productivity. For example, in a switchboard
only the essential aspects to operate the switchboard is available to the
user hiding the internal circuitry, connections etc.
2) Encapsulation:
The wrapping of data and function that operate on the data into a single
unit(called class) is known as encapsulation. The only way to access the
data is provided by the functions. These functions are called member
functions or methods in java.
The primary benefit of Encapsulation is
Data Hiding: -
The binding of data and the code that manipulates keeps them safe from
outside interference and misuse. Access to the data is controlled
through an interface.
3) Polymorphism: -
Polymorphism (from Greek meaning “Many Forms) is the concept that
supports the capability of an object of a class to behave differently in
response to a message or action. Polymorphism is the capability of an
interface to do different things based on the data of different type it
accepts and gives the desired output.
Polymorphism is implemented through function overloading and
overriding.
An example from real life : A student in a school is a son/daughter at
home, a player in the game, a customer in the shop,…..
4) Inheritance:-
It is the feature of programming language in which an object can acquire
the properties of another object. The class whose property is acquired is
called super class(Base class or main class or parent class). The class in
which the property of the base class is acquired is called derived
class(Extended class or sub class or child class).
Define class
A class is a template or blueprint used to create multiple instances called
objects that share the common characteristics and behaviour. The
characteristics of an object are represented by its data called attribute
and its behaviour is represented by its associated functions.
Define Object.
Objects are the basic runtime entities in an Object Oriented
Programming language. It represents an entity that can store data and
has its interface through functions. It is also called as an instance of a
class having its own unique identity.

You might also like