rental-refactored's People
rental-refactored's Issues
switchの構造の類似性を明白にする
移動する
New ReleaseのbaseDaysにゼロを導入
計算処理を switchの外に出す
金額計算を Movie タイプに移動
rateパッケージの導入
関心の分離
特性の横恋慕の解消その2 レンタルポイントの計算を Rentalに
Statement モデルと Statement ビューの分離
最初にやるか?
最後にやるか?
段取りとしては、最初にやったほうが良い?
Rentals や、 RentalType にロジックを移動してから、 Statementのビューとモデルを分ける?
ビューの分割はしたほうがよさそう
Header, Lines , Footer
Statementクラスの導入
RentalTypeの導入
ポイント合計をrentalsに移動
DaysRentedの導入
Rentalに主要概念として
OldReleaseクラスの導入
statementに何を渡すか?
customer と rentals を分ける
rentals に customer を持たせ、rentals が名前を返す
document を最新のコードに同期させる
ドル単位から円単位に(floatからintに)
CustomerクラスをRentalに持たせる
Rental を表現する属性の一つとして、Customerクラスを持たせる
定数に名前をつける
Rateインタフェースの導入
新旧を分離するため
レンタル日数の問い合わせメソッドを変数の直接参照に
本来は、スイッチ文を移動した段階で直しておくべき個所
Rentals に合計金額の計算ロジックを移動
破壊的代入を、目的別の変数に変更
MovieTypeの深堀
- ポイントは、新作かどうかだけで決まる
- 一般と子供の超過日料金は同じ
- 新作は、一般と子供の区別はない(本来はあるはず)
つまり、基本的には (一般|子供) X (新作:旧作)の4パターン
ここで、新作の判断のほうが、一般・子供よりも優先される
どう表現するのが良いか?
それを実験するには、どんな修正をすると良いか?
あるいは、料金表から考えてみる?
ポイント計算を Movieタイプに移動
Rentals クラスの導入
コレクションオブジェクト
特性の横恋慕の解消( switch文を Rental に移動)
表記の日本語化
NewRelease クラスの導入
定数をMovieTypeに移動
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.