Csci 490 / Engr 596 Special Topics / Special Projects Software Design and Scala Programming Spring Semester 2010 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,
1 Lecture 11 Interfaces and Exception Handling from Chapters 9 and 10.
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.
Georgia Institute of Technology Workshop for CS-AP Teachers Chapter 3 Advanced Object-Oriented Concepts.
Chapter 10: Introduction to Inheritance
Chapter 1 Object-Oriented System Development
L3-1-S1 OO Concepts © M.E. Fayad SJSU -- CMPE Software System Engineering Dr. M.E. Fayad, Professor Computer Engineering Department, Room.
7M701 1 Software Engineering Object-oriented Design Sommerville, Ian (2001) Software Engineering, 6 th edition: Chapter 12 )
Encapsulation, Inheritance & Interfaces CSE 115 Spring 2006 February 27, March 1 & 3, 2006.
1 SWE Introduction to Software Engineering Lecture 23 – Architectural Design (Chapter 13)
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Software Development Software Life Cycle UML Diagrams.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. slide 1 CS 125 Introduction to Computers and Object- Oriented Programming.
CS 106 Introduction to Computer Science I 04 / 16 / 2010 Instructor: Michael Eckmann.
©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 1 Introduction to Object-Oriented Programming and Software Development.
©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.
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.
CSE 413 Programming Languages & Implementation Hal Perkins Autumn 2012 Ruby: Multiple Inheritance, Interfaces, Mixins 1.
Introduction To System Analysis and design
Engr 691 Special Topics in Engineering Science Software Architecture Spring Semester 2004 Lecture Notes.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Chapter 1: Introduction to Object-Oriented Programming.
1 Dept. of Computer Science & Engineering, York University, Toronto CSE3311 Software Design Adapter Pattern Façade pattern.
Mapping Component Specifications to Enterprise JavaBeans Implementations Yi Liu and H. Conrad Cunningham Software Architecture Research Group Department.
Introduction To System Analysis and Design
11 Chapter 11 Object-Oriented Databases Database Systems: Design, Implementation, and Management 4th Edition Peter Rob & Carlos Coronel.
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.
CSCI-383 Object-Oriented Programming & Design Lecture 13.
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.
CS 4310: Software Engineering Lecture 4 System Modeling The Analysis Stage.
Instructor: Tasneem Darwish1 University of Palestine Faculty of Applied Engineering and Urban Planning Software Engineering Department Object Oriented.
Chapter 8 - Additional Inheritance Concepts and Techniques1 Chapter 8 Additional Inheritance Concepts and Techniques.
Chapter 12 Support for Object oriented Programming.
Lecture 12 March 16, The Scope of a Variable What if there are two variables with the same name? –A local or block-local variable can have the same.
Csci 490 / Engr 596 Special Topics / Special Projects Software Design and Scala Programming Spring Semester 2010 Lecture Notes.
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.
CSCI-383 Object-Oriented Programming & Design Lecture 10.
5.0 Objects First with Java A Practical Introduction using BlueJ David J. Barnes Michael Kölling.
Csci 490 / Engr 596 Special Topics / Special Projects Software Design and Scala Programming Spring Semester 2010 Lecture Notes.
Object-Oriented Programming Chapter Chapter
Internet and Intranet Protocols and Applications Lecture 5a: HTTP Client-Server Design and Implementation February 15, 2005 Arthur Goldberg Computer Science.
Csci 490 / Engr 596 Special Topics / Special Projects Software Design and Scala Programming Spring Semester 2010 Lecture Notes.
Boris Milašinović Faculty of Electrical Engineering and Computing University of Zagreb, Croatia 15th Workshop on "Software Engineering Education and Reverse.
Csci 490 / Engr 596 Special Topics / Special Projects Software Design and Scala Programming Spring Semester 2010 Lecture Notes.
CSCI 383 Object-Oriented Programming & Design Lecture 19 Martin van Bommel.
Engr 691 Special Topics in Engineering Science Software Architecture Spring Semester 2004 Lecture Notes.
Class Relationships Lecture Oo07 Generalization Relationships.
COP 4331 – OOD&P Lecture 7 Object Concepts. What is an Object Programming language definition: An instance of a class Design perspective is different.
Csci 490 / Engr 596 Special Topics / Special Projects Software Design and Scala Programming Spring Semester 2010 Lecture Notes.
Engr 691 Special Topics in Engineering Science Software Architecture Spring Semester 2004 Lecture Notes.
CSCI 383 Object-Oriented Programming & Design Lecture 15 Martin van Bommel.
Chapter 5 – System Modeling Lecture 1 1Chapter 5 System modeling.
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
Advanced Java Programming
Objects First with Java A Practical Introduction using BlueJ
Objects First with Java A Practical Introduction using BlueJ
Presentation transcript:

Csci 490 / Engr 596 Special Topics / Special Projects Software Design and Scala Programming Spring Semester 2010 Lecture Notes

Multiple Inheritance This is a set of slides to accompany chapter 13 of Timothy Budd's book An Introduction to Object-Oriented Programming, Second Edition (Addison-Wesley, 1997) Created: 14 August 2004, Revised: 9 March 2010

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 1

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

Solutions Make Number subclass of Magnitude, but redefine comparison operators in class Complex to print error message  Subclassing for limitation Don't use inheritance at all, redefine all operators in all classes  Flattening the inheritance tree Use inheritance for some relationships, but simulate others  Use Number, but each number implements all relational operators Make Number and Magnitude independent, and have Integer inherit from both  Multiple inheritance 3

Inheritance as a Form of Combination Magnitude Number Char Integer Complex 4

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 5

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? 6

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 OutStream InOutStream Stream 7

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 {... } 8

Multiple Inheritance in Scala Scala supports multiple “mixin” inheritance of traits but not of classes 8

Acknowledgement 9 This work was supported by a grant from Acxiom Corporation titled “The Acxiom Laboratory for Software Architecture and Component Engineering (ALSACE).”