02291: System Integration · CRC cards. Introduction CRC Cards I Class Responsibility Collaboration...

Preview:

Citation preview

02291: System IntegrationFrom Requirements To Design

Hubert Baumeisterhuba@dtu.dk

DTU ComputeTechnical University of Denmark

Spring 2019

From Requirements to Design

ProblemI Given a requirements model consisting of:

1 use case diagram2 detailed use case descriptions3 glossary4 non functional requirements

I how do I get a system design consisting ofa component diagramb class diagramc behaviour design

From Requirements to Design: Solution

I Design process1 Define the basic architecture of the system2 The terms in the glossary give first candidates for classes,

attributes, and operations3 Realize one use case scenario / user story at a time

→ simulate execution→ CRC cards

Introduction CRC Cards

I Class Responsibility CollaborationI Developed in the 80’sI Used to

I Analyse a problem domainI Discover object-oriented designI Teach object-oriented design

I Object-oriented designI Objects have state and behaviourI ”Think objects”

CRC Card Template

A larger exampleI http://c2.com/doc/crc/draw.html

Process

I Basic: Simulate the execution of use case scenarios / userstories

I Steps1. Brainstorm classes/objects/components2. Assign classes/objects/components to persons (group up to

6 peopel)4. Execute the scenarios one by one

a) add new classes/objects/components as neededb) add new responsibilitiesc) delegate to other classes / persons

Library Example: Problem Description and GlossaryI Problem Description

I Library system for checking out , returning, and searchingfor books. No more than 5 books can be loaned by oneborrower at a time. And if a book is returned after itsoverdue date, a fine has to be paid.

Glossary

I LibrarienI The object in the system that fulfills User requests to check

out, check in, and search for library materialsI Book

I The set of objects that represent Users who borrow itemsfrom the library

I BorrowerI The set of objects that represent Users who borrow items

from the libraryI . . .

Library Example: Problem Description and GlossaryI Problem Description

I Library system for checking out , returning, and searchingfor books. No more than 5 books can be loaned by oneborrower at a time. And if a book is returned after itsoverdue date, a fine has to be paid.

Glossary

I LibrarienI The object in the system that fulfills User requests to check

out, check in, and search for library materialsI Book

I The set of objects that represent Users who borrow itemsfrom the library

I BorrowerI The set of objects that represent Users who borrow items

from the libraryI . . .

Library Example: Use Case Diagram

I Use Cases

User

LibrarySystem

borrow book

return book

search for book

Library Example: Detailed Use Case Check Out Book

I Name: Check Out BookI Description: The user checks out a book from the libraryI Actor: UserI Main scenario:

1 A user presents a book for check-out at the check-outcounter

2 The system registers the loanI Alternative scenarios:

I The user already has 5 books borrowed2a The system denies the loan

I The user has one overdue book2b The system denies the loan

Example II

I Set of initial CRC cardsI Librarien

I The object in the system that fulfills User requests to checkout, check in, and search for library materials

I BorrowerI The set of objects that represent Users who borrow items

from the libraryI Book

I The set of objects that represent items to be borrowed fromthe library

I Use case Check out book main scenarioI ”What happens when Barbara Stewart, who has no

accrued fines and one outstanding book, not overdue,checks out a book entitled Effective C++ Strategies+?”

Library Example: CRC cards

Library Example: CRC cards

Library Example: CRC cards

Library Example: CRC cards

Library Example: CRC cards

Library Example: CRC cards

Library Example: CRC cards

Library Example: CRC cards

Library Example: CRC cards

Library Example: CRC cards

Library Example: CRC cards

Library Example: CRC cards

Library Example: CRC cards

Library Example: CRC cards

Library Example: CRC cards

Library Example: All CRC cards

Process: Next Steps

I Repeat the process with other scenarios→ completes the design

I Review the resultI Group cardsI Check cardsI Refactor

I Transfer the resultI UML class diagramI UML interaction diagrams

Example: Class Diagram (so far)

0..1 *

Borrower

canBorrow

Book

isOverduecheckOut(b:Borrower)calculateDueDate

Librarien

checkOutBook(b:Book)

Date

compare(d:Date)

* *

0..1 dueDate

Example: Sequence Diagram for Check-out book

Check Out Book Realization

Summary

ProcessI Further scenarios give more detailI Repeat CRC process on a more detailed level

I e.g. to design database interaction, or user interfaceI Choose your level of abstraction and stay there

Alternative: Build sequence and class diagrams directly (the”modern” way)

I Danger: talk about the system instead of being part of thesystem

I Possible when object-oriented principles have beenlearned

I CRC cards help with object-oriented thinking

Recommended