Chapter 11 Inheritance © 2008 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved. Marilyn Bohl/Maria Rynn Tools for Structured and Object-Oriented.

Slides:



Advertisements
Similar presentations
Introduction to Object Orientation System Analysis and Design
Advertisements

Chapter 4 - Object-Oriented Analysis and Design in a Nutshell1 Chapter 4 Object-Oriented Analysis and Design in a Nutshell.
Systems Analysis and Design 8th Edition
Chapter 22 Object-Oriented Systems Analysis and Design and UML Systems Analysis and Design Kendall and Kendall Fifth Edition.
Paul Deitel, CEO Deitel & Associates, Inc.. Contact Information  Paul Deitel, CEO  Deitel & Associates, Inc.  Twitter:  Facebook:
2-1 © Prentice Hall, 2007 Chapter 2: Introduction to Object Orientation Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph.
1 Software Testing and Quality Assurance Lecture 12 - The Testing Perspective (Chapter 2, A Practical Guide to Testing Object-Oriented Software)
UML – Class Diagrams.
Irwin/McGraw-Hill Copyright © 2004 The McGraw-Hill Companies. All Rights reserved Whitten Bentley DittmanSYSTEMS ANALYSIS AND DESIGN METHODS6th Edition.
Principles of Object-Oriented Software Development Unified Modeling Language.
©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 1 Introduction to Object-Oriented Programming and Software Development.
©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 1 Introduction to Object-Oriented Programming and Software Development.
2-1 © Prentice Hall, 2004 Chapter 2: Introduction to Object Orientation (Adapted) Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra,
UML and Object Oriented Concepts
Unified Modeling Language(UML) BY
The Unified Modeling Language (UML) Class Diagrams.
 2008 Pearson Education, Inc. All rights reserved (Optional) Software Engineering Case Study: Incorporating Inheritance into the ATM System UML.
An Introduction to Models & The UML The Unified Modeling Language Copyright © 2007 Patrick McDermott College of Alameda Not really.
OBJECT ORIENTED PROGRAMMING CONCEPTS ISC 560. Object-oriented Concepts  Objects – things names with nouns  Classes – classifications (groups) of similar.
Introduction to UML 1 Quick Tour Why do we model? What is the UML? Foundation elements Unifying concepts Language architecture Relation to other OMG technologies.
CIT UPES | Sept 2013 | Unified Modeling Language - UML.
The Software Development Life Cycle: An Overview Presented by Maxwell Drew and Dan Kaiser Southwest State University Computer Science Program.
CHAPTER ONE Problem Solving and the Object- Oriented Paradigm.
SOFTWARE DESIGN AND ARCHITECTURE LECTURE 18. Review User interface Design principles Design Guidelines.
Introduction to UML By: Prof. Aiman Hanna Department of Computer Science, Concordia University, Montreal, Canada.
Copyright 2002 Prentice-Hall, Inc. Modern Systems Analysis and Design Third Edition Jeffrey A. Hoffer Joey F. George Joseph S. Valacich Chapter 20 Object-Oriented.
Slide 1 UML Review Chapter 2: Introduction to Object-Oriented Systems Analysis and Design with the Unified Modeling Language, Version 2.0 Alan Dennis,
Unified Modeling Language, Version 2.0
Object-Oriented Software Development F Software Development Process F Analyze Relationships Among Objects F Class Development F Class Design Guidelines.
© 2009 Pearson Education, Inc. Publishing as Prentice Hall 1 Chapter 15: Object-Oriented Data Modeling Modern Database Management 9 h Edition Jeffrey A.
Chapter 5 Models and UML Notation for The Object-Oriented Approach.
Systems Analysis & Design 7 th Edition Chapter 5.
Systems Analysis and Design 8 th Edition Chapter 6 Object Modeling.
ניתוח מערכות מידע 1 Unified Modeling Language (UML) § § The Unified Modeling Language (UML) is the industry-standard language for: Specifying, Visualizing,
Fall 2010 CS4310 Requirements Engineering A Brief Review of UML & OO Dr. Guoqiang Hu Department of Computer Science UTEP 1.
Copyright © 2013 Curt Hill UML Unified Modeling Language.
Slide 1 Systems Analysis and Design With UML 2.0 An Object-Oriented Approach, Second Edition Chapter 2: Introduction to Object-Oriented Systems Analysis.
Introduction to UML CS A470. What is UML? Unified Modeling Language –OMG Standard, Object Management Group –Based on work from Booch, Rumbaugh, Jacobson.
The Unified Modeling Language (UML)
Unified Modelling Language (UML) Software Engineering Lab. Sharif University of Technology.
Chapter 10: Introduction to Inheritance. Objectives Learn about the concept of inheritance Extend classes Override superclass methods Call constructors.
©2007 · Georges Merx and Ronald J. NormanSlide 1 Chapter 15 The Unified Modeling Language: a Primer.
Lecture 9-1 : Intro. to UML (Unified Modeling Language)
Slide 1 Systems Analysis and Design With UML 2.0 An Object-Oriented Approach, Second Edition Chapter 2: Introduction to Object-Oriented Systems Analysis.
Chapter 12 Object-oriented design for more than one class.
Systems Analysis and Design in a Changing World, Thursday, Feb 15.
Week 04 Object Oriented Analysis and Designing. What is a model? A model is quicker and easier to build A model can be used in simulations, to learn more.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved Chapter 11 Object-Oriented.
1 Unified Modeling Language, Version 2.0 Chapter 2.
INFSY 535.  Small systems  Larger systems 1.Understand the program requirement- what 3. Write and test each part (unit testing) 4. Maintenance 2. Specify.
Chapter 2: Introduction to Object Orientation Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich, Jeffrey A.
UML Course Instructor: Rizwana Noor. Overview  Modeling  What is UML?  Why UML?  UML Diagrams  Use Case  Components  Relationships  Notations.
Object-Oriented Software Engineering Practical Software Development using UML and Java Modelling with Classes.
Copyright © 2009 Pearson Education, Inc. Publishing as Prentice Hall Appendix A Object-Oriented Analysis and Design A.1.
CS 501: Software Engineering Fall 1999 Lecture 15 Object-Oriented Design I.
Basic Characteristics of Object-Oriented Systems
SWE 214 (071) Introduction to UML Slide 1 Introduction to UML.
CHAPTER 6 OBJECT ANALYSIS.
1 An Overview of UML. 2 The Unified Modeling Language UML is a graphical language used by software engineers to model software systems during development.
Slide 1 Unified Modeling Language, Version 2.0 Object-Oriented SAD.
Chapter 3 IFTHENELSE Control Structure © 2008 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved. Marilyn Bohl/Maria Rynn Tools for Structured.
Systems Analysis and Design With UML 2
Chapter 11 Object-Oriented Design
Introduction to Unified Modeling Language (UML)
Systems Analysis and Design With UML 2
University of Central Florida COP 3330 Object Oriented Programming
Domain Class Diagram Chapter 4 Part 2 pp
Introduction to UML.
Software Engineering System Modeling Chapter 5 (Part 1) Dr.Doaa Sami
ADVANCED OBJECT-ORIENTED PROGRAMMING
Presentation transcript:

Chapter 11 Inheritance © 2008 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved. Marilyn Bohl/Maria Rynn Tools for Structured and Object-Oriented Design, 7e

Introduction Classes can have certain relationships with other classes.  Inheritance enables sharing of identifications and descriptions

Generalizations/Specialization Suppose we want to deal with objects at a less abstract level.  The vehicle class and the car class have a generalization/specialization relationship.  When two classes have a generalization/specialization relationship, the more specific class is always fully consistent with the more general class and contains additional information.

Inheritance  Allows us to define a very general class and then later define more specialized classes.

A Generalization/Specialization Relationship

Class Diagram—Employee Example

Class Diagram—Employee Example cont.

Class Hierarchy Base class  Contains data members and methods that apply to all employees.  A base class may also be called a parent class or a superclass.  Unfilled arrow symbols in the class diagram indicate the generalization/specialization relationships.

Class Hierarchy The Faculty and Staff derived from the base class Employee.  Derived classes, child classes, or subclasses.  “is-a” relationship  A faculty member is a kind of employee.  Class hierarchy A family of classes that are related.  Overriding The process of reimplementing in a subclass a method inherited from a base class.

Polymomrphism Polymorphic method  A method that has the same name as a method in another class within the same class hierarchy.  Which method is wanted is stated explicitly in the method invocation. Faculty.ComputePay Staff.ComputePay  Polymorphism—Greek word meaning “many forms”.

Employee Class Pseudocode

Faculty Subclass Pseudocode

Faculty Subclass Pseudocode cont.

Staff Subclass Pseudocode

Staff Subclass Pseudocode cont.

Faculty Subclass Pseudocode— Fully Instantiated View

Faculty Subclass Pseudocode— Fully Instantiated View cont.

Staff Subclass Pseudocode—Fully Instantiated View

Staff Subclass Pseudocode—Fully Instantiated View cont.

Employee Class Driver

Employee Class Driver Output

Sample Problem 11.1 A Structure for Bank Account Processing  Construct a high-level class diagram to suggest how classes might be organized to simplify the design and implementation of the required processing for the accounts. Standard Checking, Prime Checking, Access Checking, Student Checking, Regular Savings, and Maximize Interest Savings

Class Diagram—Account Example

Class Diagram—Account Example cont.

Sample Problem 11.2 Implementing the Account Class  Define an Account class that can be used as the base class.

Class Diagram—Account Class

Account Class Pseudocode

Account Class Pseudocode cont.

Account Class Driver

Account Class Driver Output

Sample Problem 11.3 Implementing the Standard Checking Class  Define a Standard Checking Account class to process deposits and withdrawals to a Standard Checking Account. If an attempt is made to withdraw more funds than are currently in the account, the withdrawal is refused, and an overdraft fee (currently $35.00) is deducted from the account. If, after a withdrawal is made from the account, the new balance is less than the minimum balance to a void a fee per transaction (currently $100.00), a transaction fee (currently $3.00) is deducted from the account.

Class Diagram—Account Inheritance Example

Class Diagram—Account Inheritance Example cont.

Standard Checking Account Class Pseudocode

Standard Checking Account Class Pseudocode cont.

Abstract Class Suppose we decide to implement the base class Account as a way of grouping together all of the classes for the various types of accounts we may want to process.  Descendants of the Account class need to support a withdrawal type of behavior but not to write the plan for a specific implementation of Withdrawal in the base class Account.

Abstract Class A class in which one or more of the methods is identified but not defined is called an abstract class.  You cannot create any objects of a base class that is an abstract class.  You must define a method for any method not defined in the abstract class in any subclass you create.  Non-abstract classes are concrete classes.

Account Class as an Abstract Class Pseudocode

Account Class as an Abstract Class Pseudocode cont.

Unified Modeling Language (UML)‏ Unified Modeling Language or UML  Industry-standard language for specifying, visualizing, and documenting object-oriented design.  Created to simplify and consolidate the large number of object-oriented development practices led by IBM Rational Software's Grady Booch, Ivar Jacobson, and Jim Rumbaugh.  UML 1.1 was adopted unanimously as a standard by the Object Management Group (OMG)‏  UML 2.0 is the current OMG standard.

Unified Modeling Language (UML)‏ Thirteen type of diagrams, grouped within three categories:  Structure Diagrams emphasize what things must be (or are) in the system being modeled; Class Diagram Object Diagram Component Diagram Composite Structure Diagram Package Diagram Deployment Diagram.

Unified Modeling Language (UML)‏  Behavior Diagrams emphasize what must happen (or happens) in the system being modeled; Use Case Diagram Activity Diagram State Machine Diagram.  Interaction Diagrams emphasize the flow of control and data among the things being modeled; Derived from the more general Behavior Diagram,  Sequence Diagram  Communication Diagram  Timing Diagram,  Interaction Overview Diagram.

Unified Modeling Language (UML)‏ UML methodology independent does not encompass the definition of a standard development process.