Principles of Software Construction: Objects, Design, and Concurrency

Similar documents
Principles of Software Construction: Objects, Design, and Concurrency

Principles of Software Construction: Objects, Design, and Concurrency

A formal design process, part 2

Josh Bloch Charlie Garrod Darya Melicher

Principles of So3ware Construc9on. A formal design process, part 2

Charlie Garrod Michael Hilton

Principles of Software Construction: Objects, Design, and Concurrency. Part 1: Designing Classes. Design for Reuse School of Computer Science

Agile Model-Driven Development with UML 2.0 SCOTT W. AM BLER. Foreword by Randy Miller UNIFIED 1420 MODELING LANGUAGE. gile 1.

Chapter 5, Analysis: Object Modeling

Lecture 13 Introduction to Software Architecture

SOFTWARE MODELING AND DESIGN. UML, Use Cases, Patterns, and. Software Architectures. Ki Cambridge UNIVERSITY PRESS. Hassan Gomaa

Classes and Objects. Object Orientated Analysis and Design. Benjamin Kenwright

Design. Eric McCreath

2009 Shawn A. Bohner. Shawn Bohner Office: Moench Room F212 Phone: (812)

Josh Bloch Charlie Garrod Darya Melicher

Domain Analysis. SWEN-261 Introduction to Software Engineering. Department of Software Engineering Rochester Institute of Technology.

Domain Model and Domain Modeling

Chapter 4 Requirements Elicitation

For 100% Result Oriented IGNOU Coaching and Project Training Call CPD TM : ,

S T R U C T U R A L M O D E L I N G ( M O D E L I N G A S Y S T E M ' S L O G I C A L S T R U C T U R E U S I N G C L A S S E S A N D C L A S S D I A

Department of Computer Science Undergraduate Events

Introduction to Software Engineering (2+1 SWS) Winter Term 2009 / 2010 Dr. Michael Eichberg Vertretungsprofessur Software Engineering Department of

Principles of Software Construction: Objects, Design, and Concurrency. The Perils of Concurrency Can't live with it. Can't live without it.

CS 451 Software Engineering

Klocwork Architecture Excavation Methodology. Nikolai Mansurov Chief Scientist & Architect

CS246 Software Abstraction and Specification Final Examination

Principles of Software Construction: Objects, Design and Concurrency. Object-Oriented Design: Assigning Responsibilities.

Äriprotsesside modelleerimine ja automatiseerimine Loeng 7 Valdkonna mudel

Review of Basic Software Design Concepts. Fethi Rabhi SENG 2021

Software Engineering with Objects and Components Open Issues and Course Summary

Principles of Software Construction: Objects, Design, and Concurrency. The Perils of Concurrency Can't live with it. Cant live without it.

Requirements Elicitation

Four More GRASP Principles CSSE 574: Session 5, Part 2

Ans 1-j)True, these diagrams show a set of classes, interfaces and collaborations and their relationships.

Chapter 8: Class and Method Design

Chapter 1: Programming Principles

Object-Oriented Design

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

Object-Oriented Design

Darshan Institute of Engineering & Technology for Diploma Studies

Chapter 5, Object Modeling

Object Oriented Software Development CIS Today: Object Oriented Analysis

A - 1. CS 494 Object-Oriented Analysis & Design. UML Class Models. Overview. Class Model Perspectives (cont d) Developing Class Models

Object Oriented Model of Objectory Process

Principles of Software Construction: Objects, Design, and Concurrency. Part 1: Design for reuse. Design patterns for reuse

Principles of Software Construction: Objects, Design and Concurrency. Introduction to Design. toad

Lesson 11. W.C.Udwela Department of Mathematics & Computer Science

Progress Report. Object-Oriented Software Development: Requirements elicitation (ch. 4) and analysis (ch. 5) Object-oriented software development

Recap : UML artefacts. Black Box Requirements. Functional Specification. System. System. Test. Design. System. System. Development.

5 Object Oriented Analysis

Professor Hausi A. Müller PhD PEng FCAE Department of Computer Science Faculty of Engineering University of Victoria

Object Design II: Design Patterns

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

SE 1: Software Requirements Specification and Analysis

Domain Modeling. CSSE 574: Week 1, Part 3. Steve Chenoweth Phone: Office (812) Cell (937)

UML 2.0 UML 2.0. Scott Uk-Jin Lee. Division of Computer Science, College of Computing Hanyang University ERICA Campus

From Analysis to Design. LTOOD/OOAD Verified Software Systems

Josh Bloch Charlie Garrod Darya Melicher

Chapter 1: Principles of Programming and Software Engineering

Requirement Analysis & Conceptual Database Design

Principles of Software Construction: Objects, Design and Concurrency. Just enough UML. toad

ATTENTION TO COME/ISE 491/492 STUDENT

SOFTWARE DESIGN COSC 4353 / Dr. Raj Singh

Object-Oriented Design II - GRASP

Outline of UML and Unified Process. Object Oriented Analysis/Design/Programming UML1.5. Koichiro Ochimizu, JAIST. UML&UP outline 1.

Principles of So3ware Construc9on: Objects, Design, and Concurrency. Designing classes

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING CS2353-OBJECT ORIENTED ANALYSIS AND DESIGN. Unit-I. Introduction to OOAD

1st Semester MTCE 601A COMPUTER SYSTEM SOFTWARE

THE UNIVERSITY OF THE WEST INDIES. Answer ALL questions. Marks for each question are given in the margin. This exam is worth 60 marks

Model-based Transition from Requirements to High-level Software Design

user.book Page 45 Friday, April 8, :05 AM Part 2 BASIC STRUCTURAL MODELING

CAS 703 Software Design

Introduction to concurrency and GUIs

ROEVER ENGINEERING COLLEGE DEPARTMENT OF INFORMATION TECHNOLOGY CS2353-OBJECT ORIENTED ANALYSIS AND DESIGN. Unit-I. Introduction to OOAD

Question Sheet There are a number of criticisms to UML. List a number of these criticisms.

Klocwork Architecture Excavation Methodology. Nikolai Mansurov Chief Scientist & Architect

Topic : Object Oriented Design Principles

The software lifecycle and its documents

CS487 Midterm Exam Summer 2005

Class Diagrams in Analysis

Update on AADL Requirements Annex

Software Modeling & Analysis

Principles of Software Construction: Objects, Design, and Concurrency

CS6502-OBJECT ORIENTED ANALYSIS AND DESIGN Two Marks Question with Answers Unit-I Introduction to OOAD

Lab Manual. Object Oriented Analysis And Design. TE(Computer) VI semester

CMPE/SE 135 Object-Oriented Analysis and Design

340 Review Fall Midterm 1 Review

Database Principles: Fundamentals of Design, Implementation, and Management Tenth Edition. Chapter 7 Data Modeling with Entity Relationship Diagrams

Software Engineering I (02161)

SE 1: Software Requirements Specification and Analysis

Object- Oriented Design with UML and Java Part I: Fundamentals

CASE TOOLS LAB VIVA QUESTION

Chapter 5: Structural Modeling

COMP 6471 Software Design Methodologies

Chapter 6 System Design: Decomposing the System

OODP Session 4. Web Page: Visiting Hours: Tuesday 17:00 to 19:00

Patterns and Testing

San José State University Department of Computer Science CS151, Section 04 Object Oriented Design Spring 2018

SEEM4570 System Design and Implementation Lecture 11 UML

PRINCIPLES OF SOFTWARE DESIGN

Transcription:

Principles of Software Construction: Objects, Design, and Concurrency Designing (sub-) systems A formal design process Charlie Garrod Michael Hilton School of Computer Science 1

Administrivia Optional reading for Today: UML and Patterns Chapter 17 Effective Java items 39, 43, and 57 Homework 3 due Thursday at 11:59 p.m. Midterm exam next Thursday (September 28 th ) Exam review session: Hamerschlag Hall B103 Wed 7-9pm Practice Exam coming soon 2

Participation opportunity Write down your muddiest point What concept or idea do you feel you understand the least, or need more practice with? 3

Today Design goals and design principles 4

Metrics of software quality Source: Braude, Bernstein, Software Engineering. Wiley 2011 Sufficiency / functional correctness Fails to implement the specifications Satisfies all of the specifications Robustness Will crash on any anomalous event Recovers from all anomalous events Flexibility Must be replaced entirely if spec changes Easily adaptable to changes Reusability Cannot be used in another application Usable without modification Efficiency Fails to satisfy speed or storage requirement satisfies requirements Scalability Cannot be used as the basis of a larger version is an outstanding basis Security Security not accounted for at all No manner of breaching security is known 5 Design challenges/goals

Design principles Low coupling Low representational gap High cohesion 6

A design principle for reuse: low coupling Each component should depend on as few other components as possible Benefits of low coupling: Enhances understandability Reduces cost of change Eases reuse 7

Law of Demeter "Only talk to your immediate friends" foo.bar().baz().quz(42) 8

Representational gap Real-world concepts: Software concepts:?? 9

Representational gap Real-world concepts: Software concepts: a h k() Obj1 objs Obj2 Actor42 op12 10

Representational gap Real-world concepts: Software concepts: PineTree age height harvest() -trees Forest Ranger surveyforest( ) 11

Benefits of low representational gap Facilitates understanding of design and implementation Facilitates traceability from problem to solution Facilitates evolution 12

A related design principle: high cohesion Each component should have a small set of closely-related responsibilities (SRP) Benefits: Facilitates understandability Facilitates reuse Eases maintenance PineTree age height harvest() -trees Forest Ranger surveyforest( ) 13

Coupling vs. cohesion All code in one component? Low cohesion, low coupling Every statement / method in a separate component? High cohesion, high coupling 14

Today: Tools, goals, and understanding the problem space Visualizing dynamic behavior with interaction diagrams Design goals and design principles Understanding a design problem: Object oriented analysis 15

Visualizing dynamic behavior: Interaction diagrams An interaction diagram is a picture that shows, for a single scenario of use, the events that occur across the system s boundary or between subsystems Clarifies interactions: Between the program and its environment Between major parts of the program For this course, you should know: Communication diagrams Sequence diagrams 16

Creating a communication diagram 17

An example communication diagram 18

(Communication diagram with notation annotations) 19

Constructing a sequence diagram 20

An example sequence diagram 21

(Sequence diagram with notation annotations) 22

Draw a sequence diagram for a call to LoggingList.add: public class LoggingList<E> implements List<E> { private final List<E> list; public LoggingList<E>(List<E> list) { this.list = list; } public boolean add(e e) { System.out.println("Adding " + e); return list.add(e); } public E remove(int index) { System.out.println("Removing at " + index); return list.remove(index); } 23

Sequence vs. communication diagrams Relative advantages and disadvantages? 24

Today: Tools, goals, and understanding the problem space Visualizing dynamic behavior with interaction diagrams Design goals and design principles Understanding a design problem: Object oriented analysis 25

Tactical Data Radios 26

Coast Guard SAFE Boats 27

Loan Management Systems 28

Our path toward a more formal design process Problem Space Solution Space Domain Model Object Model Real-world concepts Requirements, concepts Relationships among concepts Solving a problem Building a vocabulary System implementation Classes, objects References among objects and inheritance hierarchies Computing a result Finding a solution 29

A high-level software design process Project inception Gather requirements Define actors, and use cases Model / diagram the problem, define objects Define system behaviors Assign object responsibilities Define object interactions Model / diagram a potential solution Implement and test the solution Maintenance, evolution, 15-313 30

Artifacts of this design process Model / diagram the problem, define objects Domain model (a.k.a. conceptual model) Define system behaviors System sequence diagram System behavioral contracts Assign object responsibilities, define interactions Object interaction diagrams Model / diagram a potential solution Object model 31

Artifacts of this design process Model / diagram the problem, define objects Domain model (a.k.a. conceptual model) Define system behaviors System sequence diagram System behavioral contracts Assign object responsibilities, define interactions Object interaction diagrams Model / diagram a potential solution Object model Understanding the problem Defining a solution 32

Input to the design process: Requirements and use cases Typically prose: 33

Modeling a problem domain Identify key concepts of the domain description Identify nouns, verbs, and relationships between concepts Avoid non-specific vocabulary, e.g. "system" Distinguish operations and concepts Brainstorm with a domain expert 34

Modeling a problem domain Identify key concepts of the domain description Identify nouns, verbs, and relationships between concepts Avoid non-specific vocabulary, e.g. "system" Distinguish operations and concepts Brainstorm with a domain expert Visualize as a UML class diagram, a domain model Show class and attribute concepts Real-world concepts only No operations/methods Distinguish class concepts from attribute concepts Show relationships and cardinalities 35

Building a domain model for a library system A public library typically stores a collection of books, movies, or other library items available to be borrowed by people living in a community. Each library member typically has a library account and a library card with the account s ID number, which she can use to identify herself to the library. A member s library account records which items the member has borrowed and the due date for each borrowed item. Each type of item has a default rental period, which determines the item s due date when the item is borrowed. If a member returns an item after the item s due date, the member owes a late fee specific for that item, an amount of money recorded in the member s library account. 36

Building a domain model for a library system A public library typically stores a collection of books, movies, or other library items available to be borrowed by people living in a community. Each library member typically has a library account and a library card with the account s ID number, which she can use to identify herself to the library. A member s library account records which items the member has borrowed and the due date for each borrowed item. Each type of item has a default rental period, which determines the item s due date when the item is borrowed. If a member returns an item after the item s due date, the member owes a late fee specific for that item, an amount of money recorded in the member s library account. 37

One domain model for the library system 38

Notes on the library domain model All concepts are accessible to a non-programmer The UML is somewhat informal Relationships are often described with words Real-world "is-a" relationships are appropriate for a domain model Real-word abstractions are appropriate for a domain model Iteration is important This example is a first draft. Some terms (e.g. Item vs. LibraryItem, Account vs. LibraryAccount) would likely be revised in a real design. Aggregate types are usually modeled as classes Primitive types (numbers, strings) are usually modeled as attributes 39

Build a domain model for Monopoly 40

Build a domain model for Monopoly Monopoly is a game in which each player has a piece that moves around a game board, with the piece s change in location determined by rolling a pair of dice. The game board consists of a set of properties (initially owned by a bank) that may be purchased by the players. When a piece lands on a property that is not owned, the player may use money to buy the property from the bank for that property s price. If a player lands on a property she already owns, she may build houses and hotels on the property; each house and hotel costs some price specific for the property. When a player s piece lands on a property owned by another player, the owner collects money (rent) from the player whose piece landed on the property; the rent depends on the number of houses and hotels built on the property. The game is played until only one remaining player has money and property, with all the other players being bankrupt. 41