-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ 【第12章 設計とメタファー】 $5 + 5 CHF を実現するため plus メソッドは Expression(式)として返すようにする
・Expression(式)がそれ以外の事柄をできるだけ知らいないような設計を続けることで、柔軟性が高く、かつテストや再利用、理解が簡単な状態を保てるようにするため採用する ・結果の Expression オブジェクトは為替レートによって1つの通貨に換算できることを想定している
- Loading branch information
1 parent
325811c
commit da1c24c
Showing
4 changed files
with
10 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
import { Expression } from './expression'; | ||
import { Money } from './money'; | ||
|
||
export class Bank { | ||
reduce(sum: Money, currency: string):Money { | ||
reduce(sum: Expression, currency: string):Money { | ||
return Money.dollar(10); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export interface Expression{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters