0% found this document useful (0 votes)
9 views49 pages

Unit1 1

The document provides an overview of Object-Oriented System Design (OOSD), covering its principles, modeling techniques, and implementation using C++. It discusses key concepts such as encapsulation, inheritance, and polymorphism, along with practical examples in C++. Additionally, it highlights the importance of modeling in understanding and designing complex systems, as well as the use of UML for visual representation.
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)
9 views49 pages

Unit1 1

The document provides an overview of Object-Oriented System Design (OOSD), covering its principles, modeling techniques, and implementation using C++. It discusses key concepts such as encapsulation, inheritance, and polymorphism, along with practical examples in C++. Additionally, it highlights the importance of modeling in understanding and designing complex systems, as well as the use of UML for visual representation.
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/ 49

• Why we study Object Orientation System

Design
• ?
• Where we used OOSD
• And how it is implemented using
C++
UNIT 1

Introduction: The meaning of Object Orientation, object identity, Encapsulation, information hiding, polymorphism,
generosity, importance of modelling, principles of modelling, object oriented modelling, Introduction to UML,
conceptual model of the UML, Architecture.

UNIT 2

Basic Structural Modeling: Classes, Relationships, common Mechanisms, and diagrams. Class &Object Diagrams:
Terms, concepts, modelling techniques for Class & Object Diagrams. Collaboration Diagrams: Terms, Concepts,
depicting a message, polymorphism in collaboration Diagrams, iterated messages, use of self in messages. Sequence
Diagrams: Terms, concepts, depicting asynchronous messages with/without priority, call-back mechanism, broadcast
messages.
Basic Behavioural Modeling: Use cases, Use case Diagrams, Activity Diagrams, State Machine, Process and thread,
Event and signals, Time diagram, interaction diagram, Package diagram.
Architectural Modeling: Component, Deployment, Component diagrams and Deployment diagrams.
UNIT 3
Object Oriented Analysis: Object oriented design, Object design, combining three models, Designing
algorithms, design optimization, Implementation of control, Adjustment of inheritance, Object
representation, Physical packaging, Documenting design considerations. Structured analysis and
structured design (SA/SD), Jackson Structured Development (JSD).
Mapping object-oriented concepts using non-object-oriented language, translating classes into data
structures, passing arguments to methods, Implementing inheritance, associations encapsulation.
Object oriented programming style: reusability, extensibility, robustness, programming in the large.
Procedural v/s OOP, Object oriented language features. Abstraction and Encapsulation
UNIT 4
C++ Basics: Overview, Program structure, namespace, identifiers, variables, constants, enum,
operators, typecasting, control structures
C++ Functions: Simple functions, Call and Return by reference, Inline functions, Macro Vs. Inline
functions, Overloading of functions, default arguments, friend functions, virtual functions
UNIT 5
Objects and Classes: Basics of object and class in C++, Private and public members, static data and
function members, constructors and their types, destructors, operator overloading, type conversion.
Inheritance: Concept of Inheritance, types of inheritance: single, multiple, multilevel, hierarchical,
hybrid, protected members, overriding, virtual base class. Polymorphism: Pointers in C++, Pointes
and Objects, this pointer, virtual and pure virtual functions, Implementing polymorphism
• Lecture Objectives
• To understand basic definitions and types of Object
Orientation.
• To understand design techniques, types, UML, C++
OOPS.
• Learn to implement class/Object in C++.
• Lecture Outcomes
• Students will be able to identify and describe
different problem design.
• Students will be able to explain solution and visual
representation of real world problems
• Students will be able to implement simple problem
with oops concept in C++ language.
Lecture 1
Introduction to Object Orientation
Object orientation, or object-oriented programming (OOP), is a
programming model that organizes software design around
objects, which are data fields with unique attributes and
behavior.
In OOP, programs are made up of objects that interact with
each other, and each object can contain data and code
What is Object Orientation?
• In the past, information systems used to be defined
primarily by their functions: data and functions were kept
separate and associated using input and output
relations.
• The object-oriented approach, however, focuses on
objects that represent abstract or concrete things in the
real world. These objects are first defined by their
character and their properties, which are represented by
their internal structure and their attributes (data). The
behavior of these objects is described by methods
(functions).
• Objects form a capsule, which combines the
characteristics with behavior. Objects are intended to
enable programmers to map a real problem and its
proposed software solution on a one-to-one basis.
• SAP ABAP Full Form is : ABAP stands for “Advanced
Business Application Programming.
• Typical objects in a business environment are, for
example, 'Customer', 'Order', or 'Invoice'. From Release
3.1 onwards, Business Object Repository (BOR) of SAP
Web Application Server ABAP has contained examples
of such objects. The BOR object model will be integrated
into ABAP Objects in the next release by migrating the
BOR object types to the ABAP class library.
• Objects
Objects are instances of classes. They contain data
and provides services. The data forms the attributes
of the object. The services are known as methods
(also known as operations or functions). Typically,
methods operate on private data (the attributes, or
state of the object), which is only visible to the
methods of the object. Thus the attributes of an
object cannot be changed directly by the user, but
only by the methods of the object. This guarantees
the internal consistency of the object.
• Classes
Classes describe objects. From a technical point
of view, objects are runtime instances of a class.
In theory, you can create any number of objects
based on a single class. Each instance (object)
of a class has a unique identity and its own set
of values for its attributes.
• Object References
In a program, you identify and address objects
using unique object references. Object
references allow you to access the attributes
and methods of an object.
In object-oriented programming, objects usually
have the following properties:
• Encapsulation
Objects restrict the visibility of their resources
(attributes and methods) to other users. Every
object has an interface, which determines how
other objects can interact with it. The
implementation of the object is encapsulated,
that is, invisible outside the object itself.
• Inheritance
You can use an existing class to derive a new
class. Derived classes inherit the data and
methods of the superclass. However, they can
overwrite existing methods, and also add new
ones.
• Polymorphism
Identical (identically named) methods behave
differently in different classes. In ABAP Objects,
polymorphism is implemented by redefining
methods during inheritance and by using
constructs called interfaces.
Uses of Object Orientation
Below are some of the advantages of object-oriented programming:
• Complex software systems become easier to understand, since object-
oriented structuring provides a closer representation of reality than other
programming techniques.
• In a well-designed object-oriented system, it should be possible to
implement changes at class level, without having to make alterations at
other points in the system. This reduces the overall amount of
maintenance required.
• Using polymorphism and inheritance, object-oriented programming
allows you to reuse individual components.
• In an object-oriented system, the amount of work involved in revising and
maintaining the system is reduced, since many problems can be
detected and corrected in the design phase.
Achieving these goals requires:
• Object-oriented programming languages
Object-oriented programming techniques do not necessarily depend on object-oriented
programming languages. However, the efficiency of object-oriented programming depends
directly on how object-oriented language techniques are implemented in the system kernel.
• Object-oriented tools
Object-oriented tools allow you to create object-oriented programs in object-oriented
languages. They allow you to model and store development objects and the relationships
between them.
• Object-oriented modelling
The object-orientation modeling of a software system is the most important, most
time-consuming, and most difficult requirement for attaining the above goals.
Object-oriented design involves more than just object-oriented programming, and
provides logical advantages that are independent of the actual implementation.
Class Overview
In the above diagram
• The left-hand side of the illustration shows the declaration and
implementation parts of a local class C1. The right-hand side
illustrates the structure of the class with the components in their
respective visibility areas, and the implementation of the methods.

• The public components of the class form the interface between the
class and its users. The protected components are an interface to
the subclasses of C1. The private components are not visible
externally, and are fully encapsulated in the class. The methods in
the implementation part have unrestricted access to all components
of the class.
Object Overview
• The above illustration shows a class C1 on the left, with
its instances represented in the internal session of an
ABAP program on the right. To distinguish them from
classes, instances are drawn with rounded corners. The
instance names above use the same notation as is used
for reference variables in the Debugger.
Inheritance
• The left-hand part of the graphic shows how you can derive a
subclass c2 from a superclass c1 using the INHERTINGFROM
addition in the CLASS statement. The right-hand part of the graphic
shows the distribution of the subclass in the inheritance tree, which
stretches back to the default empty class OBJECT. A subclass
contains all of the components declared above it in the inheritance
tree, and can address all of them that are declared public or
protected.

class derived_class_name : access-specifier base_class_name


{
// body ....
};
Single Inheritance

This graphic illustrates single


inheritance. A class may only
have one direct superclass,
but it can have more than
one direct subclass. The
empty class OBJECT is the
root node of every
inheritance tree in ABAP
Objects.
Multiple Inheritance
Object-Oriented Development

(OOD)
This approach models real-world entities as objects,
encapsulating data and behavior within these objects to
promote modularity, reusability, and maintainability in
software systems.

Object Object Object


oriented oriented oriented
Analysis Design Programming

Object-Oriented Development (OOD)


Class example in C++
• C++ is an object-oriented programming language.

• Everything in C++ is associated with classes and objects, along with


its attributes and methods. For example: in real life, a car is
an object. The car has attributes, such as weight and color,
and methods, such as drive and brake.

• Attributes and methods are basically variables and functions that


belongs to the class. These are often referred to as "class members".

• A class is a user-defined data type that we can use in our program,


and it works as an object constructor, or a "blueprint" for creating
objects.
class MyClass { // The class
public: // Access
specifier
int myNum; // Attribute
(int variable)
string myString; // Attribute
(string variable)
};
• class MyClass { // The class
public: // Access specifier
int myNum; // Attribute (int variable)
string myString; // Attribute (string variable)
};
int main() {
MyClass myObj; // Create an object of MyClass
// Access attributes and set values
myObj.myNum = 15;
myObj.myString = "Some text";
// Print attribute values
cout << myObj.myNum << "\n";
cout << myObj.myString;
return 0;
}
• class Car { // The class
public: // Access specifier
string brand; // Attribute
string model; // Attribute
int year; // Attribute
Car(string x, string y, int z) { // Constructor with parameters
brand = x;
model = y;
year = z;
}
};
int main() {
// Create Car objects and call the constructor with different values
Car carObj1("BMW", "X5", 1999);
Car carObj2("Ford", "Mustang", 1969);
// Print values
cout << carObj1.brand << " " << carObj1.model << " " <<
carObj1.year << "\n";
cout << carObj2.brand << " " << carObj2.model << " " <<
carObj2.year << "\n";
return 0;
}
• #include <iostream>
using namespace std;
class Employee {
private:
// Private attribute
int salary;
public:
// Setter
void setSalary(int s) {
salary = s;
}
// Getter
int getSalary() {
return salary;
}
};
int main() {
Employee myObj;
myObj.setSalary(50000);
cout << myObj.getSalary();
return 0;
}
Importance of modeling
• Modeling is important in object-oriented analysis and design (OOAD) because it helps you:
• Understand systems: Models help you understand the systems you're developing.
• Visualize systems: Models help you visualize systems as they are or as you want them to
be.
• Specify structure and behavior: Models help you specify the structure or behavior of a
system.
• Document decisions: Models help you document the decisions you've made.
• Provide a template: Models provide a template that guides you in constructing a system.
• Simplify complex systems: Models help you simplify complex systems so you can
understand them part by part.
• Analyze data: Models help you analyze data effectively.
• Influence decision-making: Models help influence decision-making processes.
• Models can take many forms, including diagrams, three-dimensional models, and computer
models
principles of modelling,
object oriented modelling
UML Diagram
Graphical representation of a set of elements.
Represented by a connected graph: Vertices are things; Arcs are relationships/behaviors.
5 most common views built from
UML 1.x: 9 diagram types.

Structural Diagrams Behavioral Diagrams


Represent the static aspects of a system. Represent the dynamic aspects.
– Class; Use case
Object Sequence;
Collaboration
– Component
Statechart
– Deployment Activity
UML
UML 2.0: 12 diagram types
Diagram
Structural Diagrams

– Class;
Object
– Component Interaction Diagrams
– Deployment
– Composite Structure
– Package
– Sequence;
Behavioral Diagrams Communication

Use case

– Interaction Overview
Statechart – Timing
Activity

44
Type of UML Diagram
Class Diagrams

Structural Diagrams

– Class;
Object
– Component
– Deployment
– Composite Structure
– Package

47
THANK YOU

You might also like