Engr 691 Special Topics in Engineering Science Software Architecture Spring Semester 2004 Lecture Notes.

Slides:



Advertisements
Similar presentations
Engr 691 Special Topics in Engineering Science Software Architecture Spring Semester 2004 Lecture Notes.
Advertisements

Engr 691 Special Topics in Engineering Science Software Architecture Spring Semester 2004 Lecture Notes.
Multiple Inheritance CMPS Inheritance Heart of concept of inheritance is the is-a relationship But in the real world, objects classified in multiple,
Chapter 7 Testing Class Hierarchies. SWE 415 Chapter 7 2 Reading Assignment  John McGregor and David A. Sykes, A Practical Guide to Testing Object-Oriented.
David Evans CS200: Computer Science University of Virginia Computer Science Lecture 23: Inheritance.
CS 106 Introduction to Computer Science I 04 / 11 / 2008 Instructor: Michael Eckmann.
Georgia Institute of Technology Workshop for CS-AP Teachers Chapter 3 Advanced Object-Oriented Concepts.
Object Oriented Programming Chapter 7 Programming Languages by Ravi Sethi.
Chapter 10: Introduction to Inheritance
CS 106 Introduction to Computer Science I 11 / 26 / 2007 Instructor: Michael Eckmann.
Fall 2007CS 225 Introduction to Software Design Chapter 1.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Software Development Software Life Cycle UML Diagrams.
CS 106 Introduction to Computer Science I 11 / 20 / 2006 Instructor: Michael Eckmann.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. slide 1 CS 125 Introduction to Computers and Object- Oriented Programming.
Slide 1 Systems Analysis & Design CS183 Spring Semester 2008 Dr. Jonathan Y. Clark Course Website:
CS 106 Introduction to Computer Science I 04 / 16 / 2010 Instructor: Michael Eckmann.
1 Software Testing and Quality Assurance Lecture 28 – Testing Class Hierarchies.
©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. COMPSCI 125 Introduction to Computer Science I.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. slide 1 CS 125 Introduction to Computers and Object- Oriented Programming.
Object-Oriented Thinking Chapter 1, Object-Oriented Programming in Java, Timothy Budd, 1998 ICS102 Semester
7M701 1 Class Diagram advanced concepts. 7M701 2 Characteristics of Object Oriented Design (OOD) objectData and operations (functions) are combined 
CS 106 Introduction to Computer Science I 11 / 19 / 2007 Instructor: Michael Eckmann.
Marcelo Santos – OOAD-CDT309, Spring 2008, IDE-MdH 1 Object-Oriented Analysis and Design - CDT309 Period 4, Spring 2008 Object-oriented concepts.
©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. COMPSCI 125 Introduction to Computer Science I.
©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 1 Introduction to Object-Oriented Programming and Software Development.
Review CSC 171 FALL 2004 LECTURE 21. Topics Objects and Classes Fundamental Types Graphics and Applets Decisions Iteration Designing Classes Testing and.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Chapter 1 Introduction to Object-Oriented Programming.
©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 1 Introduction to Object-Oriented Programming and Software Development.
Object-Oriented Design 2 Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
CSE 115 / 503 Introduction to Computer Science I
5.0 Objects First with Java A Practical Introduction using BlueJ David J. Barnes Michael Kölling.
CSCI-383 Object-Oriented Programming & Design Lecture 15.
Engr 691 Special Topics in Engineering Science Software Architecture Spring Semester 2004 Lecture Notes.
1 Dept. of Computer Science & Engineering, York University, Toronto CSE3311 Software Design Adapter Pattern Façade pattern.
5.0 Objects First with Java A Practical Introduction using BlueJ Introduction to Computer Science I Instructor: Allyson Anderson.
Course Introduction Software Engineering
11 Chapter 11 Object-Oriented Databases Database Systems: Design, Implementation, and Management 4th Edition Peter Rob & Carlos Coronel.
CS 106 Introduction to Computer Science I 04 / 20 / 2007 Instructor: Michael Eckmann.
1 COSC3557: Object-Oriented Programming Haibin Zhu, Ph. D. Associate Professor of CS, Nipissing University.
CS 46B: Introduction to Data Structures June 16 Class Meeting Department of Computer Science San Jose State University Summer 2015 Instructor: Ron Mak.
Engr 691 Special Topics in Engineering Science Software Architecture Spring Semester 2004 Lecture Notes.
Csci 490 / Engr 596 Special Topics / Special Projects Software Design and Scala Programming Spring Semester 2010 Lecture Notes.
1 COSC2767: Object-Oriented Programming Haibin Zhu, Ph. D. Professor of CS, Nipissing University.
CSCI-383 Object-Oriented Programming & Design Lecture 19.
SFDV4001 / OOP with C++ / Lecture 4 / Polymorphism 1 L4: Multiple Inheritance Introduction Problems of Single Inheritance and solutions Problems of Multiple.
Object Oriented Programming Principles Lecturer: Kalamullah Ramli Electrical Engineering Dept. University of Indonesia Session-3.
Instructor: Tasneem Darwish1 University of Palestine Faculty of Applied Engineering and Urban Planning Software Engineering Department Object Oriented.
Csci 490 / Engr 596 Special Topics / Special Projects Software Design and Scala Programming Spring Semester 2010 Lecture Notes.
Chapter 8 - Additional Inheritance Concepts and Techniques1 Chapter 8 Additional Inheritance Concepts and Techniques.
Chapter 12 Support for Object oriented Programming.
CSE 341, S. Tanimoto Java brief review - 1 Java Brief Review Java’s strengths Object-oriented terminology Inheritance Interfaces An example with inheritance.
CSSE501 Object-Oriented Development. Chapter 13: Multiple Inheritance  In this chapter we will investigate some of the problems that can arise when a.
5.0 Objects First with Java A Practical Introduction using BlueJ David J. Barnes Michael Kölling.
CS 151: Object-Oriented Design October 15 Class Meeting Department of Computer Science San Jose State University Fall 2013 Instructor: Ron Mak
Csci 490 / Engr 596 Special Topics / Special Projects Software Design and Scala Programming Spring Semester 2010 Lecture Notes.
Csci 490 / Engr 596 Special Topics / Special Projects Software Design and Scala Programming Spring Semester 2010 Lecture Notes.
Banaras Hindu University. A Course on Software Reuse by Design Patterns and Frameworks.
CSCI 383 Object-Oriented Programming & Design Lecture 19 Martin van Bommel.
Csci 490 / Engr 596 Special Topics / Special Projects Software Design and Scala Programming Spring Semester 2010 Lecture Notes.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide 4- 1.
CSCI 383 Object-Oriented Programming & Design Lecture 15 Martin van Bommel.
Java Interfaces CS 21a: Introduction to Computing I Department of Information Systems and Computer Science Ateneo de Manila University (see Chapter 9 of.
Programming in Java: lecture 7
Software Engineering Fall 2005
Csci 490 / Engr 596 Special Topics / Special Projects Software Design and Scala Programming Spring Semester 2010 Lecture Notes.
Lecture 21: Inheritance CS200: Computer Science University of Virginia
Objects First with Java A Practical Introduction using BlueJ
Inheritance and Polymorphism
Objects First with Java A Practical Introduction using BlueJ
Presentation transcript:

Engr 691 Special Topics in Engineering Science Software Architecture Spring Semester 2004 Lecture Notes

Multiple Inheritance This Web document was based on a set of slides created by the instructor for use in the Fall 1997 and Spring 1999 offerings of the object-oriented design and programming course. That set was, in turn, based on a set of slides created by Timothy Budd to supplement chapter 13 of his textbook An Introduction to Object-Oriented Programming, Second Edition (Addison-Wesley, 1997)

Orthogonal Classifications Objects often characterized in different ways that are orthogonal to each other For example, the instructor is  North American  Male  Professor  Computer scientist None of these are proper subsets of each other Cannot be placed into an inheritance hierarchy

CS Example: Complex Numbers Two abstract classifications:  Magnitude : things that can be compared to each other things that can be compared to each other  Number : things that can perform arithmetic things that can perform arithmetic Three specific classes:  Integer : comparable and arithmetic comparable and arithmetic  Char : comparable but not arithmetic comparable but not arithmetic  Complex : arithmetic but not comparable arithmetic but not comparable

Solutions 1. Make Number subclass of Magnitude, but redefine comparison operators in class Complex to print error message – subclassing for limitation 2. Don't use inheritance at all, redefine all operators in all classes – flattening the inheritance tree 3. Use inheritance for some relationships, but simulate others – use Number, but each number implements all relational operators 4. Make Number and Magnitude independent, and have Integer inherit from both – multiple inheritance

Inheritance as a Form of Combination ____ Char ____ Char ____| ____| | Magnitude <--| Magnitude <--| | |____ |____ ____ Integer ____ Integer ____| ____| | Number <--| Number <--| | |____ |____ |____ Complex |____ Complex

Another Example: Cascading Menus A Menu is structure charged with displaying itself when selected by users A Menu maintains collection of MenuItem s Each MenuItem knows how to respond when selected A cascading menu is both a MenuItem and Menu

Multiple Inheritance: Name Ambiguity Problem What happens when same name used in both parent classes? A CardDeck knows how to draw (select) a Card A GraphicalItem knows how to draw (display) an image on screen A GraphicalCardDeck should be able to draw – but which?

Multiple Inheritance: Common Ancestors? What happens when parent classes have common root ancestor? Does new object have one or two instances of common ancestor? ____ InStream ____ ____ InStream ____ ____| |____ ____| |____ | | | | Stream <--| |<-- InOutStream Stream <--| |<-- InOutStream |____ ____| |____ ____| |____ OutStream ____| |____ OutStream ____|

Multiple Inheritance in Java Java supports multiple inheritance of interfaces (subtypes) but not of classes (subclasses) interface A {... } interface B {... } interface AB extends A, B {... } interface C {... } class X {... } class Y extends X implements AB, C {... }