9. Object Design: Specifying Interfaces

Size: px
Start display at page:

Download "9. Object Design: Specifying Interfaces"

Transcription

1 9. Object Design: Specifying Interfaces

2 Outline! An Overview of Object Design! Interface Specification Concepts! Interface Specification Activities

3 1. An Overview of Object Design

4 Object Design! Object design is the process of adding details to the requirements analysis and making implementation decisions! The object designer must choose among different ways to implement the analysis model with the goal to minimize execution time, memory and other measures of cost. Requirements Analysis: The functional model and the dynamic model deliver operations for the object model Object Design: We decide on where to put these operations in the object model! Object design serves as the basis of implementation

5 Object Design: Closing the Gap System Problem Application objects Requirements gap Solution objects Custom objects Object design ga Off-the-shelf components System design g Machine

6 2. Interface Specification Concepts

7 2.1 Developers play different Roles during Object Design Class User Call Class Developer Class Implementor Realize Class Class Extender Refine Class

8 Class user versus Class Extender Developers responsible for the implementation of League are class users of Game Developers responsible for the implementation of Game are class implementors League 1 Game Tournament TicTacToe Chess The developer responsible for the implementation of TicTacToe is a class extender of Game

9 2.2 Specifying Interfaces! Requirements analysis activities Identifying attributes and operations without specifying their types or their parameters.! Object design: Three activities 1. Add visibility information 2. Add type signature information 3. Add contracts

10 1. Add Visibility Information UML defines three levels of visibility:! Private (Class implementor): A private attribute can be accessed only by the class in which it is defined. A private operation can be invoked only by the class in which it is defined. Private attributes and operations cannot be accessed by subclasses or other classes.! Protected (Class extender): A protected attribute or operation can be accessed by the class in which it is defined and on any descendent of the class.! Public (Class user): A public attribute or operation can be accessed by any class.

11 Implementation of UML Visibility in Java Tournament - maxnumplayers: int + getmaxnumplayers():int + getplayers(): List + acceptplayer(p:player) + removeplayer(p:player) + isplayeraccepted(p:player):boolean public class Tournament { private int maxnumplayers; { }; public Tournament(League l, int maxnumplayers) public int getmaxnumplayers() { }; public List getplayers() { }; public void acceptplayer(player p) { }; public void removeplayer(player p) { }; public boolean isplayeraccepted(player p)

12 Information Hiding Heuristics! Carefully define the public interface for classes as well as subsystems (façade)! Always apply the Need to know principle. Only if somebody needs to access the information, make it publicly possible, but then only through well defined channels, so you always know the access.! The fewer an operation knows the less likely it will be affected by any changes the easier the class can be changed! Trade-off: Information hiding vs efficiency Accessing a private attribute might be too slow (for example in real-time systems or games)

13 Information Hiding Design Principles! Only the operations of a class are allowed to manipulate its attributes Access attributes only via operations.! Hide external objects at subsystem boundary Define abstract class interfaces which mediate between system and external world as well as between subsystems! Do not apply an operation to the result of another operation. Write a new operation that combines the two operations.

14 2. Add Type Signature Information -numelements:int +put() +get() +remove() +containskey() +size() Hashtable Attributes and operations without type information are acceptable during analysis Hashtable -numelements:int +put(key:object,entry:object) +get(key:object):object +remove(key:object) +containskey(key:object):boolean +size():int

15 3. Add Contracts! Contracts on a class enable caller and callee to share the same assumptions about the class.! Contracts include three types of constraints: Invariant: A predicate that is always true for all instances of a class. Invariants are constraints associated with classes or interfaces. Precondition: Preconditions are predicates associated with a specific operation and must be true before the operation is invoked. Preconditions are used to specify constraints that a caller must meet before calling an operation. Postcondition: Postconditions are predicates associated with a specific operation and must be true after an operation is invoked. Postconditions are used to specify constraints that the object must ensure after the invocation of the operation.

16 Expressing constraints in UML Models! OCL (Object Constraint Language) OCL allows constraints to be formally specified on single model elements or groups of model elements A constraint is expressed as an OCL expression returning the value true or false. OCL is not a procedural language (cannot constrain control flow).! OCL expressions for Hashtable operation put(): w Invariant: ontext is a class operation put context Hashtable inv: numelements >= 0 w Precondition: OCL expression context Hashtable::put(key, entry) pre:!containskey(key) w Post-condition: context Hashtable::put(key, entry) post: containskey(key) and get(key) = entry

17 Expressing Constraints in UML Models! A constraint can also be depicted as a note attached to the constrained UML element by a dependency relationship. <<invariant>> numelements >= 0 <<precondition>>!containskey(key) <<precondition>> containskey(key) <<precondition>> containskey(key) numelements:int HashTable put(key,entry:object) get(key):object remove(key:object) containskey(key:object):boolean size():int <<postcondition>> get(key) == entry <<postcondition>>!containskey(key)

18 Contract for acceptplayer in Tournament context Tournament::acceptPlayer(p) pre: not isplayeraccepted(p) context Tournament::acceptPlayer(p) pre: getnumplayers() < getmaxnumplayers() context Tournament::acceptPlayer(p) post: isplayeraccepted(p) context Tournament::acceptPlayer(p) post: getnumplayers() + 1

19 Contract for removeplayer in Tournament context Tournament::removePlayer(p) pre: isplayeraccepted(p) context Tournament::removePlayer(p) post: not isplayeraccepted(p) context Tournament::removePlayer(p) post: getnumplayers() - 1

20 Annotation of Tournament class public class Tournament { / The maximum number of players is positive at all maxnumplayers > 0 / private int maxnumplayers; / The players List contains references to Players who are are registered with the Tournament. / private List players; / Returns the current number of players in the tournament. / public int getnumplayers() { } / Returns the maximum number of players in the tournament. / public int getmaxnumplayers() { } / The acceptplayer() operation assumes that the specified player has not been accepted in the getnumplayers() + 1 / public void acceptplayer (Player p) { } / The removeplayer() operation assumes that the specified player is currently in the isplayeraccepted(p) getnumplayers() - 1 / public void removeplayer(player p) { } }

21 Constraints can involve more than one class How do we specify constraints on more than one class?

22 3 Types of Navigation through a Class Diagram 1. Local attribute 2. Directly related class 3. Indirectly related class Tournament start:date end:date League Player League Tournament Player Any OCL constraint for any class diagram can be built using only a combination of these three navigation types!

23 ARENA Example: League, Tournament and Player League +start:date +end:date +getactiveplayers() {ordered} tournaments Tournament +start:date +end:date +acceptplayer(p:player) tournaments players Player +name:string + string players

24 Model Refinement with 3 additional Constraints! A Tournament s planned duration must be under one week.! Players can be accepted in a Tournament only if they are already registered with the corresponding League.! The number of active Players in a League are those that have taken part in at least one Tournament of the League.! To better understand these constraints we instantiate the class diagram for a specific group of instances 2 Leagues, 2 Tournaments and 5 Players

25 Instance Diagram: 2 Leagues, 2 Tournaments, and 5 Players tttexpert:league chessnovice:league winter:tournament start=dec 21 end=dec 22 xmas:tournament start=dec 23 end=dec 25 alice:player bob:player marc:player joe:player zoe:player

26 Specifying the Model Constraints Local attribute navigation context Tournament inv: end - start <= Calendar.WEEK Directly related class navigation context Tournament::acceptPlayer (p) pre: league.players->includes(p) League +start:date +end:date +getactiveplayers() {ordered} tournaments Tournament +start:date +end:date +acceptplayer(p:player) tournaments players Player +name:string + string players

27 Specifying the Model Constraints Local attribute navigation context Tournament inv: end - start <= Calendar.WEEK Directly related class navigation context Tournament::acceptPlayer(p) pre: league.players->includes(p) Indirectly related class navigation context League::getActivePlayers post: result = tournaments.players->asset League +start:date +end:date +getactiveplayers() {ordered} tournaments Tournament +start:date +end:date +acceptplayer(p:player) tournaments players Player +name:string + string players

28 OCL supports Quantification! OCL forall quantifier / All Matches in a Tournament occur within the Tournament s time frame / context Tournament inv: matches->forall(m:match m.start.after(t.start) and m.end.before(t.end))! OCL exists quantifier / Each Tournament conducts at least one Match on the first day of the Tournament / context Tournament inv: matches->exists(m:match m.start.equals(start))

29 3. Interface Specification Activities

30 Interface Specification Activities! Identifying Missing Attributes and Operations! Specifying Type Signatures and Visibility! Specifying Preconditions and Postconditions! Specifying Invariants! Inheriting Contracts

31 (1) Identifying Missing Attributes and Operations TournamentForm applyfortournament() 1 1 TournamentControl selectsponsors() advertizetournament() acceptplayer() announcetournament() 1 1 Tournament players name start end sponsors Player acceptplayer() removeplayer() schedule() Advertiser start status matches Match matches playmove() getscore()

32 A sequence diagram for the applyfortournament() operation :Player :TournamentForm :TournamentControl t:tournament p:player applyfortournament(p) isplayeroverbooked(p) getstartdate() Prevent applying concurrent tournaments getenddate() gettournaments() tournaments

33 (2) Specifying Types, Signatures and Visibility TournamentForm +applyfortournament() 1 1 TournamentControl +selectsponsors(advertisers):list +advertizetournament() +acceptplayer(p) +announcetournament() +isplayeroverbooked():boolean 1 1 Tournament players +name:string +start:date +end:date sponsors Player matches Match +start:date +status:matchstatus +playmove(p,m) +getscore():map matches +acceptplayer(p) +removeplayer(p) +schedule() Advertiser

34 3 Pre- and post-conditions for ordering operations on TournamentControl context TournamentControl::selectSponsors(advertisers) pre: interestedsponsors->notempty and tournament.sponsors->isempty context TournamentControl::selectSponsors(advertisers) post: tournament.sponsors.equals(advertisers) context TournamentControl::advertiseTournament() pre: tournament.sponsors->isempty and not tournament.advertised context TournamentControl::advertiseTournament() post: tournament.advertised context TournamentControl::acceptPlayer(p) pre: tournament.advertised and interestedplayers->includes(p) and not isplayeroverbooked(p) context TournamentControl::acceptPlayer(p) post: tournament.players->includes(p) TournamentControl +selectsponsors(advertisers):list +advertizetournament() +acceptplayer(p) +announcetournament() +isplayeroverbooked():boolean

35 4 Specifying invariants on Tournament and Tournament Control! All Matches of in a Tournament must occur within the time frame of the Tournament context Tournament inv: matches->forall(m m.start.after(start) and m.start.before(end))! No Player can take part in two or more Tournaments that overlap context TournamentControl inv: tournament.players->forall(p p.tournaments->forall(t t <> tournament implies not t.overlap(tournament)))

36 Specifying invariants on Match Player players tournaments Tournament players Match matches! A match can only involve players who are accepted in the tournament context Match inv: players->forall(p p.tournaments->exists(t t.matches->includes(self))) context Match inv: players.tournaments.matches.includes(self)

37 Summary! There are three different roles for developers during object design Class user, class implementor and class extender! During object design - and only during object design - we specify visibility rules! Constraints are boolean expressions on model elements! Contracts are constraints on a class enable class users, implementors and extenders to share the same assumption about the class ( Design by contract )! OCL is a language that allows us to express constraints on UML models! Complicated constratins involving more than one class, attribute or operation can be expressed with 3 basic navigation types.

38 Thanks Some materials come from Bernd Bruegge s PPT

Chapter 9 Object Design: Specifying Interfaces

Chapter 9 Object Design: Specifying Interfaces Using UML, Patterns, and Java Object-Oriented Software Engineering Chapter 9 Object Design: Specifying Interfaces Object Design Object design is the process of adding details to the requirements analysis

More information

Chapter 9, Object Design: Specifying Interfaces

Chapter 9, Object Design: Specifying Interfaces Using UML, Patterns, and Java Object-Oriented Software Engineering Chapter 9, Object Design: Specifying Interfaces Lecture Plan Specifying Interfaces (Chapter 9) Object Design Activities Visibilities and

More information

Chapter 8, Object Design: Object Constraint Language

Chapter 8, Object Design: Object Constraint Language Object-Oriented Software Engineering Using UML, Patterns, and Java Chapter 8, Object Design: Object Constraint Language Outline of the Lecture OCL Simple predicates Preconditions Postconditions Contracts

More information

5C. Examples of OCL in use, especially in "Object Design: Specifying Interfaces"

5C. Examples of OCL in use, especially in Object Design: Specifying Interfaces 5C. Examples of OCL in use, especially in "Object Design: Specifying Interfaces" Note: This section is based heavily on Chapter 9 of the very useful text book Object- Oriented Software Engineering by Bruegge

More information

Course "Softwaretechnik" Book Chapters 9, 10 Object Design: Specifying Interfaces, Model-to-implementation mapping

Course Softwaretechnik Book Chapters 9, 10 Object Design: Specifying Interfaces, Model-to-implementation mapping Course "Softwaretechnik" Book Chapters 9, 10 Object Design: Specifying Interfaces, Model-to-implementation mapping Lutz Prechelt, Bernd Bruegge & Allen H. Dutoit Freie Universität Berlin, Institut für

More information

Chapter 9, Object Design: Specifying Interfaces

Chapter 9, Object Design: Specifying Interfaces Chapter 9, Object Design: Specifying Interfaces Using UML, Patterns, and Java Object-Oriented Software Engineering Specifying Interfaces Requirements analysis activities Identifying attributes and operations

More information

Lecture Notes on. Object Design. Object Design. Bill Scherlis / Bernd Brügge Software Engineering Fall October November 1999

Lecture Notes on. Object Design. Object Design. Bill Scherlis / Bernd Brügge Software Engineering Fall October November 1999 v 8 September 1994 Lecture Notes on Object Design Object Design Bill Scherlis / Bernd Brügge 15-413 Software Engineering Fall 1999 21 October 1999 2 November 1999 Bruegge/Software 15-413 Software Engineering

More information

CSSE 490 Model-Based Software Engineering: Introduction to MetaModels

CSSE 490 Model-Based Software Engineering: Introduction to MetaModels CSSE 490 Model-Based Software Engineering: Introduction to MetaModels Shawn Bohner Office: Moench Room F212 Phone: (812) 877-8685 Email: bohner@rose-hulman.edu Learning Outcomes: Transformations Define

More information

Software Engineering Fall 2015 (CSC 4350/6350) TR. 5:30 pm 7:15 pm. Rao Casturi 11/03/2015

Software Engineering Fall 2015 (CSC 4350/6350) TR. 5:30 pm 7:15 pm. Rao Casturi 11/03/2015 Software Engineering Fall 2015 (CSC 4350/6350) TR. 5:30 pm 7:15 pm Rao Casturi 11/03/2015 http://cs.gsu.edu/~ncasturi1 Object Design Software Engineering -CSC4350/6350 - Rao Casturi 2 Object Design Close

More information

Software Engineering Fall 2014

Software Engineering Fall 2014 Software Engineering Fall 2014 (CSC 4350/6350) Mon.- Wed. 5:30 pm 7:15 pm ALC : 107 Rao Casturi 11/03/2014 Re Cap - Object Design Close the gap between the application objects and the off-the shelf components.

More information

10. Mapping Models to Code

10. Mapping Models to Code 10. Mapping Models to Code Outline! Overview! Mapping Concepts! Mapping Activities! Case Study 1. Overview! Object design is situated between system design and implementation. Object design is not very

More information

Chapter 10, Mapping Models to Code

Chapter 10, Mapping Models to Code Chapter 10, Mapping Models to Code Using UML, Patterns, and Java Object-Oriented Software Engineering Overview Object design is situated between system design and implementation. Object design is not very

More information

Agenda. More on the Unified Modeling Language. UML diagram types. Packages

Agenda. More on the Unified Modeling Language. UML diagram types. Packages Agenda More on the Unified Modeling Language Perdita Stevens, University of Edinburgh July 2010 And the rest... deployment diagrams, component diagrams, object diagrams, timing diagrams, etc. OCL and alternatives

More information

Chapter 5, Analysis: Dynamic Modeling

Chapter 5, Analysis: Dynamic Modeling Object-Oriented Software Engineering Using UML, Patterns, and Java Chapter 5, Analysis: Dynamic Modeling ü Requirements Elicitation (Ch.4) ü Introduction (Ch 1-3) OOSE- Galaxy ü Nonfunctional Requirements

More information

Fortgeschrittene objektorientierte Programmierung (Advanced Object-Oriented Programming)

Fortgeschrittene objektorientierte Programmierung (Advanced Object-Oriented Programming) 2014-03-07 Preface Fortgeschrittene objektorientierte Programmierung (Advanced Object-Oriented Programming) Coordinates: Lecturer: Web: Studies: Requirements: No. 185.211, VU, 3 ECTS Franz Puntigam http://www.complang.tuwien.ac.at/franz/foop.html

More information

Chapter 4 Defining Classes I

Chapter 4 Defining Classes I Chapter 4 Defining Classes I This chapter introduces the idea that students can create their own classes and therefore their own objects. Introduced is the idea of methods and instance variables as the

More information

Specification-based Testing of Embedded Systems H. Schlingloff, SEFM 2008

Specification-based Testing of Embedded Systems H. Schlingloff, SEFM 2008 SEFM School 2008 Specification-based Testing of Embedded Systems Prof. Dr. Holger Schlingloff Humboldt-Universität zu Berlin and Fraunhofer FIRST, Berlin Lecture 5: OCL, ParTeG Course Outline L1: Introduction

More information

Chapter 10, Mapping Models to Relational Schema

Chapter 10, Mapping Models to Relational Schema Object-Oriented Software Engineering Using UML, Patterns, and Java Chapter 10, Mapping Models to Relational Schema Lecture Plan Last lecture: Operations on the object model: Optimizations to address performance

More information

Formal Methods in Software Engineering 1

Formal Methods in Software Engineering 1 Building Models with OCL Introduction Completing UML Diagrams Modeling Tips and Hints Summary Formal Methods in Software Engineering 1 What Is a Model? Simply put, a model is a high level system description.

More information

JML Class Specifications The Java Modeling Language (Part 2) A Java Class

JML Class Specifications The Java Modeling Language (Part 2) A Java Class JML Class Specifications The Java Modeling Language (Part 2) Wolfgang Schreiner Wolfgang.Schreiner@risc.jku.at Research Institute for Symbolic Computation (RISC) Johannes Kepler University, Linz, Austria

More information

7. Implementation Phase. 7.1 Architecture Diagrams 7.2 OO Languages: Java 7.3 Constraint Languages: OCL

7. Implementation Phase. 7.1 Architecture Diagrams 7.2 OO Languages: Java 7.3 Constraint Languages: OCL 7. Implementation Phase 7.1 Architecture Diagrams 7.2 OO Languages: Java 7.3 Constraint Languages: OCL Architecture Design Models An architecture model (structure model) is a model of a data processing

More information

The Java Modeling Language (Part 2)

The Java Modeling Language (Part 2) The Java Modeling Language (Part 2) Wolfgang Schreiner Wolfgang.Schreiner@risc.jku.at Research Institute for Symbolic Computation (RISC) Johannes Kepler University, Linz, Austria http://www.risc.jku.at

More information

Outline. iterator review iterator implementation the Java foreach statement testing

Outline. iterator review iterator implementation the Java foreach statement testing Outline iterator review iterator implementation the Java foreach statement testing review: Iterator methods a Java iterator only provides two or three operations: E next(), which returns the next element,

More information

ATTENTION TO COME/ISE 491/492 STUDENT

ATTENTION TO COME/ISE 491/492 STUDENT ATTENTION TO COME/ISE 491/492 STUDENT 151 As a part of your requirement analysis section in your final report, you should write a requirement analysis document (RAD). The details of the document, and a

More information

340 Review Fall Midterm 1 Review

340 Review Fall Midterm 1 Review 340 Review Fall 2016 Midterm 1 Review Concepts A. UML Class Diagrams 1. Components: Class, Association (including association name), Multiplicity Constraints, General Constraints, Generalization/Specialization,

More information

Introduction to Software Engineering. 5. Modeling Objects and Classes

Introduction to Software Engineering. 5. Modeling Objects and Classes Introduction to Software Engineering 5. Modeling Objects and Classes Roadmap > UML Overview > Classes, attributes and operations > UML Lines and Arrows > Parameterized Classes, Interfaces and Utilities

More information

Assertions, pre/postconditions

Assertions, pre/postconditions Programming as a contract Assertions, pre/postconditions Assertions: Section 4.2 in Savitch (p. 239) Specifying what each method does q Specify it in a comment before method's header Precondition q What

More information

Orthographic Software Modeling A Practical Approach to View Based Development

Orthographic Software Modeling A Practical Approach to View Based Development Orthographic Software Modeling A Practical Approach to View Based Development Colin Atkinson University of Mannheim Germany MSI 2009 7 th October 2009 Oldenburg Outline Modern software engineering paradigms

More information

Assignment 2 - Specifications and Modeling

Assignment 2 - Specifications and Modeling Assignment 2 - Specifications and Modeling Exercise 1 A way to document the code is to use contracts. For this exercise, you will have to consider: preconditions: the conditions the caller of a method

More information

Chapter 5, Analysis: Dynamic Modeling

Chapter 5, Analysis: Dynamic Modeling Object-Oriented Software Engineering Using UML, Patterns, and Java Chapter 5, Analysis: Dynamic Modeling ü Requirements Elicitation (Ch.4) ü Introduction (Ch 1-3) OOSE- Galaxy ü Nonfunctional Requirements

More information

The Java Modeling Language JML

The Java Modeling Language JML The Java Modeling Language JML Néstor Cataño ncatano@puj.edu.co Faculty of Engineering Pontificia Universidad Javeriana The Java Modelling Language JML p.1/47 Lecture Plan 1. An Introduction to JML 2.

More information

Architectural Models and Styles Component-Based Software Engineering ECE493-Topic 5 Winter 2007 Lecture 12 The Object Constraint Language (Part A)

Architectural Models and Styles Component-Based Software Engineering ECE493-Topic 5 Winter 2007 Lecture 12 The Object Constraint Language (Part A) Component-Based Software Engineering ECE493-Topic 5 Winter 2007 Lecture 12 The Object Constraint Language (Part A) Ladan Tahvildari Assistant Professor Dept. of Elect. & Comp. Eng. University of Waterloo

More information

Advances in Programming Languages

Advances in Programming Languages T O Y H Advances in Programming Languages APL4: JML The Java Modeling Language David Aspinall (slides originally by Ian Stark) School of Informatics The University of Edinburgh Thursday 21 January 2010

More information

Defining Classes and Methods

Defining Classes and Methods Defining Classes and Methods Chapter 5 Modified by James O Reilly Class and Method Definitions OOP- Object Oriented Programming Big Ideas: Group data and related functions (methods) into Objects (Encapsulation)

More information

Defining Classes and Methods

Defining Classes and Methods Defining Classes and Methods Chapter 5 Objects and References: Outline Variables of a Class Type Defining an equals Method for a Class Boolean-Valued Methods Parameters of a Class Type Variables of a Class

More information

Introduction to Software Testing Chapter 2.4 Graph Coverage for Design Elements Paul Ammann & Jeff Offutt

Introduction to Software Testing Chapter 2.4 Graph Coverage for Design Elements Paul Ammann & Jeff Offutt Introduction to Software Testing Chapter 2.4 Graph Coverage for Design Elements Paul Ammann & Jeff Offutt www.introsoftwaretesting.com OO Software and Designs Emphasis on modularity and reuse puts complexity

More information

Advanced JML Erik Poll Radboud University Nijmegen

Advanced JML Erik Poll Radboud University Nijmegen JML p.1/23 Advanced JML Erik Poll Radboud University Nijmegen JML p.2/23 Core JML Remember the core JML keywords were requires ensures signals invariant non null pure \old, \forall, \result JML p.3/23

More information

Chapter 10 Object-Oriented Design Principles

Chapter 10 Object-Oriented Design Principles Chapter 10 Object-Oriented Design Principles Dr. Supakit Nootyaskool Faculty of Information Technology King Mongkut s Institute of Technology Ladkrabang Outline Object-oriented design: bridging from analysis

More information

Formal Specification and Verification

Formal Specification and Verification Formal Specification and Verification Formal Specification, Part III Bernhard Beckert Adaptation of slides by Wolfgang Ahrendt Chalmers University, Gothenburg, Sweden Formal Specification and Verification:

More information

Formale Entwicklung objektorientierter Software

Formale Entwicklung objektorientierter Software Formale Entwicklung objektorientierter Software Praktikum im Wintersemester 2008/2009 Prof. P. H. Schmitt Christian Engel, Benjamin Weiß Institut für Theoretische Informatik Universität Karlsruhe 5. November

More information

Specification-based Testing of Embedded Systems H. Schlingloff, SEFM 2008

Specification-based Testing of Embedded Systems H. Schlingloff, SEFM 2008 SEFM School 2008 Specification-based Testing of Embedded Systems Prof. Dr. Holger Schlingloff Humboldt-Universität zu Berlin and Fraunhofer FIRST, Berlin Lecture 4: Mutations, OCL etc. Course Outline L1:

More information

Formal Methods in Software Engineering 1

Formal Methods in Software Engineering 1 Today s Agenda Quiz 1 on next Tue. Quick Review Finish Program Proof Introduction to OCL Formal Methods in Software Engineering 1 Quick Review What is the difference between first-order logic and propositional

More information

Chapter 5, Analysis: Dynamic Modeling

Chapter 5, Analysis: Dynamic Modeling Using UML, Patterns, and Java Object-Oriented Software Engineering Chapter 5, Analysis: Dynamic Modeling An overview of OOSE development activities and their products Problem Statement Requirements Elicitation

More information

Chapter 8, Object Design: Reusing Pattern Solutions

Chapter 8, Object Design: Reusing Pattern Solutions Object-Oriented Software Engineering Using UML, Patterns, and Java Chapter 8, Object Design: Reusing Pattern Solutions Application Objects and Solution Objects Application objects, also called domain objects,

More information

5. Defining Classes and Methods

5. Defining Classes and Methods 5. Defining Classes and Methods Harald Gall, Prof. Dr. Institut für Informatik Universität Zürich http://seal.ifi.uzh.ch/info1 Objectives Describe and define concepts of class, class object Describe use

More information

Model-based Development of Web Services using Design-by-Contract

Model-based Development of Web Services using Design-by-Contract Model-based Development of Web Services using Design-by-Contract Reiko Heckel University of Leicester, UK Lesster Joint work with M. Lohmann, A. Cherchago, J.H. Hausmann, Paderborn, TU Berlin, 5. 12. 2005

More information

SLIDES: Introductory Modeling Example Employing UML and OCL [UML: Unified Modeling Language, OCL:Object Constarint Language]

SLIDES: Introductory Modeling Example Employing UML and OCL [UML: Unified Modeling Language, OCL:Object Constarint Language] Lecture day 2016-04-07 SLIDES: Introductory Modeling Example Employing UML and OCL [UML: Unified Modeling Language, OCL:Object Constarint Language] - System design in an object-oriented way employing USE

More information

UNIT-II Introduction to UML

UNIT-II Introduction to UML UNIT-II Introduction to UML - P. P. Mahale UML OVERVIEW OF UML :- We need a Modeling Language! We will use the Unified Modeling Language, UML), Provides a standard for artifacts produced during development

More information

Object Constraint Language 2

Object Constraint Language 2 Object Constraint Language 2 Martin Nečaský Dept. of Software Engineering Faculty of Mathematics and Physics Charles University in Prague Type System predefined types in OCL standard library generic types

More information

n Specifying what each method does q Specify it in a comment before method's header n Precondition q Caller obligation n Postcondition

n Specifying what each method does q Specify it in a comment before method's header n Precondition q Caller obligation n Postcondition Programming as a contract Assertions, pre/postconditions and invariants Assertions: Section 4.2 in Savitch (p. 239) Loop invariants: Section 4.5 in Rosen Specifying what each method does q Specify it in

More information

Requirements Elicitation

Requirements Elicitation Requirements Elicitation Introduction into Software Engineering Lecture 4 25. April 2007 Bernd Bruegge Applied Software Engineering Technische Universitaet Muenchen 1 Outline Motivation: Software Lifecycle

More information

Chapter 4 Requirements Elicitation

Chapter 4 Requirements Elicitation Object-Oriented Software Engineering Using UML, Patterns, and Java Chapter 4 Requirements Elicitation Outline Today: Motivation: Software Lifecycle Requirements elicitation challenges Problem statement

More information

Classes, interfaces, & documentation. Review of basic building blocks

Classes, interfaces, & documentation. Review of basic building blocks Classes, interfaces, & documentation Review of basic building blocks Objects Data structures literally, storage containers for data constitute object knowledge or state Operations an object can perform

More information

Zhifu Pei CSCI5448 Spring 2011 Prof. Kenneth M. Anderson

Zhifu Pei CSCI5448 Spring 2011 Prof. Kenneth M. Anderson Zhifu Pei CSCI5448 Spring 2011 Prof. Kenneth M. Anderson Introduction History, Characteristics of Java language Java Language Basics Data types, Variables, Operators and Expressions Anatomy of a Java Program

More information

Index. Index. More information. block statements 66 y 107 Boolean 107 break 55, 68 built-in types 107

Index. Index. More information. block statements 66 y 107 Boolean 107 break 55, 68 built-in types 107 A abbreviations 17 abstract class 105 abstract data types 105 abstract method 105 abstract types 105 abstraction 92, 105 access level 37 package 114 private 115 protected 115 public 115 accessors 24, 105

More information

Objectives. Defining Classes and Methods. Objectives. Class and Method Definitions: Outline 7/13/09

Objectives. Defining Classes and Methods. Objectives. Class and Method Definitions: Outline 7/13/09 Objectives Walter Savitch Frank M. Carrano Defining Classes and Methods Chapter 5 Describe concepts of class, class object Create class objects Define a Java class, its methods Describe use of parameters

More information

Chapter 1: Principles of Programming and Software Engineering

Chapter 1: Principles of Programming and Software Engineering Chapter 1: Principles of Programming and Software Engineering Data Abstraction & Problem Solving with C++ Fifth Edition by Frank M. Carrano Software Engineering and Object-Oriented Design Coding without

More information

Software Engineering: A Practitioner s s Approach, 6/e Roger Pressman. Chapter 28 Formal Methods

Software Engineering: A Practitioner s s Approach, 6/e Roger Pressman. Chapter 28 Formal Methods Software Engineering: A Practitioner s s Approach, 6/e Roger Pressman Chapter 28 Formal Methods 1 Problems with Conventional Specification contradictions ambiguities vagueness incompleteness mixed levels

More information

Final Exam. Final Exam Review. Ch 1: Introduction: Object-oriented analysis, design, implementation. Exam Format

Final Exam. Final Exam Review. Ch 1: Introduction: Object-oriented analysis, design, implementation. Exam Format Final Exam Final Exam Review CS 4354 Fall 2012 Jill Seaman Friday, December 14, 11AM Closed book, closed notes, clean desk Content: Textbook: Chapters 1, 2, 4-10 Java Lectures, GRASP + JUnit 35% of your

More information

References: internet notes; Bertrand Meyer, Object-Oriented Software Construction; 10/14/2004 1

References: internet notes; Bertrand Meyer, Object-Oriented Software Construction; 10/14/2004 1 References: internet notes; Bertrand Meyer, Object-Oriented Software Construction; 10/14/2004 1 Assertions Statements about input to a routine or state of a class Have two primary roles As documentation,

More information

Verifying Java Programs Verifying Java Programs with KeY

Verifying Java Programs Verifying Java Programs with KeY Verifying Java Programs Verifying Java Programs with KeY Wolfgang Schreiner Wolfgang.Schreiner@risc.jku.at Research Institute for Symbolic Computation (RISC) Johannes Kepler University, Linz, Austria http://www.risc.jku.at

More information

Part II Black-Box Composition Systems 10. Business Components in a Component-Based Development Process

Part II Black-Box Composition Systems 10. Business Components in a Component-Based Development Process Part II Black-Box Composition Systems 10. Business Components in a Component-Based Development Process 1. Business component model of the Cheesman/ Daniels process 2. Identifying business components Prof.

More information

Data Structures. BSc in Computer Science University of New York, Tirana. Assoc. Prof. Marenglen Biba 1-1

Data Structures. BSc in Computer Science University of New York, Tirana. Assoc. Prof. Marenglen Biba 1-1 Data Structures BSc in Computer Science University of New York, Tirana Assoc. Prof. Marenglen Biba 1-1 General info Course : Data Structures (3 credit hours) Instructor : Assoc. Prof. Marenglen Biba Office

More information

UC Santa Barbara. CS189A - Capstone. Christopher Kruegel Department of Computer Science UC Santa Barbara

UC Santa Barbara. CS189A - Capstone. Christopher Kruegel Department of Computer Science UC Santa Barbara CS189A - Capstone Christopher Kruegel Department of Computer Science http://www.cs.ucsb.edu/~chris/ Design by Contract Design by Contract and the language that implements the Design by Contract principles

More information

Object Orientated Analysis and Design. Benjamin Kenwright

Object Orientated Analysis and Design. Benjamin Kenwright Notation Part 2 Object Orientated Analysis and Design Benjamin Kenwright Outline Review What do we mean by Notation and UML? Types of UML View Continue UML Diagram Types Conclusion and Discussion Summary

More information

GSN Metamodel. In the following subsections we describe the model elements. All references are to sections within the GSN Community Standard.

GSN Metamodel. In the following subsections we describe the model elements. All references are to sections within the GSN Community Standard. 1. Background GSN Metamodel This section defines a metamodel for representing structured arguments using GSN. GSN arguments should be instances of this GSN Metamodel. Instances of the GSN Metamodel are

More information

OCL for the Specification of Model Transformation Contracts

OCL for the Specification of Model Transformation Contracts OCL for the Specification of Model Transformation Contracts Eric Cariou, Raphaël Marvie, Lionel Seinturier, and Laurence Duchien LIFL - Université des Sciences et Technologies de Lille UMR CNRS 8022 -

More information

Defining Classes and Methods

Defining Classes and Methods Walter Savitch Frank M. Carrano Defining Classes and Methods Chapter 5 ISBN 0136091113 2009 Pearson Education, Inc., Upper Saddle River, NJ. All Rights Reserved Objectives Describe concepts of class, class

More information

Principles of Software Construction: Objects, Design, and Concurrency

Principles of Software Construction: Objects, Design, and Concurrency Principles of Software Construction: Objects, Design, and Concurrency Designing (sub-) systems Responsibility assignment Charlie Garrod Michael Hilton School of Computer Science 1 Administrivia Reading

More information

ADVANCED LINK AND ASSOCIATION CONCEPTS

ADVANCED LINK AND ASSOCIATION CONCEPTS OBJECT We define an object as a concept, abs ration or thin g with crisp boundaries and meaning for the problem at hand. Object serve two purpose: They promote understanding of the real world and provide

More information

INTERNAL ASSESSMENT TEST III Answer Schema

INTERNAL ASSESSMENT TEST III Answer Schema INTERNAL ASSESSMENT TEST III Answer Schema Subject& Code: Object-Oriented Modeling and Design (15CS551) Sem: V ISE (A & B) Q. No. Questions Marks 1. a. Ans Explain the steps or iterations involved in object

More information

JASS Java with ASSertions Detlef Bartetzko, Clemens Fischer, Michael Möller, Heike Wehrheim. Presented by Florian Froese (froesef)

JASS Java with ASSertions Detlef Bartetzko, Clemens Fischer, Michael Möller, Heike Wehrheim. Presented by Florian Froese (froesef) JASS Java with ASSertions Detlef Bartetzko, Clemens Fischer, Michael Möller, Heike Wehrheim Presented by Florian Froese (froesef) JASS Java with ASSertions Design by contract extention for Java Java precompiler

More information

Rushikesh K Joshi. Department of Computer Science and Engineering Indian Institute of Technology Bombay

Rushikesh K Joshi. Department of Computer Science and Engineering Indian Institute of Technology Bombay CS 617 Object Oriented Systems Lecture 6 Classes Implementing Interfaces Open-Closed Principle Self References (This) 3:30-5:00 pm Mon, Jan 21 Rushikesh K Joshi Department of Computer Science and Engineering

More information

JML tool-supported specification for Java Erik Poll Radboud University Nijmegen

JML tool-supported specification for Java Erik Poll Radboud University Nijmegen JML tool-supported specification for Java Erik Poll Radboud University Nijmegen Erik Poll - JML p.1/41 Overview The specification language JML Tools for JML, in particular runtime assertion checking using

More information

The Object Constraint Language (OCL)

The Object Constraint Language (OCL) The Object Constraint Language (OCL) Robert B. France Dept. of Computer Science Colorado State University USA france@cs.colostate.edu Semantics and UML models UML models often treated as informal descriptions

More information

Defining Classes and Methods. Objectives. Objectives 6/27/2014. Chapter 5

Defining Classes and Methods. Objectives. Objectives 6/27/2014. Chapter 5 Defining Classes and Methods Chapter 5 Objectives Describe concepts of class, class object Create class objects Define a Java class, its methods Describe use of parameters in a method Use modifiers public,

More information

Assertions & Design-by-Contract using JML Erik Poll University of Nijmegen

Assertions & Design-by-Contract using JML Erik Poll University of Nijmegen Assertions & Design-by-Contract using JML Erik Poll University of Nijmegen Erik Poll - JML p.1/39 Overview Assertions Design-by-Contract for Java using JML Contracts and Inheritance Tools for JML Demo

More information

Interface (API) Design

Interface (API) Design Interface (API) Design Architect s Perspective R. Kuehl/J. Scott Hawker p. 1 What is an API? Exposes the public facing functionality of a software component Operations, inputs, and outputs Exposes functionality

More information

10.1 Big Objects, Business Objects, and UML Components

10.1 Big Objects, Business Objects, and UML Components II Black-Box Composition Systems 10. Finding Business s in a -Based Development Process Literature J. Cheesman, J. Daniels. UML s. Addison-Wesley. 1. The UML component model 2. Business component model

More information

Lecture 10 Design by Contract

Lecture 10 Design by Contract CS 5959 Writing Solid Code Fall 2015 Nov-23 Lecture 10 Design by Contract Zvonimir Rakamarić University of Utah Design by Contract Also called assume-guarantee reasoning Developers annotate software components

More information

OCL Object Constraint Language

OCL Object Constraint Language PA103 - Object-oriented Methods for Design of Information Systems OCL Object Constraint Language Radek Ošlejšek Fakulta informatiky MU oslejsek@fi.muni.cz Literature The Object Constraint Language (Second

More information

2IP15 Programming Methods

2IP15 Programming Methods Lecture 1: Introduction, Functional Decomposition 2IP15 Programming Methods From Small to Large Programs Tom Verhoeff Eindhoven University of Technology Department of Mathematics & Computer Science Software

More information

UNIT 3 ARRAYS, RECURSION, AND COMPLEXITY CHAPTER 11 CLASSES CONTINUED

UNIT 3 ARRAYS, RECURSION, AND COMPLEXITY CHAPTER 11 CLASSES CONTINUED UNIT 3 ARRAYS, RECURSION, AND COMPLEXITY CHAPTER 11 CLASSES CONTINUED EXERCISE 11.1 1. static public final int DEFAULT_NUM_SCORES = 3; 2. Java allocates a separate set of memory cells in each instance

More information

Class Diagram. Classes consist of. Note that class diagrams contain only classes, not objects.

Class Diagram. Classes consist of. Note that class diagrams contain only classes, not objects. Class Diagrams UML Class Diagram Classes consist of the class name written in BOLD features attributes and methods user-defined constraints Note that class diagrams contain only classes, not objects. Class

More information

Advances in Programming Languages

Advances in Programming Languages Advances in Programming Languages Lecture 12: Practical Tools for Java Correctness Ian Stark School of Informatics The University of Edinburgh Friday 31 November 2014 Semester 1 Week 7 http://www.inf.ed.ac.uk/teaching/courses/apl

More information

Principles of Software Construction: Objects, Design, and Concurrency. Assigning Responsibilities to Objects. toad. Jonathan Aldrich Charlie Garrod

Principles of Software Construction: Objects, Design, and Concurrency. Assigning Responsibilities to Objects. toad. Jonathan Aldrich Charlie Garrod Principles of Software Construction: Objects, Design, and Concurrency Assigning Responsibilities to Objects toad Fall 2014 Jonathan Aldrich Charlie Garrod School of Computer Science Key concepts from Thursday

More information

Verifying Java Programs Verifying Java Programs with KeY

Verifying Java Programs Verifying Java Programs with KeY Verifying Java Programs Verifying Java Programs with KeY Wolfgang Schreiner Wolfgang.Schreiner@risc.jku.at Research Institute for Symbolic Computation (RISC) Johannes Kepler University, Linz, Austria http://www.risc.jku.at

More information

Announcement. Agenda 7/31/2008. Polymorphism, Dynamic Binding and Interface. The class will continue on Tuesday, 12 th August

Announcement. Agenda 7/31/2008. Polymorphism, Dynamic Binding and Interface. The class will continue on Tuesday, 12 th August Polymorphism, Dynamic Binding and Interface 2 4 pm Thursday 7/31/2008 @JD2211 1 Announcement Next week is off The class will continue on Tuesday, 12 th August 2 Agenda Review Inheritance Abstract Array

More information

Code Contracts. Pavel Parízek. CHARLES UNIVERSITY IN PRAGUE faculty of mathematics and physics

Code Contracts. Pavel Parízek.   CHARLES UNIVERSITY IN PRAGUE faculty of mathematics and physics Code Contracts http://d3s.mff.cuni.cz Pavel Parízek CHARLES UNIVERSITY IN PRAGUE faculty of mathematics and physics Pavel Parízek Code Contracts 2 Assertions Typically used as internal checks in the program

More information

Inheritance. Inheritance Reserved word protected Reserved word super Overriding methods Class Hierarchies Reading for this lecture: L&L

Inheritance. Inheritance Reserved word protected Reserved word super Overriding methods Class Hierarchies Reading for this lecture: L&L Inheritance Inheritance Reserved word protected Reserved word super Overriding methods Class Hierarchies Reading for this lecture: L&L 9.1 9.4 1 Inheritance Inheritance allows a software developer to derive

More information

Ingegneria del Software Corso di Laurea in Informatica per il Management. Introduction to UML

Ingegneria del Software Corso di Laurea in Informatica per il Management. Introduction to UML Ingegneria del Software Corso di Laurea in Informatica per il Management Introduction to UML Davide Rossi Dipartimento di Informatica Università di Bologna Modeling A model is an (abstract) representation

More information

Part II Black-Box Composition Systems 20. Finding UML Business Components in a Component-Based Development Process

Part II Black-Box Composition Systems 20. Finding UML Business Components in a Component-Based Development Process Fakultät Informatik - Institut Software- und Multimediatechnik - Softwaretechnologie Prof. Aßmann - CBSE Part II Black-Box Composition Systems 20. Finding UML Business Components in a Component-Based Development

More information

Type Hierarchy. Comp-303 : Programming Techniques Lecture 9. Alexandre Denault Computer Science McGill University Winter 2004

Type Hierarchy. Comp-303 : Programming Techniques Lecture 9. Alexandre Denault Computer Science McGill University Winter 2004 Type Hierarchy Comp-303 : Programming Techniques Lecture 9 Alexandre Denault Computer Science McGill University Winter 2004 February 16, 2004 Lecture 9 Comp 303 : Programming Techniques Page 1 Last lecture...

More information

TIME-BASED CONSTRAINTS IN THE OBJECT CONSTRAINT LANGUAGE OCL

TIME-BASED CONSTRAINTS IN THE OBJECT CONSTRAINT LANGUAGE OCL TIME-BASED CONSTRAINTS IN THE OBJECT CONSTRAINT LANGUAGE OCL Ali Hamie, John Howse School of Computing, Mathematical and Information Sciences, University of Brighton, Brighton, UK. {a.a.hamie@brighton.ac.uk,

More information

CS246 Software Abstraction and Specification Final Examination

CS246 Software Abstraction and Specification Final Examination CS246 Software Abstraction and Specification ination Spring 2007 Date: 04-Aug-2007 Time: 4.00 6.30pm Permitted Aids: None 14 pages Student Name: UW Student ID: Instructions: (Read carefully before the

More information

Why Design by Contract! CS 619 Introduction to OO Design and Development. Design by Contract. Fall 2012

Why Design by Contract! CS 619 Introduction to OO Design and Development. Design by Contract. Fall 2012 Why Design by Contract What s the difference with Testing? CS 619 Introduction to OO Design and Development Design by Contract Fall 2012 Testing tries to diagnose (and cure) defects after the facts. Design

More information

Inheritance, Polymorphism, and Interfaces

Inheritance, Polymorphism, and Interfaces Inheritance, Polymorphism, and Interfaces Chapter 8 Inheritance Basics (ch.8 idea) Inheritance allows programmer to define a general superclass with certain properties (methods, fields/member variables)

More information

Subclassing for ADTs Implementation

Subclassing for ADTs Implementation Object-Oriented Design Lecture 8 CS 3500 Fall 2009 (Pucella) Tuesday, Oct 6, 2009 Subclassing for ADTs Implementation An interesting use of subclassing is to implement some forms of ADTs more cleanly,

More information

Class Diagram. Classes consist of. Note that class diagrams contain only classes, not objects.

Class Diagram. Classes consist of. Note that class diagrams contain only classes, not objects. Class Diagrams UML Class Diagram Classes consist of the class name written in BOLD features attributes and methods user defined constraints Note that class diagrams contain only classes, not objects. Class

More information

Object Oriented Program Correctness with OOSimL

Object Oriented Program Correctness with OOSimL Kennesaw State University DigitalCommons@Kennesaw State University Faculty Publications 12-2009 Object Oriented Program Correctness with OOSimL José M. Garrido Kennesaw State University, jgarrido@kennesaw.edu

More information