SlideShare ist ein Scribd-Unternehmen logo
1 von 34
Objectives
In this lesson, you will learn to:
Explain the features of object-oriented methodology
Describe the phases of object-oriented methodology
Create classes in C++
Complexity of the Software System
Internal Complexity
Arises from the composition of a system itself
External Complexity
Arises from the fact that users themselves have
only a vague idea of how their system works and
have difficulty in expressing their requirements
Reasons for the Complexity Involved in the
Development of Software
Difficulty in managing the software development
process
Lack of standards for developing software
Difficulty in predicting software behavior
Simplifying Complexity
Is done by breaking the system into its component
parts and arranging them in a hierarchy
Just a Minute…
Jane has called a technician to repair her television. How
would the technician deal with the complexity of the
television?
Object
Is an instance of a class that exhibits some well-
defined behavior
Characteristics of Objects
State
Is indicated by a set of attributes and the values of
these attributes
Behavior
Is indicated by how an object acts and reacts
Identity
Distinguishes the object from all other objects
Just a Minute…
Identify the possible attributes to define the state of the
following objects:
Tea cup
Stereo tape-recorder
Classes
P E A C O C K S P A R R O W K I N G F I S H E R
B I R D S
Define the attributes and behaviors of an object
Example:
Messages and Methods
Messages:
Are transmitted by one object to another
Are transmitted as requests for an action to be taken
Are accompanied by additional information needed to
carry out the request
Messages and Methods (Contd.)
Methods:
Are a set of actions taken by the receiver object in
response to the request
Just a Minute…
Dr. James and Mr. Hyde went to the railway station to
book two tickets in the Flying express for 3rd
December
by AC 1st
class. Identify the following:
a.The possible receiver of the message in this situation
b.The possible method that the receiver can use
Benefits of the Object-Oriented Approach
Realistic modeling
Easy to use
Reusability
Saves time and cost
Just a Minute…
State whether the following situations demonstrate
reusability:
a. Recycling paper
b. Pump reusability (same pump is used in a well and in
a fuel station)
Benefits of Object-Oriented Approach (Contd.)
Resilience to change
Easy to maintain
Parts of the system can be refined without any
major change in other parts
Object-Oriented Analysis (OOA)
Analysis:
Is a phase where users and developers get together
and arrive at a common understanding of the system
Requires the developer to concentrate on obtaining
maximum possible information about the problem
domain
Results in one of the end products as specification of
the function of the system
Object-Oriented Design (OOD)
Design:
Generates the blueprint of the system that has to be
implemented
Involves identifying classes using
Abbott’s technique
Object-Oriented Design (OOD) (Contd.)
Abbott’s technique follows the listed steps:
Write English description of the problem
Underline nouns (nouns represent candidate
classes)
Object-Oriented Programming (OOP)
Is a way of writing programs
Some applications built using OOP techniques are:
Computer-Aided Design (CAD)
Computer-Aided Manufacturing (CAM)
Artificial Intelligence (AI) and Expert Systems
Object-Oriented Databases
Just a Minute…
As a member of a team that is developing the billing
system software for Diaz Telecommunications Inc., you
have been assigned the task of creating a software
module that accepts and displays customer details.
Identify the class that you will create and the methods of
the class.
Generations of Computer Languages
First generation
Second generation
Third generation
Evolution of C++ as an Object Oriented
Programming Language
In the early 1980s, Bjarne Stroustrup developed the
C++ language
C++ was originally known as 'C with classes'
Creating Classes in C++
Sample:
class Car
{
public:
void honk()
{
cout<<"BEEP BEEP!";
}
};
Creating Classes in C++ (Contd.)
The class keyword
Is used to declare a class
Example:
class Car
{
...
};
Creating Classes in C++ (Contd.)
Conventions for naming classes
Should be meaningful
Should ideally be a noun
First letter of every word should be in upper case
Rules for naming classes
Must not contain any embedded space or symbol
Must begin with a letter, which may be followed by
a sequence of letters or digits
Cannot be a keyword
Creating Classes in C++ (Contd.)
Member functions
Are means of passing messages and responding
to them
Are declared inside the class body
Example:
class Car
{ void honk()
{ cout<<"BEEP BEEP!";
}
};
Creating Classes in C++ (Contd.)
The cout object
Is an instance of the pre-defined class, ostream
The endl manipulator
Is a command that takes the cursor to the new line
Problem Statement 1.D.1
As a member of a team that is developing the billing
system software for Diaz Telecommunications Inc., you
have been assigned the task of creating a software
module that accepts and displays customer details.
Declare the Customer class and the member functions.
The member function to accept customer details should
display the message “Accepting Customer Details”.
Similarly, the member function to display customer
details on the screen should display the message
“Displaying Customer Details.”
Problem Statement 1.D.1 (Contd.)
Solution:
class Customer
{
void accept()
{
cout << “Accepting Customer Details” <<
endl;
}
void display()
{
cout << “Displaying Customer Details” <<
endl;
}
};
Problem Statement 1.P.1
As a member of a team that is developing an automated
booking system for the Railways, you have been
assigned the task of creating a module that accepts the
details of a passenger and checks whether the ticket has
been confirmed or is in the waiting list. The module then
prints the list of confirmed passengers. Declare a class
Ticket, which consists of three member functions,
booking(), status(), and print().
Summary
In this lesson, you learned that:
Complexity of software arises mainly due to four
reasons:
Difficulty in understanding the intricacies and
complexity of the system and its needs
Communication problems during development
Lack of standards for developing software
Difficulty in predicting software behavior
One way of dealing with the complexity of software is
to break down an application into its components and
deal with each component separately
Summary (Contd.)
The object-oriented approach views the systems as
consisting of component objects and looks at the
interactions between them
An object is an entity that may have a physical
boundary and is also characterized by the following:
State
Behavior
Identity
A class consists of a set of objects that share a
common structure and behavior
If one object desires an action from another object, it
sends a message to the second object
Summary (Contd.)
The object that receives the message is called the
receiver; the set of actions taken by the receiver
constitutes the method
The benefits of the object-oriented approach are:
Realistic modelling, hence it is easier to use
Reusability of code, hence it saves time and cost
Resilience to change, hence systems are easier to
maintain
In the stages of analysis and design, a model of the
system is built
Summary (Contd.)
The purpose of the model built during analysis and
design is to help developers understand the reality
that they are trying to imitate
Bjarne Stroustrup developed the C++ language in the
early 1980s
The cout object is an instance of the class, ostream
The class ostream is associated with the standard
output device (screen)
The output operator '<<' is used to direct a value to
the standard output device

Weitere ähnliche Inhalte

Was ist angesagt?

Object-Oriented Analysis & Design (OOAD) Domain Modeling Introduction
  Object-Oriented Analysis & Design (OOAD)  Domain Modeling Introduction  Object-Oriented Analysis & Design (OOAD)  Domain Modeling Introduction
Object-Oriented Analysis & Design (OOAD) Domain Modeling Introduction
Dang Tuan
 
System Models in Software Engineering SE7
System Models in Software Engineering SE7System Models in Software Engineering SE7
System Models in Software Engineering SE7
koolkampus
 

Was ist angesagt? (20)

Ooad lab manual(original)
Ooad lab manual(original)Ooad lab manual(original)
Ooad lab manual(original)
 
Object-Oriented Analysis & Design (OOAD) Domain Modeling Introduction
  Object-Oriented Analysis & Design (OOAD)  Domain Modeling Introduction  Object-Oriented Analysis & Design (OOAD)  Domain Modeling Introduction
Object-Oriented Analysis & Design (OOAD) Domain Modeling Introduction
 
Software Engineering: Models
Software Engineering: ModelsSoftware Engineering: Models
Software Engineering: Models
 
SE_Lec 03_Requirements Analysis and Specification
SE_Lec 03_Requirements Analysis and SpecificationSE_Lec 03_Requirements Analysis and Specification
SE_Lec 03_Requirements Analysis and Specification
 
SE18_Lec 07_System Modelling and Context Model
SE18_Lec 07_System Modelling and Context ModelSE18_Lec 07_System Modelling and Context Model
SE18_Lec 07_System Modelling and Context Model
 
System Models in Software Engineering SE7
System Models in Software Engineering SE7System Models in Software Engineering SE7
System Models in Software Engineering SE7
 
SE18_Lec 08_UML Class Diagram
SE18_Lec 08_UML Class DiagramSE18_Lec 08_UML Class Diagram
SE18_Lec 08_UML Class Diagram
 
SE_Lec 01_ Introduction to Software Enginerring
SE_Lec 01_ Introduction to Software EnginerringSE_Lec 01_ Introduction to Software Enginerring
SE_Lec 01_ Introduction to Software Enginerring
 
SE_Lec 09_ UML Behaviour Diagrams
SE_Lec 09_ UML Behaviour DiagramsSE_Lec 09_ UML Behaviour Diagrams
SE_Lec 09_ UML Behaviour Diagrams
 
Modeling System Requirements
Modeling System RequirementsModeling System Requirements
Modeling System Requirements
 
Interface specification
Interface specificationInterface specification
Interface specification
 
UML Diagrams For Online Course Portal
UML Diagrams For Online Course PortalUML Diagrams For Online Course Portal
UML Diagrams For Online Course Portal
 
SE18_Lec 09_UML Use Cases
SE18_Lec 09_UML Use CasesSE18_Lec 09_UML Use Cases
SE18_Lec 09_UML Use Cases
 
Object oriented analysis and design unit- iii
Object oriented analysis and design unit- iiiObject oriented analysis and design unit- iii
Object oriented analysis and design unit- iii
 
Ch08
Ch08Ch08
Ch08
 
Object oriented analysis and design unit- ii
Object oriented analysis and design unit- iiObject oriented analysis and design unit- ii
Object oriented analysis and design unit- ii
 
Use case diagram
Use case diagramUse case diagram
Use case diagram
 
SE_Lec 06_Object Oriented Analysis and Design
SE_Lec 06_Object Oriented Analysis and DesignSE_Lec 06_Object Oriented Analysis and Design
SE_Lec 06_Object Oriented Analysis and Design
 
Software Engineering : OOAD using UML
Software Engineering : OOAD using UMLSoftware Engineering : OOAD using UML
Software Engineering : OOAD using UML
 
Software System Development Methodologies, tools, design and life cycle by K....
Software System Development Methodologies, tools, design and life cycle by K....Software System Development Methodologies, tools, design and life cycle by K....
Software System Development Methodologies, tools, design and life cycle by K....
 

Andere mochten auch

A tour around san vicente de la barquera maria
A tour around san vicente de la barquera maria A tour around san vicente de la barquera maria
A tour around san vicente de la barquera maria
alumnos5matalinares
 
J2ME Unit_01
J2ME Unit_01J2ME Unit_01
J2ME Unit_01
Prashanth Shivakumar
 
Advanced excel unit 01
Advanced excel unit 01Advanced excel unit 01
Advanced excel unit 01
Prashanth Shivakumar
 
VB.Net GUI Unit_01
VB.Net GUI Unit_01VB.Net GUI Unit_01
VB.Net GUI Unit_01
Prashanth Shivakumar
 

Andere mochten auch (12)

Mari domingiren etorrera
Mari domingiren etorreraMari domingiren etorrera
Mari domingiren etorrera
 
Data Structures and Algorithms Unit 01
Data Structures and Algorithms Unit 01Data Structures and Algorithms Unit 01
Data Structures and Algorithms Unit 01
 
A tour around san vicente de la barquera maria
A tour around san vicente de la barquera maria A tour around san vicente de la barquera maria
A tour around san vicente de la barquera maria
 
WCF (Windows Communication Foundation_Unit_01)
WCF (Windows Communication Foundation_Unit_01)WCF (Windows Communication Foundation_Unit_01)
WCF (Windows Communication Foundation_Unit_01)
 
RDBMS_Unit 01
RDBMS_Unit 01RDBMS_Unit 01
RDBMS_Unit 01
 
XML Unit 01
XML Unit 01XML Unit 01
XML Unit 01
 
C programming unit 01
C programming unit 01C programming unit 01
C programming unit 01
 
J2ME Unit_01
J2ME Unit_01J2ME Unit_01
J2ME Unit_01
 
Web Component Development with Servlet and JSP Technologies Unit 01
Web Component Development with Servlet and JSP Technologies Unit 01Web Component Development with Servlet and JSP Technologies Unit 01
Web Component Development with Servlet and JSP Technologies Unit 01
 
Advanced excel unit 01
Advanced excel unit 01Advanced excel unit 01
Advanced excel unit 01
 
WPF (Windows Presentation Foundation Unit 01)
WPF (Windows Presentation Foundation Unit 01)WPF (Windows Presentation Foundation Unit 01)
WPF (Windows Presentation Foundation Unit 01)
 
VB.Net GUI Unit_01
VB.Net GUI Unit_01VB.Net GUI Unit_01
VB.Net GUI Unit_01
 

Ähnlich wie C++ Unit_01

Lecture 1 uml with java implementation
Lecture 1 uml with java implementationLecture 1 uml with java implementation
Lecture 1 uml with java implementation
the_wumberlog
 
Object Oriented Design
Object Oriented DesignObject Oriented Design
Object Oriented Design
Aravinth NSP
 
Object oriented software engineering
Object oriented software engineeringObject oriented software engineering
Object oriented software engineering
Varsha Ajith
 
Lecture 3.2.4 C pointer to Structure.pptx
Lecture 3.2.4 C pointer to Structure.pptxLecture 3.2.4 C pointer to Structure.pptx
Lecture 3.2.4 C pointer to Structure.pptx
ravi2692kumar
 
CSCI-383 Lecture 3-4: Abstraction
CSCI-383 Lecture 3-4: AbstractionCSCI-383 Lecture 3-4: Abstraction
CSCI-383 Lecture 3-4: Abstraction
JI Ruan
 

Ähnlich wie C++ Unit_01 (20)

CS8592 Object Oriented Analysis & Design - UNIT I
CS8592 Object Oriented Analysis & Design - UNIT ICS8592 Object Oriented Analysis & Design - UNIT I
CS8592 Object Oriented Analysis & Design - UNIT I
 
UNIT-I(Unified_Process_and_Use Case_Diagrams)_OOAD.ppt
UNIT-I(Unified_Process_and_Use Case_Diagrams)_OOAD.pptUNIT-I(Unified_Process_and_Use Case_Diagrams)_OOAD.ppt
UNIT-I(Unified_Process_and_Use Case_Diagrams)_OOAD.ppt
 
UNIT-I(Unified_Process_and_Use Case_Diagrams)_OOAD.ppt
UNIT-I(Unified_Process_and_Use Case_Diagrams)_OOAD.pptUNIT-I(Unified_Process_and_Use Case_Diagrams)_OOAD.ppt
UNIT-I(Unified_Process_and_Use Case_Diagrams)_OOAD.ppt
 
UNIT-I(Unified_Process_and_Use Case_Diagrams)_OOAD.ppt
UNIT-I(Unified_Process_and_Use Case_Diagrams)_OOAD.pptUNIT-I(Unified_Process_and_Use Case_Diagrams)_OOAD.ppt
UNIT-I(Unified_Process_and_Use Case_Diagrams)_OOAD.ppt
 
UNIT II STATIC UML DIAGRAMS.pptx
UNIT II STATIC UML DIAGRAMS.pptxUNIT II STATIC UML DIAGRAMS.pptx
UNIT II STATIC UML DIAGRAMS.pptx
 
Lecture 1 uml with java implementation
Lecture 1 uml with java implementationLecture 1 uml with java implementation
Lecture 1 uml with java implementation
 
chapter 5 Objectdesign.ppt
chapter 5 Objectdesign.pptchapter 5 Objectdesign.ppt
chapter 5 Objectdesign.ppt
 
Bt8901 object oriented systems-de (1)
Bt8901 object oriented systems-de (1)Bt8901 object oriented systems-de (1)
Bt8901 object oriented systems-de (1)
 
Bt8901 object oriented systems-de (1)
Bt8901 object oriented systems-de (1)Bt8901 object oriented systems-de (1)
Bt8901 object oriented systems-de (1)
 
Car Showroom management System in c++
Car Showroom management System in c++Car Showroom management System in c++
Car Showroom management System in c++
 
ASPECT ORIENTED PROGRAMING(aop)
ASPECT ORIENTED PROGRAMING(aop)ASPECT ORIENTED PROGRAMING(aop)
ASPECT ORIENTED PROGRAMING(aop)
 
Object Oriented Analysis and Design with UML2 part1
Object Oriented Analysis and Design with UML2 part1Object Oriented Analysis and Design with UML2 part1
Object Oriented Analysis and Design with UML2 part1
 
Object Oriented Design
Object Oriented DesignObject Oriented Design
Object Oriented Design
 
Object Oriented Design
Object Oriented DesignObject Oriented Design
Object Oriented Design
 
CS8592 Object Oriented Analysis & Design - UNIT II
CS8592 Object Oriented Analysis & Design - UNIT IICS8592 Object Oriented Analysis & Design - UNIT II
CS8592 Object Oriented Analysis & Design - UNIT II
 
Oops ppt
Oops pptOops ppt
Oops ppt
 
Object oriented software engineering
Object oriented software engineeringObject oriented software engineering
Object oriented software engineering
 
Lecture 3.2.4 C pointer to Structure.pptx
Lecture 3.2.4 C pointer to Structure.pptxLecture 3.2.4 C pointer to Structure.pptx
Lecture 3.2.4 C pointer to Structure.pptx
 
CSCI-383 Lecture 3-4: Abstraction
CSCI-383 Lecture 3-4: AbstractionCSCI-383 Lecture 3-4: Abstraction
CSCI-383 Lecture 3-4: Abstraction
 
BIS09 Application Development - III
BIS09 Application Development - IIIBIS09 Application Development - III
BIS09 Application Development - III
 

Kürzlich hochgeladen

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Kürzlich hochgeladen (20)

Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 

C++ Unit_01

  • 1. Objectives In this lesson, you will learn to: Explain the features of object-oriented methodology Describe the phases of object-oriented methodology Create classes in C++
  • 2. Complexity of the Software System Internal Complexity Arises from the composition of a system itself External Complexity Arises from the fact that users themselves have only a vague idea of how their system works and have difficulty in expressing their requirements
  • 3. Reasons for the Complexity Involved in the Development of Software Difficulty in managing the software development process Lack of standards for developing software Difficulty in predicting software behavior
  • 4. Simplifying Complexity Is done by breaking the system into its component parts and arranging them in a hierarchy
  • 5. Just a Minute… Jane has called a technician to repair her television. How would the technician deal with the complexity of the television?
  • 6. Object Is an instance of a class that exhibits some well- defined behavior
  • 7. Characteristics of Objects State Is indicated by a set of attributes and the values of these attributes Behavior Is indicated by how an object acts and reacts Identity Distinguishes the object from all other objects
  • 8. Just a Minute… Identify the possible attributes to define the state of the following objects: Tea cup Stereo tape-recorder
  • 9. Classes P E A C O C K S P A R R O W K I N G F I S H E R B I R D S Define the attributes and behaviors of an object Example:
  • 10. Messages and Methods Messages: Are transmitted by one object to another Are transmitted as requests for an action to be taken Are accompanied by additional information needed to carry out the request
  • 11. Messages and Methods (Contd.) Methods: Are a set of actions taken by the receiver object in response to the request
  • 12. Just a Minute… Dr. James and Mr. Hyde went to the railway station to book two tickets in the Flying express for 3rd December by AC 1st class. Identify the following: a.The possible receiver of the message in this situation b.The possible method that the receiver can use
  • 13. Benefits of the Object-Oriented Approach Realistic modeling Easy to use Reusability Saves time and cost
  • 14. Just a Minute… State whether the following situations demonstrate reusability: a. Recycling paper b. Pump reusability (same pump is used in a well and in a fuel station)
  • 15. Benefits of Object-Oriented Approach (Contd.) Resilience to change Easy to maintain Parts of the system can be refined without any major change in other parts
  • 16. Object-Oriented Analysis (OOA) Analysis: Is a phase where users and developers get together and arrive at a common understanding of the system Requires the developer to concentrate on obtaining maximum possible information about the problem domain Results in one of the end products as specification of the function of the system
  • 17. Object-Oriented Design (OOD) Design: Generates the blueprint of the system that has to be implemented Involves identifying classes using Abbott’s technique
  • 18. Object-Oriented Design (OOD) (Contd.) Abbott’s technique follows the listed steps: Write English description of the problem Underline nouns (nouns represent candidate classes)
  • 19. Object-Oriented Programming (OOP) Is a way of writing programs Some applications built using OOP techniques are: Computer-Aided Design (CAD) Computer-Aided Manufacturing (CAM) Artificial Intelligence (AI) and Expert Systems Object-Oriented Databases
  • 20. Just a Minute… As a member of a team that is developing the billing system software for Diaz Telecommunications Inc., you have been assigned the task of creating a software module that accepts and displays customer details. Identify the class that you will create and the methods of the class.
  • 21. Generations of Computer Languages First generation Second generation Third generation
  • 22. Evolution of C++ as an Object Oriented Programming Language In the early 1980s, Bjarne Stroustrup developed the C++ language C++ was originally known as 'C with classes'
  • 23. Creating Classes in C++ Sample: class Car { public: void honk() { cout<<"BEEP BEEP!"; } };
  • 24. Creating Classes in C++ (Contd.) The class keyword Is used to declare a class Example: class Car { ... };
  • 25. Creating Classes in C++ (Contd.) Conventions for naming classes Should be meaningful Should ideally be a noun First letter of every word should be in upper case Rules for naming classes Must not contain any embedded space or symbol Must begin with a letter, which may be followed by a sequence of letters or digits Cannot be a keyword
  • 26. Creating Classes in C++ (Contd.) Member functions Are means of passing messages and responding to them Are declared inside the class body Example: class Car { void honk() { cout<<"BEEP BEEP!"; } };
  • 27. Creating Classes in C++ (Contd.) The cout object Is an instance of the pre-defined class, ostream The endl manipulator Is a command that takes the cursor to the new line
  • 28. Problem Statement 1.D.1 As a member of a team that is developing the billing system software for Diaz Telecommunications Inc., you have been assigned the task of creating a software module that accepts and displays customer details. Declare the Customer class and the member functions. The member function to accept customer details should display the message “Accepting Customer Details”. Similarly, the member function to display customer details on the screen should display the message “Displaying Customer Details.”
  • 29. Problem Statement 1.D.1 (Contd.) Solution: class Customer { void accept() { cout << “Accepting Customer Details” << endl; } void display() { cout << “Displaying Customer Details” << endl; } };
  • 30. Problem Statement 1.P.1 As a member of a team that is developing an automated booking system for the Railways, you have been assigned the task of creating a module that accepts the details of a passenger and checks whether the ticket has been confirmed or is in the waiting list. The module then prints the list of confirmed passengers. Declare a class Ticket, which consists of three member functions, booking(), status(), and print().
  • 31. Summary In this lesson, you learned that: Complexity of software arises mainly due to four reasons: Difficulty in understanding the intricacies and complexity of the system and its needs Communication problems during development Lack of standards for developing software Difficulty in predicting software behavior One way of dealing with the complexity of software is to break down an application into its components and deal with each component separately
  • 32. Summary (Contd.) The object-oriented approach views the systems as consisting of component objects and looks at the interactions between them An object is an entity that may have a physical boundary and is also characterized by the following: State Behavior Identity A class consists of a set of objects that share a common structure and behavior If one object desires an action from another object, it sends a message to the second object
  • 33. Summary (Contd.) The object that receives the message is called the receiver; the set of actions taken by the receiver constitutes the method The benefits of the object-oriented approach are: Realistic modelling, hence it is easier to use Reusability of code, hence it saves time and cost Resilience to change, hence systems are easier to maintain In the stages of analysis and design, a model of the system is built
  • 34. Summary (Contd.) The purpose of the model built during analysis and design is to help developers understand the reality that they are trying to imitate Bjarne Stroustrup developed the C++ language in the early 1980s The cout object is an instance of the class, ostream The class ostream is associated with the standard output device (screen) The output operator '<<' is used to direct a value to the standard output device