Chair of Software Engineering ATOT - Lecture 3, 7 April 2003 1 Advanced Topics in Object Technology Bertrand Meyer.

Slides:



Advertisements
Similar presentations
SCOOP: Simple Concurrent Object-Oriented Programming Extend the pure, strongly typed, object-oriented language Eiffel with a general and powerful concurrency.
Advertisements

Programming Languages and Paradigms
Chair of Software Engineering OOSC - Summer Semester Object-Oriented Software Construction Bertrand Meyer Lecture 3: Abstract Data Types.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 12 Slide 1 Distributed Systems Design 2.
Informática II Prof. Dr. Gustavo Patiño MJ
Programming Languages Marjan Sirjani 2 2. Language Design Issues Design to Run efficiently : early languages Easy to write correctly : new languages.
Chair of Software Engineering OOSC - Summer Semester Object-Oriented Software Construction Bertrand Meyer.
Object-Oriented Software Construction Bertrand Meyer 2nd ed., Prentice Hall, 1997.
Abstract Data Types Data abstraction, or abstract data types, is a programming methodology where one defines not only the data structure to be used, but.
Lecturer: Sebastian Coope Ashton Building, Room G.18 COMP 201 web-page: Lecture.
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 Einführung in die Programmierung Introduction to Programming Prof. Dr. Bertrand Meyer Lecture 17: Topological Sort Algorithm.
Introduction to Software Engineering Lecture 7 André van der Hoek.
Chair of Software Engineering OOSC - Summer Semester Object-Oriented Software Construction Bertrand Meyer Lecture 10: Project Presentation Ilinca.
Chair of Software Engineering ATOT - Lecture 12, 12 May Advanced Topics in Object Technology Bertrand Meyer.
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 ATOT - Lecture 9, 30 April Advanced Topics in Object Technology Bertrand Meyer.
Chair of Software Engineering Einführung in die Programmierung Introduction to Programming Prof. Dr. Bertrand Meyer Lecture 9: Abstraction.
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 Lecture 1: Modularity.
Architectural Design Principles. Outline  Architectural level of design The design of the system in terms of components and connectors and their arrangements.
Chair of Software Engineering ATOT - Lecture 23, 23 June Advanced Topics in Object Technology Bertrand Meyer.
Ch4: Software Architecture and Design. 1 Modules: Interface vs. Implementation (contd..)  Interface design considerations:
WEL COME PRAVEEN M JIGAJINNI PGT (Computer Science) MCA, MSc[IT], MTech[IT],MPhil (Comp.Sci), PGDCA, ADCA, Dc. Sc. & Engg.
1 ES 314 Advanced Programming Lec 2 Sept 3 Goals: Complete the discussion of problem Review of C++ Object-oriented design Arrays and pointers.
Chair of Software Engineering ATOT - Lecture 7, 23 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 Einführung in die Programmierung Introduction to Programming Prof. Dr. Bertrand Meyer Lecture 9: Abstraction.
Course Instructor: Aisha Azeem
Computer Science: A Structured Programming Approach Using C1 Objectives ❏ To understand the basic concepts and uses of arrays ❏ To be able to define C.
C o n f i d e n t i a l Developed By Nitendra NextHome Subject Name: Data Structure Using C Title: Overview of Data Structure.
What is Software Architecture?
MADALINA CROITORU Software Engineering week 4 Madalina Croitoru IUT Montpellier.
1/19 Component Design On-demand Learning Series Software Engineering of Web Application - Principles of Good Component Design Hunan University, Software.
© Bertrand Meyer and Yishai Feldman Notice Some of the material is taken from Object-Oriented Software Construction, 2nd edition, by Bertrand Meyer (Prentice.
Ceg860 (Prasad)L6MR1 Modularity Extendibility Reusability.
ADTs and C++ Ch 2,3,4 May 12, 2015 Abstract Data Type (ADT) An abstract data type is: 1.A collection of data items (storage structures) 2.Basic operations.
Chapter 11 Arrays Continued
1 Compiler Construction (CS-636) Muhammad Bilal Bashir UIIT, Rawalpindi.
1 CSC 222: Object-Oriented Programming Spring 2013 Course goals:  To know and use basic Java programming constructs for object- oriented problem solving.
Programming Languages and Paradigms Imperative Programming.
Object Oriented Design David Talby. Welcome! n Introduction n UML u Use Case Diagrams u Interaction Diagrams u Class Diagrams n Design Patterns u Composite.
Computing and SE II Chapter 9: Design Methods and Design Models Er-Yu Ding Software Institute, NJU.
Data Abstaraction Chapter 10.
Data Structures and Algorithms Dr. Tehseen Zia Assistant Professor Dept. Computer Science and IT University of Sargodha Lecture 1.
PRINCIPLES OF GOOD DESIGN 12/7/ Assignment 4 – Deadline 28 Nov.  Read an article placed in generalshare course folder  Point: Design Patterns.
Thanks for Coming l WEB. Principles of Good Design SEI, SJTU WEB APPS and SERVICES.
Elementary Data Organization. Outline  Data, Entity and Information  Primitive data types  Non primitive data Types  Data structure  Definition 
Hashing Fundamental Data Structures and Algorithms Margaret Reid-Miller 18 January 2005.
Architecture View Models A model is a complete, simplified description of a system from a particular perspective or viewpoint. There is no single view.
Review of Parnas’ Criteria for Decomposing Systems into Modules Zheng Wang, Yuan Zhang Michigan State University 04/19/2002.
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by.
Ada, Scheme, R Emory Wingard. Ada History Department of Defense in search of high level language around Requirements drafted for the language.
SOFTWARE DESIGN & SOFTWARE ENGINEERING Software design is a process in which data, program structure, interface and their details are represented by well.
© Bertrand Meyer and Yishai Feldman Notice Some of the material is taken from Object-Oriented Software Construction, 2nd edition, by Bertrand Meyer (Prentice.
CSC 222: Object-Oriented Programming
CSC 222: Object-Oriented Programming
Course Developer/Writer: A. J. Ikuomola
Software Engineering: A Practitioner’s Approach, 6/e Chapter 11 Component-Level Design copyright © 1996, 2001, 2005 R.S. Pressman & Associates, Inc.
CSC 222: Object-Oriented Programming
Chapter 27 WWW and HTTP.
Software Design Lecture : 12.
Software Design Lecture : 14.
CS 350 – Software Design Principles and Strategies – Chapter 14
Introduction to Data Structure
Software Architecture Prof. Dr. Bertrand Meyer
Principles of Good Design
Presentation transcript:

Chair of Software Engineering ATOT - Lecture 3, 7 April Advanced Topics in Object Technology Bertrand Meyer

Chair of Software Engineering ATOT - Lecture 3, 7 April Reading assignment (OOSC2)  Chapter 6: Abstract data types  Chapter 7: The static structure: classes  Chapter 8: The run-time structure: objects

Chair of Software Engineering ATOT - Lecture 3, 7 April Lecture 3: Modularity, Reusability

Chair of Software Engineering ATOT - Lecture 3, 7 April Agenda for today  Modularity  Reusability

Chair of Software Engineering ATOT - Lecture 3, 7 April Agenda for today  Modularity  Reusability

Chair of Software Engineering ATOT - Lecture 3, 7 April Modularity  Some principles of modularity:  Decomposability  Composability  Continuity  Information hiding  The open-closed principle  The single choice principle

Chair of Software Engineering ATOT - Lecture 3, 7 April Decomposability  Method helps decompose complex problems into subproblems.  COROLLARY: Division of labor.  Example: Top-down design method (see next).  Counter-example: General initialization module.

Chair of Software Engineering ATOT - Lecture 3, 7 April Top-down functional design A BDC C1 I1C2 I2 I Topmost functional abstraction Loop Conditional Sequence

Chair of Software Engineering ATOT - Lecture 3, 7 April  Method favors production of software elements that may be freely combined with each other to produce new software.  Example: Unix shell conventions Program1 | Program2 | Program3 Composability

Chair of Software Engineering ATOT - Lecture 3, 7 April Direct mapping  Method yields software systems whose modular structure remains compatible with any modular structure devised in the process of modeling the problem domain.

Chair of Software Engineering ATOT - Lecture 3, 7 April Few interfaces principle  Every module communicates with as few others as possible. (A)(B)(C)

Chair of Software Engineering ATOT - Lecture 3, 7 April Small interfaces principle  If two modules communicate, they exchange as little information as possible. x, y z

Chair of Software Engineering ATOT - Lecture 3, 7 April Explicit interfaces principle  Whenever two modules A and B communicate, this is obvious from the text of A or B or both. Module AModule B Data item x ModifiesAccesses

Chair of Software Engineering ATOT - Lecture 3, 7 April Continuity  Method ensures that small changes in specifications yield small changes in architecture.  Design method: Specification  Architecture  Example: Principle of Uniform Access (see next)  Counter-example: Programs with patterns after the physical implementation of data structures.

Chair of Software Engineering ATOT - Lecture 3, 7 April The Principle of Uniform Access  Facilities managed by a module are accessible to its clients in the same way whether implemented by computation or by storage.  Definition: A client of a module is any module that uses its facilities.

Chair of Software Engineering ATOT - Lecture 3, 7 April Uniform Access: An example balance = list_of_deposits.total – list_of_withdrawals.total Ada, Pascal, C/C++, Java, C#:Simula, Eiffel: a.balancea.balance balance (a) a.balance() list_of_deposits list_of_withdrawals balance list_of_deposits list_of_withdrawals (A2) (A1)

Chair of Software Engineering ATOT - Lecture 3, 7 April Information hiding  Underlying question: how does one “advertise” the capabilities of a module?  Every module should be known to the outside world through an official, “public” interface.  The rest of the module’s properties comprises its “secrets”.  It should be impossible to access the secrets from the outside.

Chair of Software Engineering ATOT - Lecture 3, 7 April The Information Hiding Principle  The designer of every module must select a subset of the module’s properties as the official information about the module, to be made available to authors of client modules.

Chair of Software Engineering ATOT - Lecture 3, 7 April Information hiding Secret part Public part

Chair of Software Engineering ATOT - Lecture 3, 7 April Information hiding  Justifications:  Continuity  Decomposability

Chair of Software Engineering ATOT - Lecture 3, 7 April The Open-Closed Principle  Modules should be open and closed.  Definitions:  Open module: May be extended.  Closed module: Usable by clients. May be approved, baselined and (if program unit) compiled.  The rationales are complementary:  For closing a module (manager’s perspective): Clients need it now.  For keeping modules open (developer’s perspective): One frequently overlooks aspects of the problem.

Chair of Software Engineering ATOT - Lecture 3, 7 April The Open-Closed Principle (1) ACE D B

Chair of Software Engineering ATOT - Lecture 3, 7 April The Open-Closed Principle (2) ACE D B FA’ G H I

Chair of Software Engineering ATOT - Lecture 3, 7 April The Open-Closed Principle (3) ACE D B FA’ G H I

Chair of Software Engineering ATOT - Lecture 3, 7 April Closing modules prematurely type PUBLICATION = record author, title: STRING; publication_year: INTEGER case pubtype: (book, journal, conference) of book: (publisher: STRING); journal: (editor: STRING); conference: (place, chair: STRING) end end  Use in clients: p: PUBLICATION ; case p.pubtype of book:... p.publisher...; journal:... p.editor...; conference:... p.place... end

Chair of Software Engineering ATOT - Lecture 3, 7 April The Single Choice Principle  Whenever a software system must support a set of alternatives, one and only one module in the system should know their exhaustive list.  Editor: set of commands (insert, delete etc.)  Graphics system: set of figure types (rectangle, circle etc.)  Compiler: set of language constructs (instruction, loop, expression etc.)

Chair of Software Engineering ATOT - Lecture 3, 7 April Agenda for today  Modularity  Reusability

Chair of Software Engineering ATOT - Lecture 3, 7 April Reusability issues  Organizational and managerial issues:  (Not covered here.)  Technical issues: what form of components?  Routine libraries  Packages (Ada)  Class libraries  What form of classes?

Chair of Software Engineering ATOT - Lecture 3, 7 April Reusability: Technical issues  The general pattern for a searching routine: has (t: TABLE; x: ELEMENT): BOOLEAN is -- Does item x appear in table t? local pos: POSITION do from pos := initial_position (t) until exhausted (t, pos) or else found (t, x, pos) loop pos := next (t, pos) end Result := found (t, x, pos) end

Chair of Software Engineering ATOT - Lecture 3, 7 April Issues for a general searching module  Type variation:  What are the table elements?  Routine grouping:  A searching routine is not enough: it should be coupled with routines for table creation, insertion, deletion etc.  Implementation variation:  Many possible choices of data structures and algorithms: sequential table (sorted or unsorted), array, binary search tree, file,...

Chair of Software Engineering ATOT - Lecture 3, 7 April Issues (cont’d)  Representation independence:  Can a client request an operation such as table search (has) without knowing what implementation is used internally? has (t1, y)

Chair of Software Engineering ATOT - Lecture 3, 7 April Issues (cont’d)  Factoring out commonality:  How can the author of supplier modules take advantage of commonality within a subset of the possible implementations?  Example: the set of sequential table implementations.  A common routine text for has: has (....; x: T): BOOLEAN is -- Does x appear in the table? do from start until after or else found (x) loop forth end Result := found (x) end

Chair of Software Engineering ATOT - Lecture 3, 7 April Factoring out commonality 1 item index forth count start after

Chair of Software Engineering ATOT - Lecture 3, 7 April Factoring out commonality TABLE SEQUENTIAL_ TABLE TREE_ TABLE HASH_T ABLE ARRAY_ TABLE LINKED_ TABLE FILE_ TABLE has start after found forth

Chair of Software Engineering ATOT - Lecture 3, 7 April Implementation variants Array Linked list File startforthafterfound (x) c := first_cell rewind i := 1 c := c.right i := i + 1 readend_of_file c := Void f = ξ c.item = x i > countt [i] = x

Chair of Software Engineering ATOT - Lecture 3, 7 April Encapsulation languages (“Object-based”)  Ada, Modula-2, CLU...  Basic idea: gather a group of routines serving a related ee-purpose, such as has, insert, remove etc., together with the appropriate data structure descriptions.  This addresses the Related Routines issue.  Advantages:  For supplier author: Get everything under one roof. Simplifies configuration management, change of implementation, addition of new primitives.  For client author: Find everything at one place. Simplifies search for existing routines, requests for extensions.

Chair of Software Engineering ATOT - Lecture 3, 7 April End of lecture 3