COMPUTING AND PROGRAMMING
Unit 2: Programming Paradigms
Unstructured Programming, Structured Programming,
Object Oriented Programming, Characteristics of a Good
Program. Types of Programming Languages; Machine
Language, Assembly Language; Procedural Language,
Natural Programming Language, Visual Programming
Language, Graphical Programming Language, Scripting
Language, Hypertext Markup Language, Extensible Markup
Language. Program Translation: Program
Translation Hierarchy; Compiler, Interpreter, Linker, Loader;
Features of a good Programming Language.
Program – Set of instruction
Programming - is the process of writing an algorithm
into a sequence of computer instructions.
Structured Programming is a type of programming that
generally converts large or complex programs into
more manageable and small pieces of code.
These small pieces of codes are usually known
as functions or modules or sub-programs of large
It is known as modular programming and minimizes
the chances of function affecting another.
C program to demonstrate the
// structured programming
// Function for addition
int sum(int a, int b)
return a + b;
// Function for Subtraction
int sub(int a, int b)
return a - b;
Addition = 15
Subtraction = 5
// Driver Code
// Variable initialization
int a = 10, b = 5;
int add, minus;
// Function Call
add = sum(a, b);
minus = sub(a, b);
printf("Addition = %dn", add);
printf("Subtraction = %dn", minus);
Unstructured Programming is a type of programming
that generally executes in sequential order i.e., these
programs just not jumped from any line of code and
each line gets executed sequentially.
It is also known as non-structured programming that is
capable of creating turning-complete algorithms.
// C program to demonstrate the
// unstructured programming
// Driver Code
// Variable initialization
int a = 10, b = 5;
int add, minus;
// Operations performed
add = a + b;
minus = a - b;
printf("Addition = %dn", add);
printf("Subtraction = %dn", minus);
Addition = 15
Subtraction = 5
Structured vs Unstructured Programming
Structured Programming is a programming paradigm
which divides the code into modules or function.
Unstructured Programming is the paradigm in which
the code is considered as one single block.
Structured Programming based programs are easy to
Unstructured Programming based programs are hard
Structured Programming is to make the code more
efficient and easier to understand.
Unstructured programming is just to program to solve
the problem. It does not create a logical structure.
Structured Programming is easier because of
Unstructured programming is harder when comparing
with the structured programming.
Structured programming can be used for small and
medium scale projects.
Unstructured programming is not applicable for
medium and complex projects.
It is easy to do changes in Structured Programming.
It is hard to do modifications in Unstructured
Structured programming uses many data types.
Unstructured programming has a limited number of
Structured programming avoids code duplication. Unstructured programming can have code duplication.
Testing and Debug
It is basically a subset of procedural programs. It is basically a procedural program.
In this, programmers are allowed to code a program simply by
dividing the program into modules or smaller units.
In this, programmers are not allowed code divide programs
into small units. Instead, the program should be written as a
single continuous block without any breakage.
The entire program must be coded in one continuous block.
It is more user-friendly and easy to understand as compared
to unstructured programming.
It is less user-friendly and little hard to understand as
compared to structured programming.
It is easier to learn and follow. It is difficult to learn and follow
Its advantages include reduce complexity, facilitate
debugging, increase programmer productivity programs, etc.
Its advantages include it speed
Structured programs use a greater number of data types as
compared to unstructured programs.
Unstructured programs use a limited number of data types as
compared to structured programs.
It does not use GOTO to control the flow of execution.
Instead, it uses loops.
It uses GOTO to control the flow of execution.
It produces readable code. It hardly produces readable code.
It does not provide full freedom to programmers to program as
It provides full freedom to programmers to program as they
Easy to modify and to debug Very difficult to modify and to debug
Languages : C, C+, C++, C#, Java, PERL, Ruby, PHP,
ALGOL, Pascal, PL/I and Ada
early versions of BASIC (such as MSX BASIC and
GW-BASIC), JOSS, FOCAL, MUMPS, TELCOMP,
COBOL, machine-level code, early assembler
systems (without procedural metaoperators),
assembler debuggers and some scripting languages
such as MS-DOS batch file language.
1. Object - entity
It has attributes, behavious, & properties
Instance of class
It occupies space in the memory.
Ex . Pen , table, person ( Physical & logical)
2. Class – collection of object
is a blueprint or template of an object.
Set of attributes also called state which is represented by variables and properties
Behavior is represented by methods
It is a user-defined data type. Inside a class, we define variables, constants, member functions, and
it binds data and functions together in a single unit.
It does not consume memory at run time.
Note that classes are not considered as a data structure.
It is a logical entity. It is the best example of data binding.
Note that a class can exist without an object but vice-versa is not possible.
Abstraction - hide the background detail & shows the
essential detail from user
Ex. Phone call, email
Encapsulation – wrapping of data and coding
Inheritance – code reusability –
inherit the properties of an existing class (parent class)
into a newly created class (child class).
Polymorphism Poly – many , Morphs - Forms
More than one form
It allows us to create methods with the same
name but different method signatures.
OOP(Object Oriented Programming) POP(Procedural Oriented Programming)
Object oriented. Structure oriented.
Program is divided into objects. Program is divided into functions.
Bottom-up approach. Top-down approach.
Inheritance property is used. Inheritance is not allowed.
It uses access specifier. It doesn’t use access specifier.
Encapsulation is used to hide the data. No data hiding.
Example of OOP are : C++, JAVA, VB.NET, C#.NET. Example of POP are : C
CHARACTERISTICS OF A GOOD COMPUTER
A good programming language must be simple and easy to learn and use.
Portability: application to run on different platforms (operating systems)
Readability: More user-friendly approach. The program should be written in such a way that it makes other
programmers or users to follow the logic of the program without much effort.
Efficiency: Every program requires certain processing time and memory to process the instructions and
data. As the processing power and memory are the most precious resources of a computer, a program
should be laid out in such a manner that it utilizes the least amount of memory and processing time.
Structural: To develop a program, the task must be broken down into a number of subtasks.
Flexibility: A program should be flexible enough to handle most of the changes without having to rewrite
the entire program. Most of the programs are developed for a certain period and they require modifications
from time to time.
For example, in case of payroll management, as the time progresses, some employees may leave the company
while some others may join. Hence, the payroll application should be flexible enough to incorporate all the
changes without having to reconstruct the entire application.
Generality: Apart from flexibility, the program should also be general. Generality means that if a
program is developed for a particular task, then it should also be used for all similar tasks of the
same domain. For example, if a program is developed for a particular organization, then it
should suit all the other similar organizations.
Documentation: Documentation is one of the most important components of an application
development. Even if a program is developed following the best programming practices, it will
be rendered useless if the end user is not able to fully utilize the functionality of the application.
A well-documented application is also useful for other programmers because even in the
absence of the author, they can understand it.
Compactness :- In a good programming language, programmers should be able to express
intended operations concisely. A verbose language is generally not liked by programmers,
because they need to write too much.
Locality :- A good programming language should be such that while writing a programmer
concentrate almost solely on the part of the program around the statement currently being
A compiler is a computer program that reads a program written in a high-level language such
as FORTRAN, PL/I, COBOL, etc. It can translate it into the same program in a low-level
language including machine language. The compiler also finds out the various errors
encountered during the compilation of a program.
The compiler converts high-level language into low-level language using various phases. A
character stream inputted by the customer goes through multiple stages of compilation which at
last will provide target language.
Advantages of Compiler
There are various advantages of the compiler which are as follows −
•A compiler translates a program in a single run.
•It consumes less time.
•CPU utilization is more.
•Both syntactic and semantic errors can be checked concurrently.
•It is easily supported by many high-level languages like C, C++, JAVA, etc.
An interpreter is a program that executes the programming code directly instead of just
translating it into another format.
It translates and executes programming language statements one by one. An interpreter takes
less time to interpret a source program as distinguished by a compiler.
Advantages of Interpreter
There are various advantages of the interpreter which are as follows −
An interpreter translates the program line by line.
The interpreter is smaller in size.
It is flexible.
Error localization is easier.
The interpreter facilitates the implementation of computer programming language constructs.
• The main function of the linker is to generate executable files.
• The linker takes the input as the object code which would be generated by
• The process of linking can be understood as a method to combine
different snippets of code in order to obtain executable code.
• There are two types of linkers available: Linkage Editor and Dynamic
• Linker also helps combine all the object modules.
• Linker is responsible to arrange the objects in the program’s address
• The main function of a loader is to load executable files to the main
• It takes the executable files (generated by linker) as its input.
• It can be understood as a process of loading the executable codes into
main memory where it is execute further.
• There are 3 types of loaders: Absolute loading, Relocatable loading and
Dynamic run-time loading.
• It helps allocate the addresses to executable codes or files.
• It is also responsible to adjust the references that are used within the
All computer programming language cannot do
everything. There are limitations, and actually, different
languages are used for different tasks.
Two categories :
Used for creating and editing pages on the web. Can do anything
from putting plain text on a webpage, to accessing and retrieving
data from a database. Varies in terms of power and complexity.
Used for creating executable programs. We can create anything
from simple console programs that print some text to the screen
or to the entire operating systems. Varies greatly in terms of
power and complexity.
Hyper Text Markup Language. The core language of the world wide web that is used to define the
structure and layout of web pages by using various tags and attributes.
Extensible Markup Language. A language developed by the W3C which works like HTML, but
unlike HTML, allows for custom tags that are defined by programmers. XML allows for the
transmission of data between applications and organizations through the use of its custom tags.
A language developed by Netscape used to provide dynamic and interactive content on
calculators, validate forms, and more.
Visual Basic Scripting Edition. A language developed by Microsoft that works only in Microsoft's
Internet Explorer web browser and web browsers based on the Internet Explorer engine such as
FlashPeak's Slim Browser. VBScript Can be used to print dates, make calculations, interact with
the user, and more.
Hypertext Preprocessor. A powerful language used for many tasks such as data encryption,
database access, and form validation. PHP was originally created in 1994 By Rasmus Lerdorf.
A powerful and flexible language created by Sun MicroSystems that can be used to create applets
(a program that is executed from within another program) that run inside webpages as well as
An advanced programming language used for software application
development. Originally developed by Dennis Ritchie at Bell Labs in the
1970's and designed to be a systems programming language but since then
has proven itself to be able to be used for various software applications such
as business programs, engineering programs, and even games. The UNIX
operating system is written in C.
Descendant of the C language. The difference between the two languages is
that C++ is object-oriented. C++ was developed by Bjarne Stroustrup at Bell
Labs and is a very popular language for graphical applications.
A language developed by Microsoft based on the BASIC language . Visual
Basic is used for creating Windows applications. The VBScript language (also
developed by Microsoft) is based on Visual Basic.
A powerful and flexible language created by Sun MicroSystems that can be
used to create applets (a program that is executed from within another
program) that runs inside webpages as well as software applications.
TYPES OF LANGUAGES
Low-Level Programming Languages
Medium-Level Programming Languages
High-Level Programming Languages
Procedural oriented language
Natural programming language
Visual programming language
Graphical programming language
Hypertext markup language
Extensible markup language
Object-Oriented Programming Language
Functional Programming Language
Problem-Oriented Programming Language
Artificial Intelligence Programming Language
1. MACHINE LANGUAGE
Machine Language is also known as the First Generation Programming Language (1GL).
In simple words, a Computer is a cluster of millions and millions of switches, which can be either turned ON or
OFF at a very high rate.
These two states (ON and OFF) can also be defined as 1 and 0 which is called Binary Code.
A computer just understands the language of 0s and 1s (Binary Code).
Since Machine Language doesn’t need a Compiler, Interpreter, or any type of program to convert its code. So, it is
the fastest Programming Language.
However, working with Machine Language is not an easy task. As you need a good understanding of the
architecture of the CPU and its working.
Here is a simple example of Machine Language or Binary Code – 00000001 00010000 00000100 01000000.
Low level language
First closest language to computer
Two states – on, off
Binary code – 0’s & 1’s
No need compiler, interpreter for conversion – faster
Understand the CPU working
Ex. Binary code -01011010
2. ASSEMBLY LANGUAGE
Assembly Language is also known as Second Generation Programming Language
It is another Low-Level Programming Language and the second closest language to
Assembly Language is slower as compared to the Machine Language. However, it is
very fast when compared to High-Level Programming Languages (like – C, C++,
Unlike Machine Language, the Assembly Language need a program (called
Assembler) to convert its Assembly Code to Machine Code.
Programming in Assembly Language is comparatively much easier as compared to
working with Machine Language.
Low level language
Second closest language to computer
Slower than machine lang.
Faster than high level lang.
Need Assembler for conversion
Working with assembly easy than machine
Ex. MOV, SUB
3. PROCEDURAL-ORIENTED PROGRAMMING
Procedural-Oriented Programming is also known as Third Generation Programming
It is one of the primitive and important paradigms in the Programming Industry.
In Procedural-Oriented Programming, instead of focusing on data, we majorly focus on
the procedure of the program.
The main goal of Procedural-Oriented Programming is to solve a problem.
So, data is the second priority in Procedural-Oriented Programming, as a result, this
Programming Paradigm is comparatively less secure.
In Procedural Oriented Programming, we create a number of statements in order to solve
any problem. It uses a Top-Down approach in order to solve any problem.
However, it is very important to maintain the order of every step or statement. Therefore,
we make use of functions in Procedural-Oriented Programming.
Procedural-Oriented Programming is a much unrealistic approach to solve a problem as
compared to other Programming Paradigm.
Examples of Procedural-Oriented Programming Language: Basic, Fortran, C, Pascal,
high level language
Focus procedure instead of data
Goal – solve the problem
Use Top down approach – solve any problem
Step by step procedure follow
Need compiler for conversion
Working with assembly easy than machine
Ex. Basic, Fortran, C, Pascal, and COBOL.
NATURAL PROGRAMMING LANGUAGE
Ordinary human language like English
Programming language that use human language to
give people a more natural connection with computers.
It is designed to make the computer solve a given
problem without the programmer.
It is the part of the field of study known as AI.
VISUAL PROGRAMMING LANGUAGE (3G)
Visual programming language (VPL) is a programming
language that uses graphical elements and figures to
develop a program rather than textually.
Visual programming language is also known as
executable graphics language.
The graphics or icons included within a visual program
serve as input, activities, connections and/or output of
UML are popular examples of visual programming
Scripting Language is the Programing Language which is
used for performing automation or repetitive task with the
help of scripts.
Unlike, other Programming Languages, Scripting
Languages are Run-Time Programming Languages.
Web Automation or Web Scripting is one of the applications
of Scripting Language.
You can also automate your daily task on a computer, with
the help of Shell Script or Bash Script, which is another
most popular example of Scripting Language.
Examples of Scripting Programming Language: Bash,
HYPERTEXT MARKUP LANGUAGE
Used to add functionality to a Web page, such as different menu styles or graphic displays or to serve dynamic
These types of languages are client-side scripting languages, affecting the data that the end user sees in a browser window.
Other scripting languages are server-side scripting languages that manipulate the data, usually in a database, on the server.
ASP, JSP, PHP, Perl, Tcl and Python are examples of scripting languages.
Definition of HTML
HTML (Hypertext Markup Language) is the set of markup symbols or codes inserted in a file intended for display
on a World Wide Web browser page.
The markup tells the Web browser how to display a Web page's words and images for the user.
Each individual markup code is referred to as an element (but many people also refer to it as a tag). Some elements come in
pairs that indicate when some display effect is to begin and when it is to end.
<title>Title of the document</title>
The content of the document......
EXTENSIBLE MARKUP LANGUAGE
Definition of XML
Extensible Markup Language (XML) is used to describe data. The XML standard is a flexible way to create
information formats and electronically share structured data via the public Internet, as well as via
Difference between HTML and XML
1. HTML was designed to display data with focus on how data looks while XML was designed to be a software
and hardware independent tool used to transport and store data, with focus on what data is.
2. HTML is a markup language itself while XML provides a framework for defining markup languages.
3. HTML is a presentation language while XML is neither a programming language nor a presentation
4. HTML is case insensitive while XML is case sensitive.
5. HTML is used for designing a web-page to be rendered on the client side while XML is used basically
to transport data between the application and the database.
6. HTML has its own predefined tags while what makes XML flexible is that custom tags can be defined and the
tags are invented by the author of the XML document.
7. HTML is not strict if the user does not use the closing tags but XML makes it mandatory for the user the close
each tag that has been used.
8. HTML does not preserve white space while XML does.
HTML stands for Hyper Text Markup Language. XML stands for extensible Markup Language.
HTML is static. XML is dynamic.
HTML is a markup language. XML provides framework to define markup languages.
HTML can ignore small errors. XML does not allow errors.
HTML is not Case sensitive. XML is Case sensitive.
HTML tags are predefined tags. XML tags are user defined tags.
There are limited number of tags in HTML. XML tags are extensible.
HTML does not preserve white spaces. White space can be preserved in XML.
HTML tags are used for displaying the data. XML tags are used for describing the data not for displaying.
In HTML, closing tags are not necessary. In XML, closing tags are necessary.
HTML is used to display the data. XML is used to store data.
HTML does not carry data it just display it. XML carries the data to and from database.
THE DIFFERENT GENERATIONS OF LANGUAGES
First generation languages (abbreviated as 1GL)
Represents the very early, primitive computer languages that consisted entirely of 1's and 0's - the actual language that the
computer understands (machine language).
Second generation languages (2GL)
Represents a step up from the first generation languages. Allow for the use of symbolic names instead of just numbers. Second
generation languages are known as assembly languages. Code written in an assembly language is converted into machine
Third generation languages (3GL)
With the languages introduced by the third generation of computer programming, words and commands (instead of just
symbols and numbers) were being used. These languages therefore, had syntax that was much easier to understand. Third
Fourth generation languages (4GL)
The syntax used in 4GL is very close to human language, an improvement from the previous generation of languages. 4GL
languages are typically used to access databases and include SQL and ColdFusion, among others.
Fifth generation languages (5GL)
Fifth generation languages are currently being used for neural networks. A nueral network is a form of artificial intelligence that
attempts to imitate how the human mind works.
FEATURES OF GOOD PROGRAMMING LANGUAGE
A programming language must be simple, easy to learn and use, have good readability, and be human recognizable.
Abstraction is a must-have Characteristics for a programming language in which the ability to define the complex structure
and then its degree of usability comes.
A portable programming language is always preferred.
Programming language’s efficiency must be high so that it can be easily converted into a machine code and executed
consumes little space in memory.
A programming language should be well structured and documented so that it is suitable for application development.
Necessary tools for the development, debugging, testing, maintenance of a program must be provided by a programming
A programming language should provide a single environment known as Integrated Development Environment(IDE).
A programming language must be consistent in terms of syntax
Apparemment, vous utilisez un bloqueur de publicités qui est en cours d'exécution. En ajoutant SlideShare à la liste blanche de votre bloqueur de publicités, vous soutenez notre communauté de créateurs de contenu.
Vous détestez les publicités?
Nous avons mis à jour notre politique de confidentialité.
Nous avons mis à jour notre politique de confidentialité pour nous conformer à l'évolution des réglementations mondiales en matière de confidentialité et pour vous informer de la manière dont nous utilisons vos données de façon limitée.
Vous pouvez consulter les détails ci-dessous. En cliquant sur Accepter, vous acceptez la politique de confidentialité mise à jour.