Apr 20, 2023 www.fakengineer.com
Apr 20, 2023 www.fakengineer.com
INTRODUCTION. FEATURES OF OOP. ORGANIZATION OF DATA & FUNCTION
IN OOP. OOP’S DESIGN. DESIGN OF MEMBER FUNCTION. ANALISYS OF OOP. BENEFITS OF OOP.
Apr 20, 2023 www.fakengineer.com
INTRODUCTIONINTRODUCTION
Object-oriented programming (OOP) now dominates the procedural-programming paradigm in many application areas. Developers often choose OOP and scripting languages—such as C++, Java for project implementations because these languages provide a way to form appropriately realistic models of real systems and processes. Actually, avoiding OOP technology may produce less-than-optimal designs and deny the development team the opportunity to code in a more intuitive fashion. Here's a list of some of the most interesting topics in OOP development:
Apr 20, 2023 www.fakengineer.com
What is OOPs?What is OOPs?
Object-Oriented programming as an approach that provide s a way of modularizing programs by creating partititioned memory area for both data and functions that can be used as templates for creating copies of such modules on demands.
Apr 20, 2023 www.fakengineer.com
ORGANISATION OF DATA AND ORGANISATION OF DATA AND FUNCTION IN OOP’S:FUNCTION IN OOP’S:
The major motivating factor in the invention of object oriented approach is to remove some of the flows encountered in the procedure approach. OOP treats data as a critical element in the program development and does not allow it to flow freely around the system.
Data
Functions
Data
Functions
Functions
Data
Communication
Object A Object B
Object C
Apr 20, 2023 www.fakengineer.com
Some of the striking features of OOP are:Some of the striking features of OOP are:
Programs are divided into what are know as objects.Functions that operate on the data of an object are tied together in the Data Structure. Data is hidden and cannot be accessed by external functions. Objects may communicate with each other through functions. New data and functions can be easily added whenever necessary. Follows bottom-up approach in program design.
Apr 20, 2023 www.fakengineer.com
BASIC CONCEPT OF OOP’SBASIC CONCEPT OF OOP’S
It is necessary to understand some of the concepts used extensively in OOP.
Object . Classes. Data Abstraction and Encapsulation. Inheritance. Polymorphism. Dynamic Binding.Message Communication.
Apr 20, 2023 www.fakengineer.com
OBJECTOBJECT: : Objects are the basic run-time entities in an ObjectObjects are the basic run-time entities in an Object
-Oriented System.They may represent a person, a place, a bank account or any item that the program has to handle.
When a program is executed, the objects interact by sending messages to one another.
CLASSES:A class is thus a collections of objects of similar type. For example, mango, apple,and orange are members of the class fruit. Class are user-defined data type and behave like the built-in type of a programming language.
If fruit has been defined as a class, then the statement
fruit mango;
Will create and object mango belonging to the fruit.
Apr 20, 2023 www.fakengineer.com
DATA ABSTRACTION & ENCAPSULATIONThe wrapping up of data and functions into a single unit (called class) is known as encapsulation. Data Encapsulation is the most striking feature of a class. The data is not accessible to the outside world, and only those functions which are wrapped in the class can access it. These functions provide the interface between the objects data and the program. This insulation of the data from direct access by the program is called data hiding or information hiding.
Since the classes use the concept of data abstraction, they are known as Abstract Data Type(ADT).
Apr 20, 2023 www.fakengineer.com
INHERITANCE: Inheritance is the process by which object of one class acquire the properties of object of another class. It supports the concept of hierarchical classification.
Bird
Attribute
…………..
Flying Bird
Attributes
…………
Non flying Bird
Attributes
…………..
Parrot
Attributes
………….
Pigeon
Attributes
………….
Penguin
Attributes
………….
Kiwi
Attributes
………….
ANOTHER EXAMPLEANOTHER EXAMPLE
Student
Attribute
…………..
Boys
Attributes
…………
Girls
Attributes
…………..
Bishnu
Attributes
………….
Ramesh
Attributes
………….
Sumitra
Attributes
………….
Basanti
Attributes
………….
Apr 20, 2023 www.fakengineer.com
POLYMORPHISM:Polymorphism is another important OOP’s concept. Polymorphism, a Greek term, means the ability to take more than one form. An operation may take exhibit different behaviors in different instances.
The process of making an operator to exhibit different behaviors in different instance is known as operator overloading.
Using a single function name to perform different types of tasks is known as function overloading.
Apr 20, 2023 www.fakengineer.com
Shape
Draw( )
Circle Object
Draw (Circle)
Box Object
Draw (Box)
Triangle Object
Draw (Triangle)
Function over loading
Apr 20, 2023 www.fakengineer.com
DYNAMIC BINDING:Binding refers to the linking of procedure call to the code to be executed in response to the call. Dynamic binding (Also known as late binding) means that the code associated with a given procedure call is unknown until the time of call at run-time.
It is associated with polymorphism.
Apr 20, 2023 www.fakengineer.com
Message communications:Message communications:
An object-oriented program consists of a set of object that communicate with each other.
It involves three steps creating classes that defined objects. creating objects from class definition. Establishing communication among objects.
Apr 20, 2023 www.fakengineer.com
Object 1
Object 2Object 5
Object 4 Object 3
Network of objects communicating between them.
Apr 20, 2023 www.fakengineer.com
STEPS IN OBJECT-ORIENTED DESIGN:
Design is concerned with the mapping of objects in the problem space into objects in the solution space, and creating an overall structure and computational model of the system. The object oriented design(OOD) approach may involve the following steps.
1. A review of object created in the analysis phase.
2. Specification of class dependencies.
3. Organization of class hierarchies.
4. Design of class.
Apr 20, 2023 www.fakengineer.com
1.Review of Problem Space Objects:An exercise to review the objects identified in
the problem space is undertaken as a first step in the design stage. Some guidelines that might help the review process are:
If only one object is necessary for a service (or operation), then it operates only on that object.
If two or more objects are required for an operation to occur, then it is necessary to identify which object’s private part should be known to the operation.
If an operation requires knowledge of more than one type of objects, then the operation is not functionally cohesive and should be rejected.
Apr 20, 2023 www.fakengineer.com
2.Class Dependencies:Analysis of relationships between the classes is
central to the structure of a system. Therefore, it is important to identify appropriate classes to represent the objects in the solution space and establish their relationships. The major relationships that are important in the context of design are:Inheritance relationships.Containment relationships.Use relationships.
Apr 20, 2023 www.fakengineer.com
3.3.Organization Of Class Hierarchies:Organization Of Class Hierarchies:
Organization in the class hierarchy involve identifications, attributes and functions among a group of related classes and the combining them to form a new class. A new class will serve as the super class and the other as subordinate classes, The new class may or may not have the meaning of an object by itself. If the object is created purely to combine the common attributes it is called an abstract class.
A
D
C
E
B
X Y
BA C D E
(a) Objects in solution spaces
(b) First level of hierarchy
Z
YX
A B C D E
(c) Second level of hierarchy
Apr 20, 2023 www.fakengineer.com
4.Design of ClassWe have identified classes, their attributes, an minimal set of operations required by the concept a class is representing. We must look at the complete details the each classes represents. The important issue is to decide word functions are to be provided.
Some guidelines of designing of class: The public interface of a class should have only functions of the class. An object of one class should not send a message directly to a member of another class. A class should dependent on as few classes as possible. Interaction between two classes must be explicit.
Apr 20, 2023 www.fakengineer.com
DESIGN OF MEMBER FUCNTION: We have to identified.
Class and object. Data member function. Interface. Dependencies and . Class hierarchy.
Apr 20, 2023 www.fakengineer.com
BENEFIT OF OOP:Object-orientation contributes to the solution of many problems associated with the development and quality of software products. The principal advantages are Through inheritance we can eleminate redundant code and extend the use of existing. Classes . The principle of data hiding helps the programmer to built secure that can not be invaded by code in other part of the program. Object-oriented system can be easily upgraded from small to large system. Software complexity can be easily managed .