0% found this document useful (0 votes)
16 views8 pages

LECTURE 1 - Introduction

The document discusses object oriented programming concepts including objects, classes, encapsulation, inheritance, polymorphism and exception handling. It explains the benefits of OOP including eliminating redundant code, reusing modules, enhancing data security, and managing complexity.

Uploaded by

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

LECTURE 1 - Introduction

The document discusses object oriented programming concepts including objects, classes, encapsulation, inheritance, polymorphism and exception handling. It explains the benefits of OOP including eliminating redundant code, reusing modules, enhancing data security, and managing complexity.

Uploaded by

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

1

Virtual Classes Notes

ACADEMIC PROGRAMME: BSCS COMPUTER SCIENCE


COURSE CODE AND TITLE: BSCS 205: INTRODUCTION TO OOP
LECTURER’S NAME: PHILIP BTTOK
LECTURER’S CONTACTS: Phone No.: 0723683409 Email: [email protected]

Introduction to OOP
Expected Learning Outcomes:
By the end of this lesson, you should be able to:
i. Introduction to Object Oriented Concepts
ii. Benefits of OOP
Software Crisis
 Developments in the software industry continue to be mulled with a lot of challenges
 Software tools and technologies are developed daily
 It has forced software engineers to be keen with the approaches they adopt to stop
 The need for changes have created crises within the software industry and need to be addressed

 What need to be addressed include:


 How to represent real-life entities of problems in system design
 How to design systems with open interfaces?
 How to ensure reusability and extensibility of modules?
 How to develop modules that are tolerant of any changes in future?
 How to improve software productivity and decrease software cost?
 How to improve the quality of software
 How to manage time schedules

Evolution of Programming Languages


 Programming has evolved from the control of bits to high-level languages

Page 1 of 8
2
Virtual Classes Notes

Procedure-Oriented Programming
 In procedure-oriented programming, the problem is viewed as the sequence of things to be
done such as reading, calculating and printing
 The primary focus is functions
 Examples of languages that use procedural programming include COBOL, FORTRAN, and C

Typical structure of procedural oriented programs

Page 2 of 8
3
Virtual Classes Notes

 In procedural programming, we write instructions for computers to follow


 These instructions are grouped in functions
 Flowcharts are used for organizing actions and flow of the program
 In multi-function program, data items are placed as global so that they may be accessed by all
functions
 Each function may have its own local data
 Global data are vulnerable to an inadvertent change by a function
 In a large program, it is difficult to identify what data is used by which function
 Another serious drawback with the procedural approach is that we do not model real world
problems very well
 This is because functions are action-oriented
 The characteristics of procedure-oriented programming include:
 Emphasis is on doing things (algorithms)
 Large programs are divided into smaller programs called functions
 Most of the functions share global data
 Data move openly around the system from function to function
 Functions transform data from one form to another
 Employs top-down approach in program design

Object-Oriented Paradigm
 Eliminates the problems that were encountered in procedural programming
 Object Oriented Paradigm treats data as a critical element and thus does not allow it to flow
freely within the system
 It ties data to a function that uses it and protects it from accidental modification from outside
 OOP allows decomposition of a problem into a number of entities called objects and then
builds data and function around these objects

Page 3 of 8
4
Virtual Classes Notes

 Characteristics of object oriented programming:


 Emphasis is on data rather than procedure
 Programs are divided into what are known as objects
 Data structures are designed such that they characterize the objects
 Functions that operate on the data of an object are tied together in the structure
 Data is hidden and cannot be accessed by external function
 Objects may communicate with each other through function
 New data and functions can be added whenever necessary
 It follows bottom-up approach in program design
Basic Concepts of Object Oriented Programing
 The basic concepts of object oriented programming include:
 Objects
 Classes
 Data abstraction
 encapsulation
 Inheritance
 Polymorphism
 Exception handling
Objects
 Objects are the basic run-time entities in OOP
 May represent a person, place, bank account, table of data
 It may represent user-defined data like vectors, time and lists
 Objects communicate with one another through message passing
 Example of an object

Page 4 of 8
5
Virtual Classes Notes

Classes
 Classes are user-defined data type but also has functions in it
 A class, therefore is a blueprint for an object
 It declares and defines what data variables the object will have and what operations can be
performed on the class’s object
 For example mango, apple, and orange are members of fruit class
 If fruit has been defined as a class, then the statement Fruit Mango;
will create an object mango belonging to the class fruit

Data abstraction and encapsulation


 The wrapping up of data and function into a single unit (called a class) is known as
encapsulation.
 Data encapsulation enables only functions inside the class to access the data
 Data is not accessible to functions from outside
 The functions provides the interface between the object’s data and the program
 This insulation of the data from direct access by the program is called data hiding or
information hiding
 Abstraction refers to the act of representing essential features without including the background
details or explanation
 Classes use the concept of abstraction and are defined as a list of abstract attributes such as
size, weight and cost
 Functions operate on these attributes
 They encapsulate all these essential properties of the object that are created
 Attributes are sometimes called data members
 The functions that operate on these data are sometimes called methods or member functions

Inheritance
 Inheritance is the process by which objects of one class acquired the properties of objects of
another class
 Example class ‘robin’ is part of class ‘flying bird’ which is again part of the class ‘bird’
Page 5 of 8
6
Virtual Classes Notes

 The logic behind this division is that each derived class shares common characteristics with the
class from which it is derived
 In OOP, the concept of inheritance provides the idea of reusability
 This means we can have additional features to a class without modifying it
 This is possible by deriving a new class from the existing one

Polymorphism
 Polymorphism is the ability to take more than one form
 An operation may exhibit different behaviors in different instances
 The behavior depends upon the types of data used in the operation
 Consider the operation addition. For two numbers the operation will be a sum. For two strings,
it will be concatenation
 The process of making an operator exhibit different behaviors in different instances is known as
operator overloading

Page 6 of 8
7
Virtual Classes Notes

 Polymorphism plays an important role in allowing objects having different internal structures to
share the same internal interfaces
 This means that a general class of operations may be accessed n the same manner even though
specific action associated with each other may differ
 It is used extensively in inheritance

Exception Handling
 Exception handling is a feature in OOP
 Used to handle unresolved conflict

Benefits of OOP
 The advantages of OOP include:
 Eliminate redundant code by re-using classes
 It eliminates the need to re-invent the wheel by having to reuse modules already
developed
 Data hiding enables programmers enhance security of their data
 Possible to have many instances of an object without interference
 Partitioning of projects is easily achieved
 Easy upgrade from small to large system
 Easy to manage software complexity

Page 7 of 8
8
Virtual Classes Notes

Further E-Resource Readings


CE, E. 3IT87: OBJECT ORIENTED PROGRAMMING WITH C++ CREDITS–4 (LTP: 3, 0, 2).

Page 8 of 8

You might also like