© 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
Eiffel: Analysis, Design and Programming Bertrand Meyer (Nadia Polikarpova) Chair of Software Engineering.
Advertisements

© Bertrand Meyer and Yishai Feldman Notice Some of the material is taken from Object-Oriented Software Construction, 2nd edition, by Bertrand Meyer (Prentice.
Ch 7 B.
Chair of Software Engineering Concurrent Object-Oriented Programming Prof. Dr. Bertrand Meyer Exercise Session 1: Eiffel Introduction.
Object-Oriented Software Construction Bertrand Meyer 2nd ed., Prentice Hall, 1997.
Loops in LabVIEW (while,for and case)
Programming with Alice Computing Institute for K-12 Teachers Summer 2011 Workshop.
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 Lecture 15: Exception handling.
Java Programming, 3e Concepts and Techniques Chapter 5 Arrays, Loops, and Layout Managers Using External Classes.
-5- Exception handling What is an exception? “An abnormal event” Not a very precise definition Informally: something that you don’t want to happen.
Chair of Software Engineering Einführung in die Programmierung Introduction to Programming Prof. Dr. Bertrand Meyer Lecture 17: Topological Sort Algorithm.
Slide 6B.1 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. An Introduction to Object-Oriented Systems Analysis and Design with.
Chair of Software Engineering ATOT - Lecture 17, 28 May Advanced Topics in Object Technology Bertrand Meyer.
Chair of Software Engineering Software Architecture Bertrand Meyer ETH Zurich, February-May 2009 Lecture 1: Introduction.
Chair of Software Engineering Einführung in die Programmierung Introduction to Programming Prof. Dr. Bertrand Meyer Lecture 18: Undo/Redo.
Chair of Software Engineering OOSC - Summer Semester Object-Oriented Software Construction Bertrand Meyer Lecture 6: Genericity.
CS241 PASCAL I - Control Structures1 PASCAL I - Control Structures Philip Fees CS241.
Chair of Software Engineering ATOT - Lecture 7, 23 April Advanced Topics in Object Technology Bertrand Meyer.
Activity Diagrams and State Charts for detailed modeling Larman, chapters 28 and 29 CSE 432: Object-Oriented Software Engineering Glenn D. Blank.
- SEARCHING - SORTING.  Given:  The array  The search target: the array element value we are looking for  Algorithm:  Start with the initial array.
Chapter 2.1 Program Design and Documentation. Summary System/Program specifications System/Program design –Top-down & Bottom-up design –Object Oriented.
C++ Programming: Program Design Including Data Structures, Fourth Edition Chapter 5: Control Structures II (Repetition)
Repetition Statements Repeating an Action A specified number of times While a Condition is True Until a Condition is True.
CIS Computer Programming Logic
Chapter 5: Control Structures II (Repetition)
CHAPTER 5: CONTROL STRUCTURES II INSTRUCTOR: MOHAMMAD MOJADDAM.
© 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.
08/10/ Iteration Loops For … To … Next. 208/10/2015 Learning Objectives Define a program loop. State when a loop will end. State when the For.
Okinawa International Hotel Management System. Overview Currently at the Okinawa International hotel, routine procedures like; vacant room inquiry, reservation.
© Bertrand Meyer and Yishai Feldman Notice Some of the material is taken from Object-Oriented Software Construction, 2nd edition, by Bertrand Meyer (Prentice.
+ ARRAYS - SEARCHING - SORTING Dr. Soha S. Zaghloul updated by Rasha M. AL_Eidan 2015.
Object-Oriented Program Development Using Java: A Class-Centered Approach, Enhanced Edition.
Array Cs212: DataStructures Lab 2. Array Group of contiguous memory locations Each memory location has same name Each memory location has same type a.
111 Protocols CS 4311 Wirfs Brock et al., Designing Object-Oriented Software, Prentice Hall, (Chapter 8) Meyer, B., Applying design by contract,
© 2011 Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of Stewart Venit ~ Elizabeth Drake Developing a Program.
Introduction to Objects MIS 3501: Management Information Systems Paul Weinberg Adapted from material by David Schuff, and Paul Weinberg.
Software Testing Reference: Software Engineering, Ian Sommerville, 6 th edition, Chapter 20.
30/10/ Iteration Loops Do While (condition is true) … Loop.
Chapter 5 Control Structure (Repetition). Objectives In this chapter, you will: Learn about repetition (looping) control structures Explore how to construct.
Chapter 5: Control Structures II (Repetition). Objectives In this chapter, you will: – Learn about repetition (looping) control structures – Learn how.
CMP-MX21: Lecture 5 Repetitions Steve Hordley. Overview 1. Repetition using the do-while construct 2. Repetition using the while construct 3. Repetition.
Practical Programming COMP153-08S Week 5 Lecture 1: Screen Design Subroutines and Functions.
1 CSCD 326 Data Structures I Software Design. 2 The Software Life Cycle 1. Specification 2. Design 3. Risk Analysis 4. Verification 5. Coding 6. Testing.
UFCEKS-20-2Multimedia Authoring Times Table Quiz.
JavaScript, Fourth Edition
Two Forms Please use speaker notes for additional information!
GUI development with Matlab: GUI Front Panel Components GUI development with Matlab: Other GUI Components 1 Other GUI components In this section, we will.
ITI 1120 Lab #5 Contributors: S. Boyd, R. Plesa, A. Felty, D. Inkpen, A. Williams, D. Amyot.
Copyright Curt Hill The C/C++ switch Statement A multi-path decision statement.
Protocols Software Engineering II Wirfs Brock et al, Designing Object-Oriented Software, Prentice Hall, Mitchell, R., and McKim, Design by Contract,
© Bertrand Meyer and Yishai Feldman Notice Some of the material is taken from Object-Oriented Software Construction, 2nd edition, by Bertrand Meyer (Prentice.
Ch. 5 Ch. 51 jcmt Summer 2003Programming Languages CSE3302 Programming Languages (more notes) Summer 2003 Dr. Carter Tiernan.
© Bertrand Meyer and Yishai Feldman Notice Some of the material is taken from Object-Oriented Software Construction, 2nd edition, by Bertrand Meyer (Prentice.
Programming Fundamentals I Java Programming Spring 2009 Instructor: Xuan Tung Hoang TA: Tran Minh Trung Lab 03.
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.
C++ Programming: From Problem Analysis to Program Design, Fourth Edition Chapter 5: Control Structures II (Repetition)
31/01/ Selection If selection construct.
UFCFY5-30-1Multimedia Studio Scripting for Interactive Media Times Table Quiz This will contribute towards your online portfolio for this module.
9. ITERATIONS AND LOOP STRUCTURES Rocky K. C. Chang October 18, 2015 (Adapted from John Zelle’s slides)
Liang, Introduction to Programming with C++, Second Edition, (c) 2010 Pearson Education, Inc. All rights reserved Chapter 4 Loops.
C++ Programming: From Problem Analysis to Program Design, Fifth Edition Chapter 5: Control Structures II (Repetition)
© 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.
Chair of Software Engineering Software Architecture Prof. Bertrand Meyer, Dr. Michela Pedroni ETH Zurich, February-May 2010 Lecture 1: Introduction.
Topic 4: Looping Statements
Do While (condition is true) … Loop
Language Constructs Construct means to build or put together. Language constructs refers to those parts which make up a high level programming language.
Test Design Techniques Software Testing: IN3240 / IN4240
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 Design Pattern: Multi-Panel Interactive Systems

© Bertrand Meyer and Yishai Feldman Transition Diagram

© Bertrand Meyer and Yishai Feldman First Attempt B Enquiry : “Display Enquiry on flights panel” repeat “Read user’s answers and choice C for the next step” if “Error in answer” then “Output appropriate message” end until not “error in answer” end “Process answer” case C in C 0 : goto Exit C 1 : goto B Help C 2 : goto B Reservation  end

© Bertrand Meyer and Yishai Feldman Transition Table

© Bertrand Meyer and Yishai Feldman Top-Down Functional Decomposition

© Bertrand Meyer and Yishai Feldman Execute_session execute_session is -- Execute a complete session of the interactive system local state, choice: INTEGER do state := initial repeat execute_state (state,  next) -- Routine execute_state updates the value of next. state := transition (state, next) until is_final (state) end end

© Bertrand Meyer and Yishai Feldman Execute_state execute_state (in s: INTEGER; out c: INTEGER) is -- Execute the actions associated with state s, -- returning into c the user’s choice for the next state. local a: ANSWER; ok: BOOLEAN do repeat display (s) read (s,  a) ok := correct (s, a) if not ok then message (s, a) end until ok end process (s, a) c := next_choice (a) end

© Bertrand Meyer and Yishai Feldman Function Signatures execute_state(in s: STATE; out c: CHOICE) display(in s: STATE) read(in s: STATE; out a: ANSWER) correct(in s: STATE; a: ANSWER): BOOLEAN message(in s: STATE; a: ANSWER) process(in s: STATE; a: ANSWER)

© Bertrand Meyer and Yishai Feldman Data Flow

© Bertrand Meyer and Yishai Feldman Revenge of the Data inspect s when Initial then  when Enquiry_on_flights then  end

© Bertrand Meyer and Yishai Feldman STATE Features

© Bertrand Meyer and Yishai Feldman STATE Class — Overview class STATE feature input: ANSWER choice: INTEGER execute is do  end display is  read is  correct: BOOLEAN is  message is  process is  end

© Bertrand Meyer and Yishai Feldman STATE Class (1) indexing description: "States for interactive panel-driven applications" deferred class STATE feature -- Access choice: INTEGER -- User’s choice for next step input: ANSWER -- User’s answer to questions asked in this state. feature -- Status report correct: BOOLEAN is -- Is input a correct answer? deferred end feature -- Basic operations display is -- Display panel associated with current state. deferred end

© Bertrand Meyer and Yishai Feldman STATE Class (2) execute is -- Execute actions associated with current state -- and set choice to denote user’s choice for next state. local ok: BOOLEAN do from ok := False until ok loop display; read; ok := correct if not ok then message end end process ensure ok end

© Bertrand Meyer and Yishai Feldman STATE Class (3) message is -- Output error message corresponding to input. require not correct deferred end read is -- Obtain user’s answer into input and choice into choice. deferred end process is -- Process input. require correct deferred end end -- class STATE

© Bertrand Meyer and Yishai Feldman A Specific State class ENQUIRY_ON_FLIGHTS inherit STATE feature display is do  Specific display procedure  end  And similarly for read, correct, message and process  end -- class ENQUIRY_ON_FLIGHTS

© Bertrand Meyer and Yishai Feldman STATE and APPLICATION Features

© Bertrand Meyer and Yishai Feldman Application Class (1) indexing description: "Interactive panel-driven applications" class APPLICATION creation make feature -- Initialization make (n, m: INTEGER) is -- Allocate application with n states and m possible choices. do !! transition. make (1, n, 1, m) !! associated_state. make (1, n) end feature -- Access initial: INTEGER -- Initial state’s number

© Bertrand Meyer and Yishai Feldman Application Class (2) feature -- Basic operations execute is -- Perform a user session local st: STATE; st_number: INTEGER do from st_number := initial until st_number = 0 loop st := associated_state. item (st_number) st. execute -- This refers to the execute procedure of STATE st_number := transition. item (st_number, st. choice) end

© Bertrand Meyer and Yishai Feldman Application Class (3) feature -- Element change put_state (st: STATE; sn: INTEGER) is -- Enter state st with index sn. require 1 <= sn; sn <= associated_state. upper do associated_state. put (st, sn) end choose_initial (sn: INTEGER) is -- Define state number sn as the initial state. require 1 <= sn; sn <= associated_state. upper do initial := sn end

© Bertrand Meyer and Yishai Feldman Application Class (4) put_transition (source, target, label: INTEGER) is -- Enter transition labeled label -- from state number source to state number target. require 1 <= source; source <= associated_state. upper 0 <= target; target <= associated_state. upper 1 <= label; label <= transition. upper2 do transition. put (source, label, target) end

© Bertrand Meyer and Yishai Feldman Application Class (5) feature {NONE} -- Implementation transition: ARRAY2 [INTEGER] associated_state: ARRAY [STATE]  Other features  invariant transition. upper1 = associated_state. upper end -- class APPLICATION

© Bertrand Meyer and Yishai Feldman A Polymorphic Array of States

© Bertrand Meyer and Yishai Feldman Building an Application  Creating an application object: !! air_reservation. make (number_of_states, number_of_possible_choices)  Defining the states and numbering them: air_reservation. put_state (s, i).  Choosing an initial state: air_reservation. choose_initial (i 0 )  Setting up transitions: air_reservation. enter_transition (sn, tn, l)  Executing the application: air_reservation. execute.