10. Object-Oriented Analysis
ํ์ต ๋ชฉํ
- Domain์ ํต์ฌ ์ถ์ํ๋ฅผ ์๋ณํ๊ณ domain model๋ก ๋ชจ๋ธ๋ง
- System ๋ด ํต์ฌ ์ํธ์์ฉ ์๋ณ ๋ฐ system sequence diagram์ผ๋ก ๋ชจ๋ธ๋ง
- Low representational gap ์ค๊ณ ์์น์ ์ฅ์ ๋ฐ ํ๊ณ ๋ ผ์
From Requirements to Code

From Problem to Solution
- Problem Space (Domain Model)
- ์ค์ ์ธ๊ณ์ ๊ฐ๋
- ์๊ตฌ์ฌํญ, ๊ฐ๋
- ๊ฐ๋ ๊ฐ์ ๊ด๊ณ
- ๋ฌธ์ ํด๊ฒฐ
- ์ดํ ๊ตฌ์ถ
- Solution Space (Object Model)
- System ๊ตฌํ
- Classes, objects
- Objects ๊ฐ์ ์ฐธ์กฐ ๋ฐ ์์ ๊ณ์ธต
- ๊ฒฐ๊ณผ ๊ณ์ฐ
- ํด๊ฒฐ์ฑ ์ฐพ๊ธฐ
An Object-Oriented Design Process
- ๋ฌธ์ model / diagram, ๊ฐ๋
์ ์
- Domain model (a.k.a. conceptual model), ์ฉ์ด์ง
- System ๋์ ์ ์
- System sequence diagram
- System behavioral contracts
- Object ์ฑ
์ ํ ๋น, ์ํธ์์ฉ ์ ์
- Object interaction diagrams
- ์ ์ฌ์ ํด๊ฒฐ์ฑ
model / diagram
- Object model
- (ํ๋ฆ: OO Analysis: ๋ฌธ์ ์ดํด -> OO Design: ํด๊ฒฐ์ฑ ์ ์)
A Design Process
- Object-Oriented Analysis
- ๋ฌธ์ ์ดํด
- ํต์ฌ ๊ฐ๋ ๊ณผ ๊ทธ ๊ด๊ณ ์๋ณ
- (์๊ฐ์ ) ์ดํ ๊ตฌ์ถ
- Domain model (aka conceptual model) ์์ฑ
- Object-Oriented Design
- Software classes์ ๊ทธ ๊ด๊ณ๋ฅผ class diagrams๋ก ์๋ณ
- ์ฑ ์ (attributes, methods) ํ ๋น
- Interaction diagrams๋ฅผ ํตํ ๋์ ํ์
- ์ค๊ณ ๋์ ํ์
- Object model (aka design model) ๋ฐ interaction models ์์ฑ
- Implementation
- ์ค๊ณ๋ฅผ code๋ก mapping, classes ๋ฐ methods ๊ตฌํ
A High-level Software Design Process
- Project ์์
- ์๊ตฌ์ฌํญ ์์ง
- Actors ๋ฐ use cases ์ ์
- ๋ฌธ์ model / diagram, objects ์ ์
- System ๋์ ์ ์
- Object ์ฑ ์ ํ ๋น
- Object ์ํธ์์ฉ ์ ์
- ์ ์ฌ์ ํด๊ฒฐ์ฑ model / diagram
- ํด๊ฒฐ์ฑ ๊ตฌํ ๋ฐ test
- ์ ์ง๋ณด์, ๋ฐ์ ๋ฑ
Domain Models ๋๋ฉ์ธ ๋ชจ๋ธ
Object-Oriented Analysis
- ์๊ตฌ์ฌํญ์ ๋์ค๋ ๋ช ์ฌ๋ค, ์์ฐ์ด ์ฉ์ด์ง
- Problem domain์ ๊ฐ๋
์ฐพ๊ธฐ
- Real-world abstractions, ๋ฐ๋์ software objects๋ ์๋
- ๋ฌธ์ ์ดํด
- ๊ณตํต ์ดํ ํ๋ฆฝ
- ๊ณตํต ๋ฌธ์ํ, ํฐ ๊ทธ๋ฆผ
- Communication์ ์ํจ
- (๋น๊ณต์์ ์ธ) ํ๊ธฐ๋ฒ์ผ๋ก UML class diagrams๋ฅผ ์์ฃผ ์ฌ์ฉ
- ์ถํ classes๋ฅผ ์ฐพ๊ธฐ ์ํ ์ถ๋ฐ์ (low representational gap)
Input to the Analysis Process: Requirements and Use Cases
๊ณต๊ณต ๋์๊ด์ ์ผ๋ฐ์ ์ผ๋ก ์ง์ญ ์ฌํ ์ฃผ๋ฏผ๋ค์ด ๋์ถํ ์ ์๋ ๋์, ์ํ ๋๋ ๊ธฐํ ๋์๊ด ์๋ฃ๋ฅผ ์์ฅํฉ๋๋ค. ๊ฐ ํ์์๊ฒ๋ ์ผ๋ฐ์ ์ผ๋ก ๋์๊ด ๊ณ์ ๊ณผ ๊ณ์ ID ๋ฒํธ๊ฐ ๊ธฐ์ฌ๋ ๋์๊ด ์นด๋๊ฐ ๋ฐ๊ธ๋๋ฉฐ, ์ด๋ฅผ ํตํด ๋์๊ด์์ ๋ณธ์ธ ํ์ธ์ ํ ์ ์์ต๋๋ค. ํ์์ ๋์๊ด ๊ณ์ ์๋ ํด๋น ํ์์ด ๋์ถํ ์๋ฃ์ ๊ฐ ๋์ถ ์๋ฃ์ ๋ฐ๋ฉ ๊ธฐํ์ด ๊ธฐ๋ก๋ฉ๋๋ค. ๊ฐ ์๋ฃ ์ ํ์๋ ๊ธฐ๋ณธ ๋์ฌ ๊ธฐ๊ฐ์ด ์ค์ ๋์ด ์์ผ๋ฉฐ, ์ด๋ ์๋ฃ๊ฐ ๋์ถ๋ ๋ ๋ฐ๋ฉ์ผ์ ๊ฒฐ์ ํฉ๋๋ค. ํ์์ด ๋ฐ๋ฉ์ผ ์ดํ์ ์๋ฃ๋ฅผ ๋ฐ๋ฉํ ๊ฒฝ์ฐ, ํด๋น ์๋ฃ์ ์ง์ ๋ ์ฐ์ฒด๋ฃ๋ฅผ ์ง๋ถํด์ผ ํ๋ฉฐ, ์ด ๊ธ์ก์ ํ์์ ๋์๊ด ๊ณ์ ์ ๊ธฐ๋ก๋ฉ๋๋ค.
์ฌ์ฉ ์ฌ๋ก ์๋๋ฆฌ์ค: ๋์๊ด ํ์์ ๋์๊ด ์์คํ ํค์ค์คํฌ์์ ๋์๊ด ์นด๋๋ก ๋ก๊ทธ์ธํ์ฌ ์ฑ ์ ๋์ถํ ์ ์์ด์ผ ํฉ๋๋ค. ํ์์ ๋ฏธ๋ฉ ์ฐ์ฒด๋ฃ๊ฐ ์์์ ํ์ธํ ํ, ๋์๊ด ์์คํ ์ ํด๋น ๋์์ ๋์ฌ ๊ธฐ๊ฐ์ ํ์ฌ ๋ ์ง์ ๋ํ์ฌ ๋ฐ๋ฉ ๊ธฐํ์ ๊ฒฐ์ ํ๊ณ , ํด๋น ๋์์ ๋ฐ๋ฉ ๊ธฐํ์ ํ์์ ๋์๊ด ๊ณ์ ์ ๋์ถ ์๋ฃ๋ก ๊ธฐ๋กํด์ผ ํฉ๋๋ค.
Modeling a Problem Domain
- Domain ์ค๋ช
์ ํต์ฌ ๊ฐ๋
์๋ณ
- ๋ช ์ฌ, ๋์ฌ, ๊ฐ๋ ๊ฐ ๊ด๊ณ ์๋ณ
- "System"๊ณผ ๊ฐ์ non-specificํ ์ดํ ์ง์
- Operations์ concepts ๊ตฌ๋ถ
- Domain ์ ๋ฌธ๊ฐ์ brainstorming
Glossary ์ฉ์ด์ง
- ํต์ฌ ๊ฐ๋ ์๋ณ ๋ฐ ์ ์
- ๊ฐ๋ฐ์์ ๊ณ ๊ฐ ๊ฐ์ ๊ณต์ ๋ ์ดํด ๋ณด์ฅ

Visual Notation: UML
- (UML ํ๊ธฐ๋ฒ ์์ ์ด๋ฏธ์ง)
Reading Associations
- (์ฐ๊ด ๊ด๊ณ(Associations) ์ฝ๊ธฐ ์์ ์ด๋ฏธ์ง)
Attributes vs. Concepts
- "์ค์ ์ธ๊ณ์์ ์ด๋ค ๊ฐ๋ ์ class X๋ฅผ text๋ ์ซ์๋ก ์๊ฐํ์ง ์๋๋ค๋ฉด, ๊ทธ๊ฒ์ attribute๊ฐ ์๋๋ผ concept์ผ ๊ฐ๋ฅ์ฑ์ด ๋์"
- Type annotations ํํผ
Modeling a Problem Domain
- Domain model์ ์ด์์๋ ๋ฌธ์
- Communication์ ์ํด ์ฌ์ฉ
- ์ค์ ์ธ๊ณ ๊ฐ๋
์ ์ง์ค
- (์: Database ๊ฐ์ ์ถ์์ ๊ตฌํ ๊ด์ฌ์ฌ ์๋)
- Methods/operations ์์
- ๊ด๊ณ(relationships)์ ๋ค์ค์ฑ(cardinalities) ํ์
Identifying Concepts
- (๋์๊ด ์์คํ ์์ ํ ์คํธ์์ ๊ฐ๋ ์๋ณ ์์ - 1์ฐจ)
- A public library ... collection of books, movies, or other library items ... people living in a community. Each library member ... library account ... library card ... accountโs ID number ... the library. A memberโs library account ... items ... member ... due date ... borrowed item. Each type of item ... default rental period ... itemโs due date ... item. If a member ... item ... itemโs due date, the member ... late fee ... item, an amount of money ... memberโs library account
- (๋์๊ด ์์คํ ์์ ํ ์คํธ์์ ๊ฐ๋ ์๋ณ ์์ - 2์ฐจ ์ ์ )
- A public library ... collection of books, movies, or other library items ... Each library member ... library account ... library card ... ID number ... A memberโs library account ... items ... member ... due date ... borrowed item. Each type of item ... default rental period ... itemโs due date ... item. If a member ... item ... itemโs due date, the member ... late fee ... item, an amount of money ... memberโs library account
Hints for Identifying Concepts
- ์๊ตฌ์ฌํญ ๋ช ์ธ ์ฝ๊ธฐ, ๋ช ์ฌ ์ฐพ๊ธฐ
- ๊ธฐ์กด models ์ฌ์ฌ์ฉ
- ๋ฒ์ฃผ list ์ฌ์ฉ
- ์ ํ์ ์ฌ๋ฌผ:
cars,telemetry data,terminals๋ฑ - ์ญํ :
mother,teacher,researcher - ์ด๋ฒคํธ:
landing,purchase,request - ์ํธ์์ฉ:
loan,meeting,intersection๋ฑ - ๊ตฌ์กฐ, ์ฅ์น, ์กฐ์ง ๋จ์ ๋ฑ
- ์ ํ์ ์ฌ๋ฌผ:
- ์ผ๋ฐ์ ์ธ use scenarios ๋ถ์, ๋์ ๋ถ์
- Brainstorming
- ๋จผ์ ์์ง; ๋์ค์ ์กฐ์ง, ํํฐ๋ง, ์์
One Domain Model for the Library System

Notes on the Library Domain Model
- ๋ชจ๋ ๊ฐ๋ ์ ํ๋ก๊ทธ๋๋จธ๊ฐ ์๋์ด๋ ์ ๊ทผ ๊ฐ๋ฅ
- UML ํ๊ธฐ๋ฒ์ ๋ค์ ๋น๊ณต์์ . ๊ด๊ณ๋ ์ข ์ข ๋จ์ด๋ก ์ค๋ช ๋จ
- ์ค์ ์ธ๊ณ์ "is-a" ๊ด๊ณ๋ domain model์ ์ ํฉ
- ์ค์ ์ธ๊ณ์ ์ถ์ํ๋ domain model์ ์ ํฉ
- ๋ฐ๋ณต์ด ์ค์: ์ด ์์๋ ์ด์์. ์ค์ ์ค๊ณ์์๋ ์ผ๋ถ ์ฉ์ด ์์ ๊ฐ๋ฅ์ฑ
- ์:
Itemvs.LibraryItem,Accountvs.LibraryAccount
- ์:
- ์งํฉ ํ์ (Aggregate types)์ ๋ณดํต ๋ณ๋ ๊ฐ๋ ์ผ๋ก ๋ชจ๋ธ๋ง
- ๊ธฐ๋ณธ attributes (์ซ์, ๋ฌธ์์ด)๋ ๋ณดํต attributes๋ก ๋ชจ๋ธ๋ง
Why Domain Modeling?
- Domain ์ดํด
- ์ธ๋ถ์ฌํญ์ด ์ค์! (์: System์๊ฒ ์ฑ ๊ณผ ๋น๋์ค๋ ๋ค๋ฅธ๊ฐ?)
- ์์ ์ฑ ๋ณด์ฅ
- (์: ์ฐ์ฒด๋ฃ๊ฐ ๊ณ ๋ ค๋์๋๊ฐ?)
- ๊ณตํต ์ฉ์ด ์งํฉ์ ๋์
- ์:
library itemvscollection entryvsbook
- ์:
- ์ค๊ณ ์ค๋น
- Domain concepts๋ OO classes์ ์ข์ ํ๋ณด (-> low representational gap)
Hints for Object-Oriented Analysis (1)
- Domain model์ ์ดํ ์ ๊ณต
- ๊ฐ๋ฐ์, ํ ์คํฐ, ๊ณ ๊ฐ, domain ์ ๋ฌธ๊ฐ ๊ฐ communication์ ์ํจ
- ๋จ์ผ ์ดํ์ ๋์ํ๊ณ ์๊ฐํ
- Software classes๋ data๊ฐ ์๋, concepts์ ์ง์ค
- ์์ด๋์ด, ์ฌ๋ฌผ, objects
- ์ด๋ฆ ๋ถ์ฌ, ์ ์ ๋ฐ ์์ ์ ๊ณต (symbol, intension, extension)
- ์ฉ์ด์ง(Glossary) ์ถ๊ฐ
- ์ผ๋ถ๋ classes๋ก ๊ตฌํ๋ ์๋, ์๋ ์๋ ์์
Hints for Object-Oriented Analysis (2)
- ๋ง์ ์ ํ์ง๊ฐ ์กด์ฌ
- Model์ด ์๋ฒฝํ๊ฒ ์ ํํ์ง ์์ ๊ฒ์
- ๊ด์ฐฎ์
- ๋ถ๋ถ์ ์ธ model๋ก ์์, ํ์ํ ๊ฒ๋ง ๋ชจ๋ธ๋ง
- ๋์ค์ ์ถ๊ฐ ์ ๋ณด๋ก ํ์ฅ
- ๋ณ๊ฒฝ ์ฌํญ ๋ช ํํ communicate
- ๊ทธ๋ ์ง ์์ผ๋ฉด "analysis paralysis(๋ถ์ ๋ง๋น)" ์ํ
Domain Model Distinctions
- VS. data model (solution space)
- ๋ฐ๋์ ์ ์ฅ๋ data๋ ์๋
- VS. object model ๋ฐ Java classes (solution space)
- ์ค์ domain concepts๋ง ํฌํจ (์ค์ objects ๋๋ ์ค์ ์ธ๊ณ์ ์ถ์ํ)
- "UI frame", database ๋ฑ ๋ฏธํฌํจ
System Sequence Diagram
Understanding System Behavior
- System sequence diagram: ํ๋์ use scenario์ ๋ํด, system์ ๊ฒฝ๊ณ(boundary)์์ ๋ฐ์ํ๋ ์ด๋ฒคํธ ์์๋ฅผ ๋ณด์ฌ์ฃผ๋ model
- ์ค๊ณ ๋ชฉํ: System์ interface ์๋ณ ๋ฐ ์ ์
- System ์์ค์ ๊ตฌ์ฑ์์๋ง (์: ์ฌ์ฉ์์ ์ ์ฒด system)
One Example for the Library System
- Use case ์๋๋ฆฌ์ค: Library member๊ฐ library card๋ก kiosk ๋ก๊ทธ์ธ ํ ์ฑ
๋์ถ. ์ฐ์ฒด๋ฃ ๋ฏธ๋ฉ ํ์ธ ํ, rental period๋ฅผ ๋ํด ๋ฐ๋ฉ ๊ธฐํ ๊ฒฐ์ . ์ฑ
๊ณผ ๋ฐ๋ฉ ๊ธฐํ์ member์ account์ ๊ธฐ๋ก

Behavioral Contracts
Formalize System at Boundary
- System behavioral contract
- System sequence diagrams์์ ์๋ณ๋ ํน์ operation์ ๋ํ pre-conditions์ post-conditions ๊ธฐ์
- System ์์ค์ ํ ์คํธ ๋ช ์ธ, software specifications์ ์ ์ฌ
System Behavioral Contract Example
- Operation:
borrow(item) - Pre-conditions:
- Library member๊ฐ system์ ์ด๋ฏธ ๋ก๊ทธ์ธํจ
- Item์ด ํ์ฌ ๋ค๋ฅธ member์๊ฒ ๋์ถ๋์ง ์์
- Post-conditions:
- ๋ก๊ทธ์ธ๋ member์ account์ ์๋ก ๋์ถ๋ item ๊ธฐ๋ก, ๋๋ member์๊ฒ ๋ฏธ๋ฉ ์ฐ์ฒด๋ฃ ๊ฒฝ๊ณ
- ์๋ก ๋์ถ๋ item์ item์ rental period + ํ์ฌ ๋ ์ง๋ก ๊ณ์ฐ๋ ๋ฏธ๋์ ๋ฐ๋ฉ ๊ธฐํ ํฌํจ
Distinguishing Domain vs. Implementation Concepts
- Domain-level concepts:
- ์ค์ ์ธ๊ณ์ ์ ์ฌ๋ฌผ(analogue)์ ๊ฐ์ง ๊ฑฐ์ ๋ชจ๋ ๊ฒ
- Implementation-level concepts:
- ๊ตฌํ๊ณผ ์ ์ฌํ method ์ด๋ฆ
- Programming types
- Visibility modifiers
- Helper methods ๋๋ classes
- Design patterns์ ์ฐ์ถ๋ฌผ
Summary: Understanding the Problem Domain
- Domain ์์ค์ ํํ์ ๊ตฌ์ถํ๋ tools ํ์
- Domain models
- System sequence diagrams
- System behavioral contracts
- ์ ์ํ๊ณ (๋๋ก๋) ์ ์ฐํ๊ฒ
- ๋ช ๋ฐฑํ(?) ์ธ๋ถ ์ฌํญ ์๋ต
- ๋ฐ๋ณต, ๋ฐ๋ณต, ๋ ๋ฐ๋ณต...
- Domain ์ ๋ฌธ๊ฐ๋ก๋ถํฐ feedback ๋ฐ๊ธฐ
- Domain ์์ค์ concepts๋ง ์ฌ์ฉ
