Object Design More Design Patterns Object Constraint Language Object Design Specifying Interfaces Review Exam 2 CEN 4010 Class 18 – 11/03.

Slides:



Advertisements
Similar presentations
Design by Contract.
Advertisements

Ch:8 Design Concepts S.W Design should have following quality attribute: Functionality Usability Reliability Performance Supportability (extensibility,
Design by Contract. Design by contract is the process of developing software based on the notion of contracts between objects, which are expressed as.
Conquering Complex and Changing Systems Object-Oriented Software Engineering Chapter 7, Object Design.
1 Design by Contract Building Reliable Software. 2 Software Correctness Correctness is a relative notion  A program is correct with respect to its specification.
Feb 2003 R McFadyen1 Contracts (Ch 13) Used to help understand requirements more completely based on assertions; assertions are applicable to any.
Object Design: Specifying Interfaces Chapter 9. 2 Object Design  Object design is the process of adding details to the requirements analysis and making.
Basic Concepts in Component-Based Software Engineering
OASIS Reference Model for Service Oriented Architecture 1.0
Software Testing and Quality Assurance
Jan 2005 Ron McFadyen1 Contracts Used to help understand requirements more completely (and so may not always be necessary) based on assertions;
Software Testing and Quality Assurance: The Testing Perspective Reading Assignment: –John McGregor and David A. Sykes, A Practical Guide to Testing Object-Oriented.
1 Specifying Object Interfaces. 2 Major tasks in this stage: --are there any missing attributes or operations? --how can we reduce coupling, make interface.
Software Testing and Quality Assurance
1 Software Testing and Quality Assurance Lecture 28 – Testing Class Hierarchies.
© 2005 Prentice Hall8-1 Stumpf and Teague Object-Oriented Systems Analysis and Design with UML.
UML CASE Tool. ABSTRACT Domain analysis enables identifying families of applications and capturing their terminology in order to assist and guide system.
PowerPoint Presentation for Dennis, Wixom & Tegarden Systems Analysis and Design Copyright 2001 © John Wiley & Sons, Inc. All rights reserved. Slide 1.
Feb. 23, 2004CS WPI1 CS 509 Design of Software Systems Lecture #5 Monday, Feb. 23, 2004.
September 2002 R McFadyen1 Domain Model Use Case Model text diagram SSD System operation contracts Design Model Figure 13.3.
© Copyright Eliyahu Brutman Programming Techniques Course.
Chapter 10 Class and Method Design
Eiffel Language and Design by Contract Contract –An agreement between the client and the supplier Characteristics –Expects some benefits and is prepared.
Reuse Activities Selecting Design Patterns and Components
Slide 1 Chapter 10 Class and Method Design. Slide 2 REVISITING THE BASIC CHARACTERISTICS OF OBJECT-ORIENTATION.
1 An introduction to design patterns Based on material produced by John Vlissides and Douglas C. Schmidt.
Computer Science 340 Software Design & Testing Design By Contract.
Ranga Rodrigo. Class is central to object oriented programming.
Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved Chapter 12 Object-Oriented Design.
Design Patterns.
Design Patterns OOD. Course topics Design Principles UML –Class Diagrams –Sequence Diagrams Design Patterns C#,.NET (all the course examples) Design Principles.
Slide 1 Systems Analysis and Design with UML Version 2.0, Second Edition Alan Dennis, Barbara Haley Wixom, and David Tegarden Chapter 10: Class and Method.
Using UML, Patterns, and Java Object-Oriented Software Engineering Chapter 9, Object Design: Specifying Interfaces.
An Introduction to Design Patterns. Introduction Promote reuse. Use the experiences of software developers. A shared library/lingo used by developers.
SWE © Solomon Seifu ELABORATION. SWE © Solomon Seifu Lesson 10 Use Case Design.
Low-Level Detailed Design SAD (Soft Arch Design) Mid-level Detailed Design Low-Level Detailed Design Design Finalization Design Document.
Using UML, Patterns, and Java Object-Oriented Software Engineering Chapter 9, Object Design: Specifying Interfaces.
Chapter 8 Object Design Reuse and Patterns. Object Design Object design is the process of adding details to the requirements analysis and making implementation.
9-1 © Prentice Hall, 2007 Chapter 9: Analysis Classes Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich, Jeffrey.
Slide 1 Systems Analysis and Design with UML Version 2.0, Second Edition Alan Dennis, Barbara Haley Wixom, and David Tegarden Chapter 10: Class and Method.
Using UML, Patterns, and Java Object-Oriented Software Engineering Chapter 9, Object Design: Specifying Interfaces.
CSC 480 Software Engineering Design by Contract. Detail Design Road Map Begin with architectural models  Class model: domain classes  Overall state.
90-723: Data Structures and Algorithms for Information Processing Copyright © 1999, Carnegie Mellon. All Rights Reserved. 1 Lecture 1: Introduction Data.
Testing OO software. State Based Testing State machine: implementation-independent specification (model) of the dynamic behaviour of the system State:
1 Software Design Lecture What’s Design It’s a representation of something that is to be built. i.e. design  implementation.
1 Devon M. Simmonds, Computer Science Department Design by Contract Devon M. Simmonds Computer Science Department University of North Carolina, Wilmington.
ANU COMP2110 Software Design in 2003 Lecture 10Slide 1 COMP2110 Software Design in 2004 Lecture 12 Documenting Detailed Design How to write down detailed.
L13: Design by Contract Definition Reliability Correctness Pre- and post-condition Asserts and Exceptions Weak & Strong Conditions Class invariants Conditions.
7-1 © Prentice Hall, 2007 Topic 7: Analysis Classes Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich, Jeffrey.
SWE 4743 Abstract Data Types Richard Gesick. SWE Abstract Data Types Object-oriented design is based on the theory of abstract data types Domain.
SOFTWARE DESIGN AND ARCHITECTURE LECTURE 15. Review Interaction-Oriented Software Architectures – MVC.
CEN th Lecture Advance Software Engineering (CEN-5011) Instructor: Masoud Sadjadi Object Design: Specifying.
PowerPoint Presentation for Dennis, Wixom, & Tegarden Systems Analysis and Design with UML, 3rd Edition Copyright © 2009 John Wiley & Sons, Inc. All rights.
PowerPoint Presentation for Dennis, Wixom, & Tegarden Systems Analysis and Design with UML, 5th Edition Copyright © 2015 John Wiley & Sons, Inc. All rights.
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.
Using UML, Patterns, and Java Object-Oriented Software Engineering Chapter 9, Object Design: Specifying Interfaces.
Analysis Classes Unit 5.
Used to help understand requirements more completely
Chapter ? Quality Assessment
Arab Open University 2nd Semester, M301 Unit 5
TIM 58 Chapter 8: Class and Method Design
Chapter 9, Object Design: Specifying Interfaces
Specifying Object Interfaces
Seminar 3 UML Class Diagram.
Design Tips.
Design Yaodong Bi.
Assertions References: internet notes; Bertrand Meyer, Object-Oriented Software Construction; 4/25/2019.
Systems Analysis and Design with UML Version 2.0, Second Edition
Software Architecture & Design
Presentation transcript:

Object Design More Design Patterns Object Constraint Language Object Design Specifying Interfaces Review Exam 2 CEN 4010 Class 18 – 11/03

CEN 4010 Class /032 Other Design Patterns Bridge – decouples the interface of a class from its implementation. Adapter – encapsulates a piece of legacy code that was not designed to work with the system. Strategy – decouples an algorithm from its implementation(s). Abstract Factory – encapsulates the creation of families of related objects. Shields the client from the creation process and prevents the use of objects from different (incompatible) families.

CEN 4010 Class /033 Other Design Patterns cont Command – decouples the objects responsible from command processing from commands themselves. Protects these objects from changes due to new functionality. Composite – encapsulates hierarchies by providing a common superclass for aggregate and leaf nodes. New types of leaves can be added without modifying existing code.

CEN 4010 Class /034 Other Design Patterns cont Identifying the correct design pattern for a given problem is not easy unless you already have some experience in using design patterns. Terms associated with design patterns: –Framework –Class library –Component Framework – a set of classes providing a general solution that can be refined to provide an application or a subsystem.

CEN 4010 Class /035 Other Design Patterns cont Frameworks focus on reuse of concrete designs, algorithms, and implementations in a particular programming language. Frameworks focus on a particular application domain. Class libraries are less domain specific and provide a smaller scope of reuse. Class libraries are typically passive i.e., they do not implement or constrain the control flow.

CEN 4010 Class /036 Object Design Concepts Types signatures and visibility –During object design the system model is refined by adding types and visibility. –Type? –Signature? –Visibility? –What are the 3 levels of visibility? –How is visibility done in Eiffel? (Meyer)

CEN 4010 Class /037 Concepts cont Contracts: Invariants, Preconditions, Postconditions: –Contracts are constraints on a class that enable caller and callee to share the same assumptions about the class (Meyer ’97). –A contract specifies constraints that the caller must meet before using the class as well as constraints that are ensured by the callee when used.

CEN 4010 Class /038 Concepts cont –Design by contract – views the relationship between a class and its clients as a formal agreement, expressing each party’s rights and obligations (Meyer ’97). –Defensive programming ? –An invariant is a predicate that is always true for all the instances of a class. Invariants are constraints associated with classes or interfaces. Invariants are used to specify consistency constraints among class attributes.

CEN 4010 Class /039 Concepts cont –A precondition is a predicate that must be true before an operation is invoked. Preconditions are associated with a specific operation. Preconditions are used to specify constraints that a caller must meet before calling an operation. E.g., put may not be called if the stack representation is full. A correct system will never execute a call in a state that does not satisfy the precondition of a called routine????

CEN 4010 Class /0310 Concepts cont –A postcondition is a predicate that must be true after an operation is invoked. Postconditions are associated with a specific operation. Postconditions are used to specify constraints that the object must ensure after the invocation of the operation. E.g., After a put, the stack may not be empty, its top is the element just pushed, and its number of elements bas been increased by one.

CEN 4010 Class /0311 Concepts cont Note: –The precondition is an obligation for the client (caller) and a benefit for the supplier (callee). –The postcondition is a benefit for the client and an obligation for the supplier. –The invariants of all the parents of a class apply to the class itself. –An operation re-declaration (in a derived class) may only replace the original precondition by one equal or weaker, and the original postcondition by one equal or stronger.

CEN 4010 Class /0312 Object Constraint Language (OCL) OCL is a language that allows constraints to be formally specified on single model elements (e.g., attributes, operations, classes) or groups of model elements (e.g., associations and participating classes). See text P. 355 – 364. Note for the project we will write invariants, preconditions and postconditions in OCL.

CEN 4010 Class /0313 OCL cont Example: Context Tournament inv: self.getMaxNumPlayers() > 0 The context keyword indicates the entity to which the expression applies. inv, pre, post correspond to invariant, precondition, and postcondition respectively. Then comes the OCL expression, syntax is similar to OO PLs. Note OCL cannot denote control flow.

CEN 4010 Class /0314 OCL cont Examples: Context Tournament::acceptPlayer(p) pre: !isPlayerAccepted(p) Context Tournament::acceptPlayer(p) post: isPlayerAccepted(p) Context Tournament::acceptPlayer(p) post: getNumPlayers() + denotes the value returned by pre.getNumPlayers() before invoking denotes value before.

CEN 4010 Class /0315 Concepts cont For the project state the invariants, pre and post conditions for the classes you will be implementing using OCL. Note these assertions should be traceable to the use cases. Use “notes” to show constraints in your class diagrams. DO NOT CLUTTER you class diagrams. Use the example in Fig 9.5 as a guide when writing the assertions for your project.

CEN 4010 Class /0316 Object Design: Specifying Interfaces Interface specification activities of object design include: Identifying missing attributes and operations Specifying type signatures and visibility Specifying invariants Specifying preconditions and postconditions

CEN 4010 Class /0317 Overview Specifying Interfaces Identifying missing attributes and operations. –Missing operations can be identified and added to the class diagram during construction of the sequence diagram in Rational Rose. –At this stage the attributes not evident in the analysis or system design should become evident. –All attributes should be private or protected (inheritance). Specifying type signatures and visibility. –All attributes and operations should be assigned a visibility specifier. Note UML uses the Ada/Pascal approach to specify the signatures of operations.

CEN 4010 Class /0318 Overview Specifying Interfaces cont Specifying constraints –Constraints include invariants, pre and post conditions. Specifying exceptions –Exception conditions are usually associated with the violation of preconditions. You should also check the class invariant after any operation that can change its value.

CEN 4010 Class /0319 Exam 2 Review Topics 1.Definitions: software architecture, patterns, component, subsystem, cohesion, coupling, contracts, defensive programming, invariant, precondition, postcondition. 2.System Design : –areas to address during system design – h/w and s/w mapping, data management, access control, control flow, boundary conditions,

CEN 4010 Class /0320 Exam 2 Review Topics 2.System Design cont: –design goals – know dependability criteria and maintenance criteria, –types of patterns: architectural, design, idioms, –be familiar with the following architectural patterns: client/server, three-tier, four-tier, repository, pipe and filter. 3.Object Design: activities –service specification –component selection –restructuring

CEN 4010 Class /0321 Exam 2 Review Topics 3.Object Design: activities cont –optimization –design patterns: should be able to write Java code for the command and singleton patterns. 4.Be familiar with models used in system and object design e.g. class diagrams and sequence diagrams... 5.Know how to apply parts (2) – (5) above to a real example.