© Bertrand Meyer and Yishai Feldman Notice Some of the material is taken from Object-Oriented Software Construction, 2nd edition, by Bertrand Meyer (Prentice.

Slides:



Advertisements
Similar presentations
Chair of Software Engineering Einführung in die Programmierung Introduction to Programming Prof. Dr. Bertrand Meyer Exercise Session 5.
Advertisements

© Bertrand Meyer and Yishai Feldman Notice Some of the material is taken from Object-Oriented Software Construction, 2nd edition, by Bertrand Meyer (Prentice.
©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 12Slide 1 Software Design l Objectives To explain how a software design may be represented.
Chair of Software Engineering Einführung in die Programmierung Introduction to Programming Prof. Dr. Bertrand Meyer Lecture 7: References and Assignment.
Chair of Software Engineering OOSC - Summer Semester Object-Oriented Software Construction Bertrand Meyer Lecture 3: Abstract Data Types.
Chair of Software Engineering OOSC - Summer Semester Object-Oriented Software Construction Bertrand Meyer.
Object-Oriented Software Construction Bertrand Meyer 2nd ed., Prentice Hall, 1997.
Chapter 22 Object-Oriented Systems Analysis and Design and UML Systems Analysis and Design Kendall and Kendall Fifth Edition.
Solutions to Review Questions. 4.1 Define object, class and instance. The UML Glossary gives these definitions: Object: an instance of a class. Class:
Chair of Software Engineering OOSC - Summer Semester Object-Oriented Software Construction Bertrand Meyer.
Chair of Software Engineering Object-Oriented Software Construction Bertrand Meyer Lesson 16 Last update: 25 May 2004 An O-O design example.
Chair of Software Engineering OOSC - Summer Semester Object-Oriented Software Construction Bertrand Meyer.
Chair of Software Engineering ATOT - Lecture 24, 25 June Advanced Topics in Object Technology Bertrand Meyer.
Chair of Software Engineering OOSC - Summer Semester Object-Oriented Software Construction Bertrand Meyer.
Chair of Software Engineering ATOT - Lecture 12, 12 May Advanced Topics in Object Technology Bertrand Meyer.
Principles of Object-Oriented Software Development The language Eiffel.
Chair of Software Engineering Einführung in die Programmierung Introduction to Programming Prof. Dr. Bertrand Meyer Lecture 6: Object Creation.
Chair of Software Engineering ATOT - Lecture 8, 28 April Advanced Topics in Object Technology Bertrand Meyer.
Chair of Software Engineering OOSC Summer Semester Object-Oriented Software Construction Bertrand Meyer.
Chair of Software Engineering OOSC - Lecture 4 1 Object-Oriented Software Construction Bertrand Meyer.
Chair of Software Engineering OOSC - Summer Semester Object-Oriented Software Construction Bertrand Meyer.
Chair of Software Engineering OOSC - Summer Semester Object-Oriented Software Construction Bertrand Meyer.
Chair of Software Engineering OOSC - Lecture 21 1 Object-Oriented Software Construction Bertrand Meyer.
Chair of Software Engineering ATOT - Lecture 25, 30 June Advanced Topics in Object Technology Bertrand Meyer.
Chair of Software Engineering OOSC - Summer Semester Object-Oriented Software Construction Bertrand Meyer.
Chair of Software Engineering Concurrent Object-Oriented Programming Prof. Dr. Bertrand Meyer Lecture 9: Contracts and Inheritance (based on work with.
Chair of Software Engineering ATOT - Lecture 23, 23 June Advanced Topics in Object Technology Bertrand Meyer.
Chair of Software Engineering OOSC - Summer Semester Object-Oriented Software Construction Bertrand Meyer Lecture 6: Genericity.
Systems Analysis & Design Sixth Edition Systems Analysis & Design Sixth Edition Toolkit Part 5.
Chair of Software Engineering Einführung in die Programmierung Introduction to Programming Prof. Dr. Bertrand Meyer Lecture 6: Object Creation.
Chair of Software Engineering ATOT - Lecture 15, 21 May Advanced Topics in Object Technology Bertrand Meyer.
Chair of Software Engineering Object-Oriented Software Construction Bertrand Meyer Lecture 21: Agents and tuples.
Chair of Software Engineering ATOT - Lecture 22, 18 June Advanced Topics in Object Technology Bertrand Meyer.
Introduction to Object-oriented programming and software development Lecture 1.
BCS 2143 Introduction to Object Oriented and Software Development.
© Bertrand Meyer and Yishai Feldman Notice Some of the material is taken from Object-Oriented Software Construction, 2nd edition, by Bertrand Meyer (Prentice.
© Bertrand Meyer and Yishai Feldman Notice Some of the material is taken from Object-Oriented Software Construction, 2nd edition, by Bertrand Meyer (Prentice.
SWE © Solomon Seifu ELABORATION. SWE © Solomon Seifu Lesson 10 Use Case Design.
Object-Oriented Software Development F Software Development Process F Analyze Relationships Among Objects F Class Development F Class Design Guidelines.
© Bertrand Meyer and Yishai Feldman Notice Some of the material is taken from Object-Oriented Software Construction, 2nd edition, by Bertrand Meyer (Prentice.
© Bertrand Meyer and Yishai Feldman Notice Some of the material is taken from Object-Oriented Software Construction, 2nd edition, by Bertrand Meyer (Prentice.
Contracts for Concurrency - Contracts & Inheritance Aryabrata Basu University of Georgia.
Slide 1 Systems Analysis and Design With UML 2.0 An Object-Oriented Approach, Second Edition Chapter 2: Introduction to Object-Oriented Systems Analysis.
Slide 1 Systems Analysis and Design With UML 2.0 An Object-Oriented Approach, Second Edition Chapter 2: Introduction to Object-Oriented Systems Analysis.
© Bertrand Meyer and Yishai Feldman Notice Some of the material is taken from Object-Oriented Software Construction, 2nd edition, by Bertrand Meyer (Prentice.
1 Unified Modeling Language, Version 2.0 Chapter 2.
© Bertrand Meyer and Yishai Feldman Notice Some of the material is taken from Object-Oriented Software Construction, 2nd edition, by Bertrand Meyer (Prentice.
Department of Computer Science, York University Object Oriented Software Construction 22/01/ :58 AM 1 COSC3311 – Software Design Loop invariant/variant.
Slide 1 Systems Analysis and Design With UML 2.0 An Object-Oriented Approach, Second Edition Chapter 2: Introduction to Object-Oriented Systems Analysis.
1 Case Study Multi-Panel Interactive System. 2 The Problem Domain Build a general type of interactive system  Users interact with a set of panels  Web.
Object-Oriented Software Engineering Practical Software Development using UML and Java Modelling with Classes.
DBC NOTES. Design By Contract l A contract carries mutual obligations and benefits. l The client should only call a routine when the routine’s pre-condition.
© Bertrand Meyer and Yishai Feldman Notice Some of the material is taken from Object-Oriented Software Construction, 2nd edition, by Bertrand Meyer (Prentice.
Programming Logic and Design Fourth Edition, Introductory Chapter 2 Understanding Structure.
Slide 1 Unified Modeling Language, Version 2.0 Object-Oriented SAD.
2-1 © Prentice Hall, 2004 Chapter 2: Introduction to Object Orientation Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph.
Roberta Roth, Alan Dennis, and Barbara Haley Wixom
Design by Contract Jim Fawcett CSE784 – Software Studio
Design by Contract Jim Fawcett CSE784 – Software Studio
Objects First with Java A Practical Introduction using BlueJ
Systems Analysis and Design With UML 2
Arab Open University 2nd Semester, M301 Unit 5
Systems Analysis and Design With UML 2
Computer Programming.
Object-Oriented Analysis
Design by contract Object-Oriented Software Construction by Bertrand Meyer, Prentice Hall The presence of a precondition or postcondition in a routine.
Software Design Lecture : 12.
Software Design Lecture : 14.
Design by contract Object-Oriented Software Construction by Bertrand Meyer, Prentice Hall The presence of a precondition or postcondition in a routine.
Chapter 22 Object-Oriented Systems Analysis and Design and UML
Presentation transcript:

© Bertrand Meyer and Yishai Feldman Notice Some of the material is taken from Object-Oriented Software Construction, 2nd edition, by Bertrand Meyer (Prentice Hall). Included here by permission of ISE, for the benefit of IDC students. Other uses, duplication or distribution require permission from ISE. For more material see

© Bertrand Meyer and Yishai Feldman Ian Sommerville: Software Engineering, 4/e, 1994 Multiple inheritance allows several objects to act as base objects and is supported in object- oriented languages such as Eiffel. The characteristics of several different object classes can be combined to make up a new object. For example, say we have an object class CAR which encapsulates information about cars and an object class PERSON which encapsulates information about people. We could use both of these to define a new object class CAR-OWNER which combines the attributes of CAR and PERSON.

© Bertrand Meyer and Yishai Feldman “He has a head like an Austin Mini with the doors open”

© Bertrand Meyer and Yishai Feldman A Proper Model class CAR_OWNER inherit PERSON feature my_car: CAR  end

© Bertrand Meyer and Yishai Feldman “Is-A” Rule of Inheritance Do not make a class B inherit from a class A unless you can somehow make the argument that one can view every instance of B also as an instance of A.

© Bertrand Meyer and Yishai Feldman To Be Is Also To Have  Every software engineer is an engineer.  In every software engineer there is an engineer.  Every software engineer has an “engineer” component.

© Bertrand Meyer and Yishai Feldman Being and Having class SOFTWARE_ENGINEER_1 inherit ENGINEER feature  end class SOFTWARE_ENGINEER_2 feature the_engineer_in_me: ENGINEER … end class SOFTWARE_ENGINEER_3 feature the_truly_important_part_of_me: VOCATION  end

© Bertrand Meyer and Yishai Feldman Rule of Change Do not use inheritance to describe a perceived “is-a” relation if the corresponding object components may have to be changed at run time.

© Bertrand Meyer and Yishai Feldman Polymorphism Rule Inheritance is appropriate to describe a perceived “is-a” relation if entities or data structure components of the more general type may need to become attached to objects of the more specialized type.

© Bertrand Meyer and Yishai Feldman Choosing Between Client and Inheritance In deciding how to express the dependency of a class B on a class A, apply the following criteria: CI1If every instance of B initially has a component of type A, but that component may need to be replaced at run time by an object of a different type, make B a client of A. CI2If there is a need for entities of type A to denote objects of type B, or for polymorphic structures containing objects of type A of which some may be of type B, make B an heir of A.

© Bertrand Meyer and Yishai Feldman Platform Adaptation Through Inheritance class WINDOW inherit GENERAL_WINDOW PLATFORM_WINDOW feature  end -- class WINDOW

© Bertrand Meyer and Yishai Feldman Platform Adaptation Through Handles

© Bertrand Meyer and Yishai Feldman Using Handles display is -- Display window on screen. do handle. window_display (Current) end set_handle (new: TOOLKIT) is -- Make new the new handle for this object. do handle := new end

© Bertrand Meyer and Yishai Feldman Taxomania Rule Every heir must introduce a feature, redeclare an inherited feature, or add an invariant clause.

© Bertrand Meyer and Yishai Feldman Iterators

© Bertrand Meyer and Yishai Feldman Linear Iterator (1) indexing description: "Objects that are able to iterate over linear structures" names: iterators, iteration, linear_iterators, linear_iteration deferred class LINEAR_ITERATOR [G] inherit ITERATOR [G] redefine target end feature -- Access invariant_value: BOOLEAN is -- The property to be maintained by an iteration (default: true). do Result := True end

© Bertrand Meyer and Yishai Feldman Linear Iterator (2) target: LINEAR [G] -- The structure to which iteration features will apply test: BOOLEAN is -- The boolean condition used to select applicable elements deferred end feature -- Basic operations action is -- The action to be applied to selected elements. deferred end start is -- Move to first position of `target'. require target /= Void do target. start end

© Bertrand Meyer and Yishai Feldman Linear Iterator (3) do_if is -- Apply action in sequence to every item of target that satisfies test. do from start invariant invariant_value until exhausted loop if test then action end forth end ensure then exhausted end  And so on: do_all, do_while, do_until etc.  end -- class LINEAR_ITERATOR

© Bertrand Meyer and Yishai Feldman Application: Justifier class JUSTIFIER inherit LINEAR_ITERATOR [PARAGRAPH] rename action as justify, test as justifiable, do_if as justify_if end feature justify is do  end justifiable is -- Is paragraph subject to justification? do Result := not preformatted end  end -- class JUSTIFIER