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

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

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

Chapter 1: Principles of Programming and Software Engineering

Department of Computer Science Undergraduate Events

Josh Bloch Charlie Garrod Darya Melicher

Chapter 1: Programming Principles

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

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

CS246 Software Abstraction and Specification Final Examination

Josh Bloch Charlie Garrod Darya Melicher

5 Object Oriented Analysis

Jonathan Aldrich Charlie Garrod

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

Principles of Software Construction: Objects, Design, and Concurrency

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

SE 1: Software Requirements Specification and Analysis

Requirements and Design Overview

Software Engineering with Objects and Components Open Issues and Course Summary

Object Oriented Software Development CIS Today: Object Oriented Analysis

Introduction to concurrency and GUIs

Design. Eric McCreath

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

Äriprotsesside modelleerimine ja automatiseerimine Loeng 7 Valdkonna mudel

COMP 6471 Software Design Methodologies

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

Principles of Software Construction: Objects, Design, and Concurrency

Object-Oriented Design

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

Domain Model and Domain Modeling

May Comp-B 11, Advanced Software Design. 3 hours duration

Chapter 5, Analysis: Object Modeling

Josh Bloch Charlie Garrod Darya Melicher

22/09/2012 INFO2110. Copyright Warning. Revision of class diagram. Overview. Purpose of class diagram. Generalization Relationship

From Analysis to Design. LTOOD/OOAD Verified Software Systems

CTIS 359 Principles of Software Engineering SOFTWARE DESIGN OO(A)D

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

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

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

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

CSE Lecture 24 Review and Recap. High-Level Overview of the Course!! L1-7: I. Programming Basics!

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

Object Design II: Design Patterns

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

Introduction to Software Engineering: Analysis

Object Model. Object Orientated Analysis and Design. Benjamin Kenwright

challenges in domain-specific modeling raphaël mannadiar august 27, 2009

INST Database Design and Modeling - Section 0101 Spring Tentative Syllabus

Tutorial notes on. Requirements analysis

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

Object-Oriented Software Engineering Practical Software Development using UML and Java

CSCU9T4: Managing Information

Charlie Garrod School of Computer Science

CMPE/SE 135 Object-Oriented Analysis and Design

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

Lecture Chapter 2 Software Development

Relational Model and Algebra. Introduction to Databases CompSci 316 Fall 2018

Learning objectives: Software Engineering. CSI1102: Introduction to Software Design. The Software Life Cycle. About Maintenance

Topics on Web Services COMP6017

Design Patterns V Structural Design Patterns, 2

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

A Conceptual Model of the UML

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

Introduction to UML. Danang Wahyu utomo

A Rapid Overview of UML

CPS352 Database Systems Syllabus Fall 2012

Data Analysis 1. Chapter 2.1 V3.1. Napier University Dr Gordon Russell

Welcome to CS120 Fall 2012

BCS Higher Education Qualifications. Diploma in IT. Object Oriented Programming Syllabus

New York University Computer Science Department Courant Institute of Mathematical Sciences

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

Objects as Session-Typed Processes

Important Notes: For this course you must check the Regis Bookstore: for the most current online course material information.

Entity Relationship Modelling

Advanced Class Diagrams and Intro to Interaction Modeling

SE 1: Software Requirements Specification and Analysis

OBJECT ORIENTED ANALYSIS AND DESIGN SYLLABUS

Conceptual Data Modeling by David Haertzen

340 Review Fall Midterm 1 Review

17. GRASP: Designing Objects with Responsibilities

h(p://ihm.tumblr.com/post/ /word- cloud- for- hci- human- computer- interacbon CS5340 Human-Computer Interaction ! January 31, 2013!

Project #1 rev 2 Computer Science 2334 Fall 2013 This project is individual work. Each student must complete this assignment independently.

CSSE 374: GRASP ing at the First Five Patterns Principles. Shawn Bohner Office: Moench Room F212 Phone: (812)

CSSE 374: Logical Architecture. Shawn Bohner Office: Moench Room F212 Phone: (812)

LABORATORY 1 REVISION

Chapter 5: Structural Modeling

1. Introduction to Object Oriented Software Development

Goal: build an object-oriented model of the realworld system (or imaginary world) Slicing the soup: OOA vs. OOD

Architectural Design. Architectural Design. Software Architecture. Architectural Models

Software Engineering I (02161)

Unit 2A: Systems of Equations and Inequalities

Charlie Garrod Michael Hilton

Database Systems. A Practical Approach to Design, Implementation, and Management. Database Systems. Thomas Connolly Carolyn Begg

CS4961 Parallel Programming. Lecture 4: Data and Task Parallelism 9/3/09. Administrative. Mary Hall September 3, Going over Homework 1

Review: Cohesion and Coupling, Mutable, Inheritance Screen Layouts. Object-Oriented Design CRC Cards - UML class diagrams

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

Software Design Models, Tools & Processes. Lecture 2: Inception Phase Cecilia Mascolo

Course Wrap-up. CSC207 Fall 2015

Transcription:

Principles of Software Construction: Objects, Design, and Concurrency A formal design process Josh Bloch Charlie Garrod Darya Melicher 1

Administrivia Homework 2 feedback in your GitHub repository Homework 3 due today at 11:59 p.m. Homework 4 available end of this week Midterm exam next Thursday, September 27 th Review session: Tuesday, September 25 th, 5 7 p.m. in Doherty 2315 There will be pizza! Practice exam available by tomorrow on Piazza Optional reading due today: UML and Patterns Ch 17 & Effective Java Items 49, 54, and 69 Required reading due next Tuesday: UML and Patterns Ch 14, 15, and 16 2

Key concepts from Tuesday 3

Iterator design pattern Problem: Clients need uniform strategy to access all elements in a container, independent of the container type Order is unspecified, but access every element once Solution: A strategy pattern for iteration Consequences: Hides internal implementation of underlying container Easy to change container type Facilitates communication between parts of the program 4

Decorator design pattern Problem: You need arbitrary or dynamically composable extensions to individual objects Solution: Implement a common interface as the object you are extending, add functionality, but delegate primary responsibility to an underlying object Consequences: More flexible than static inheritance Customizable, cohesive extensions Breaks object identity, self-references 5

Design principles are useful heuristics Reduce coupling to increase understandability, reuse Lower representational gap to increase understandability, maintainability Increase cohesion to increase understandability 6

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, Assumption: Somebody has gathered the requirements (mostly text) Challenges: How do we implement them? How do we cope with changes? 17-313 7 Social aspects

Artifacts of the 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 Understand the problem Define a solution 8

Today and next Tuesday you will 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 Understand the problem Define a solution 9

Today and next Tuesday you will 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 Understand the problem Define a solution 10

Input to the design process: Requirements and use cases Typically prose: 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 Usethat case item, scenario: an amount A library of money member recorded shouldinbethe able member's to use her library account. library card to log in at a library system kiosk and borrow a book. After confirming that the member has no unpaid late fees, the library system should determine the book's due date by adding its rental period to the current day, and record the book and its due date as a borrowed item in the member's library account. 11

Modeling a problem domain 1. 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 12

Build 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. 13

Read description carefully, look for nouns and verbs 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. 14

Modeling a problem domain 1. 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 2. 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 Include notes as needed Expect revisions 15

An example domain model for a library system 16

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-world 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 17

Build an airport self-check-in system An airport self-check-in system is used to check in passengers for their upcoming flights. Each passenger is assigned a seat on each of their flights. During the check-in procedure, the passenger may choose to check in one or more bags as their baggage. At the end of a check-in procedure, the passenger receives a boarding pass for each of the flights of their trip they checked into. 18

Build an airport self-check-in system An airport self-check-in system is used to check in passengers for their upcoming flights. Each passenger is assigned a seat on each of their flights. During the check-in procedure, the passenger may choose to check in one or more bags as their baggage. At the end of a check-in procedure, the passenger receives a boarding pass for each of the flights of their trip they checked into. 19

Benefits of domain modeling Understand the domain Details matter! E.g., how many items a library user may check out? Ensure completeness e.g. library user s standing (fees due) affects the ability to check out items Agree on a common set of terms e.g. library user vs. library member, rented item vs. checked-out item Prepare to design Domain concepts are good candidates for OO classes (low representational gap) 20

Today and next Tuesday you will 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 Understand the problem Define a solution 21

Understanding system behavior with sequence diagrams A system sequence diagram shows, for one use case scenario, the sequence of events that occur on the system's boundary Design goal: Identify and define the interface of the system Two components: A user and the overall system Useful for identifying tests later Input: Domain description and one use case Output: A sequence diagram of system-level operations Include only domain-level concepts and operations 22

A sequence diagram for the library system Use case scenario: A library member should be able to use her library card to log in at a library system kiosk and borrow a book. After confirming that the member has no unpaid late fees, the library system should determine the book's due date by adding its rental period to the current day, and record the book and its due date as a borrowed item in the member's library account. 23

A sequence diagram for the airport self-check-in system Use case scenario: After a passenger is authenticated with the system using their booking ID, they should be able to change a seat on any of their flights to any unoccupied seat in the cabin of the same type. 24

Today and next Tuesday you will 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 Understand the problem Define a solution 25

Formalize system behavior with behavioral contracts A system behavioral contract describes the pre-conditions and post-conditions for some operation identified in the system sequence diagrams System-level textual specifications, like software specifications 26

A system behavioral contract for the library system Operation: borrow(item) Pre-conditions: Library member has already logged in to the system. Item is not currently borrowed by another member. Post-conditions: Logged-in member's account records the newly borrowed item, or the member is warned she has an outstanding late fee. The newly borrowed item contains a future due date, computed as the item's rental period plus the current date. 27

A system behavior contract for the airport self-check-in Use case scenario: After a passenger is authenticated with the system, they should be able to change a seat on any of their flights to any unoccupied seat in the same cabin. Operation: changeseat(flight, newseat) Pre-conditions: Post-conditions: 28