0% found this document useful (0 votes)
8 views36 pages

Week 1 Session 1

The document evaluates Object Oriented Programming (OOP) by discussing various programming paradigms, including unstructured, procedural, structured, and OOP languages. It highlights the building blocks of OOP, such as classes, objects, methods, and attributes, and explains the advantages of OOP, including modularity, reusability, and data security. The document also compares OOP with other programming paradigms and provides references for further reading.

Uploaded by

Talha Khursheed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views36 pages

Week 1 Session 1

The document evaluates Object Oriented Programming (OOP) by discussing various programming paradigms, including unstructured, procedural, structured, and OOP languages. It highlights the building blocks of OOP, such as classes, objects, methods, and attributes, and explains the advantages of OOP, including modularity, reusability, and data security. The document also compares OOP with other programming paradigms and provides references for further reading.

Uploaded by

Talha Khursheed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 36

Evaluation of Object Oriented

Programming (OOP)
Contents
2

 The study of programming languages


 Introduction to programming paradigm
 Programming Language types
 Unstructured programming languages
 Procedural programming languages
 Structured programming languages
 Object Oriented programming (OOP) languages
 Building blocks of OOP
 Why OOP?
 Features of OOP
 References
 Next lecture topics
The study of programming languages
3

o The purpose of language is simply that it must convey meaning.

o Whatever can be said, can be said clearly.

o A programming language is a notation for writing programs.

• A computer program is a collection of instructions that can be


executed by a computer to perform a specific task. A
computer program is usually written by a computer
programmer in a programming language.
Introduction of paradigm and programming paradigms
4

o Paradigm can also be termed as method to solve some problem


or do some task.

o Programming paradigm is an approach to solve problem using


some programming language.

o Also we can say it is a method to solve a problem using tools and


techniques that are available.
Introduction of paradigm and programming paradigms
5

o There are lots for


programming language that
are known but all of them
need to follow some
strategy when they are
implemented and this
methodology/strategy is
paradigms.
Programming Languages
6

• Machine language
• Unstructured programming languages
• Procedural programming languages
• Structured oriented programming languages
• Object oriented programming languages
Procedural Structured
Unstructured Object oriented
programming programming
Machine programming programming
languages languages
Language languages languages
e.g. FORTRAN, e.g. C and
e.g. assembly e.g. C++ JAVA
COBOL PASCAL
Overview of programming language types and levels
7
Machine language
8

• Machine language is the language understood by a


computer.

• Very difficult to understand, but it is the only thing that the


computer can work with.

• All programs and programming languages eventually


generate or run programs in machine language.
Machine language
9

• Machine code, consisting of machine language instructions, is a


low-level programming language used to directly control a
computer's central processing unit (CPU).

• Machine language can only be represented by 0s and 1s.


Assembly language
10

• Assembly language is the more than low level and less than high-
level language so it is intermediary language.

• Assembly languages use numbers, symbols, and abbreviations


instead of 0s and 1s.
Machine language vs Assembly language
11

Machine Language Assembly Language


Machine language is only understand by the computers. Assembly language is only understand by human beings
not by the computers.

In machine language data only represented with the help In assembly language data can be represented with the
of binary format(0s and 1s), hexadecimal and octadecimal. help of mnemonics such as Mov, Add, Sub, End etc.

Machine language is very difficult to understand by the Assembly language is easy to understand by the human
human beings. being as compare to machine language.
Modifications and error fixing cannot be done in machine Modifications and error fixing can be done in assembly
language. language.
Machine language is very difficult to memorize so it is not Easy to memorize the assembly language because some
possible to learn the machine language. alphabets and mnemonics are used.
Execution is fast in machine language because all data is Execution is slow as compared to machine language.
already present in binary format.
There is no need of translator.The machine understandable Assembler is used as translator to convert mnemonics into
form is the machine language. machine understandable form.

Machine language is hardware dependent. Assembly language is the machine dependent and it is not
portable.
Unstructured programming languages
12

• Entire logic of the program is written as a single continuous


(nonstop or unbroken) block is called "unstructured
Programming".

• Consists of just writing the sequence of commands or


statements in the main program.

• Program written by following this language is very difficult


to modify and to debug.

• Example, assembly language programs.


Unstructured programming languages
13

Limitations
• Data is global and code operate on it.

• The concept of local variable did not exist.

• Does not have independent data for processing.

• As the code increases, maintenance become more complex.

• Reusability of code not supported.


Procedural programming languages
14

• The first programming paradigm that a new developer will


learn.

• Fundamentally, the procedural code is the one that directly


instructs a device on how to finish a task in logical steps.

• This paradigm uses a linear top-down approach and treats


data and procedures as two different entities.

• Example FORTRAN and COBOL language programs.


Procedural programming languages
15

• Procedural programming divides the program into procedures,


which are also known as routines or functions, simply
containing a series of steps to be carried out.

• It involves writing down a list of instructions to tell the


computer what it should do step-by-step to finish the task at
hand.

• Program flow control is achieved through function calls and


goto statements.
Procedural oriented programming languages
16

• The program code is harder to write.

• The procedural code is often not reusable, need to recreate.


Limitations

• Difficult to relate with real-world objects.

• The importance is given to the operation rather than the data, which
might pose issues in some data-sensitive cases.

• Data is not secured because data is global and can be accessed by any
function.
Structured programming languages
17

• Large programs are divided into small programs called functions,


modules, subprogram, subroutines and procedures.

• Modular programming is another name for this.

• These functions have statements embraced inside curly braces. Each


function is design to do a specific task with its own data and logic.

• Data moves freely around the systems from one function to another.
Structured programming languages
18

• Information can be passed from one function to another


function through parameters.

• A function can have local data that cannot be accessed outside


the function’s scope.

• Easier for the programmer to test and debug the code

• Program structure follows “Top Down Approach”. Example:


C, Pascal, ALGOL and Modula-2
Structured oriented programming languages
19

Limitations
• Data hiding
• Debugging of program is hard
• Not possible to handle run time errors and future
enhancements
• Software development period and cost is high
• If end user require changes, a big modification is needed in
software
• More stress laid on procedures not on data
Object oriented programming languages
20

• OOP is a fundamental programming paradigm

• In this type of language, programs are divided into objects.

• Prime focus is on the data that is being operated and not on


the functions or procedures.

• Data is hidden and cannot be accessed by external functions.

• Program structure follows “Bottom UP Approach”.


Object oriented programming languages
21

• The focus of OOP languages is not on structure, but on


modeling data.

• The main aim of OOP is to bind together the data and the
functions that operate on them so that no other part of
the code can access this data except that function.
Object oriented programming languages
22

• OOP is a programming paradigm that relies on the concept


of classes and objects.

• It is used to structure a software program into simple,


reusable pieces of code blueprints (usually called classes)
which are used to create individual instances of objects.
Object oriented programming languages
23

• A programmer designs a software program by organizing


related pieces of information and behaviors together into a
template called a class

• The entire software program runs by having multiple objects


interact with objects to create the larger program

• Examples of OOP languages include C++, Visual Basic.NET


and Java.
Comparison
24

Procedure/Structure oriented
Object oriented
Bottom-up.
Top-down.
Main focus is on 'data security'. Hence, only objects are
Main focus is on "how to get the task done" i.e. on the permitted to access the entities of a class.
procedure or structure of a program .
Large program is divided into units called functions. Entire program is divided into objects.

No access specifier observed. Access specifier are "public", "private", "protected".

It overloads functions, constructors, and operators.


Neither it overload functions nor operators.
Comparison
25

Procedure/Structure oriented
Object oriented
Inheritance achieved in three modes public private and
Their is no provision of inheritance. protected.

There is no proper way of hiding the data, so data is Data is hidden in three modes public, private, and
insecure protected. hence data security increases.
Data is shared among the objects through the member
Global data is shared among the functions in the functions.
program.
Classes or function can become a friend of another
class with the keyword "friend".
No concept of friend function.
Note: "friend" keyword is used only in c++

Concept of virtual function appear during inheritance.


No concept of virtual classes .
Building blocks of OOP
26

The code building blocks to build an OOP program are:

Classes (Blue print/prototype)


A class is a user defined blueprint or prototype from which
objects are created. It represents the set of properties or
methods that are common to all objects of one type.
Building blocks of OOP
27

Objects (Instance of class)


Usually a person, place or thing (a noun). An object is an
instance of class. objects stores data and provides method for
accessing and modifying this data.

Object is considered to be partitioned area of compute memory


that stores data and a set of operations that can access the data
Building blocks of OOP
28

Methods (Behavior / actions)


Are function that manipulate the data, an action performed
by an object (a verb)

Attributes
(instance variable / information / property / characteristic / field and
state) are the attributes of the object, - Characteristics of certain
object.
Example
29
Why OOP?
30

• OOP is an approach that provides a way of modularizing


programs by creating partitioned memory area for both
data and functions that can be used as templates for
creating copies of such modules on demand.

• OOP makes code organized, reusable, and easy to maintain.


It follows the DRY (Don’t Repeat Yourself) principle used by
many programmers to make efficient programs
Why OOP?
31

• OOP also prevents unwanted access to data, or exposing


proprietary code through encapsulation and abstraction.
Both are discussed later

• So how do programmers create Object Oriented programs?


Well the short answer is by making classes, and creating
objects from the classes. Classes form the blueprint for how
data & behaviors are structured.
Why OOP?
32

• Objects are created for specific instances of a class. As a


programmer, you might create a dog class (blueprint) as a
standard way to organize all the important information
about dogs, and then instantiate an individual dog as an
object created from the dog class - like your dog xyz.
Features of OOP
33
References
34

• https://www.geeksforgeeks.org/classes-objects-java/
• https://
techdifferences.com/difference-between-oop-and-pop.html
• https://www.educative.io/blog/object-oriented-programming
• https://www.geeksforgeeks.org/difference-between-machine-lan
guage-and-assembly-language
/
• https://www.learncomputerscienceonline.com/computer-progra
mming/#
POST2anchor2
35

THANK YOU
36

Next
Introduction to Java, NetBeans IDE, basic
program, syntax, first program with use of
class, object, attribute and method

You might also like