目前分類:【回憶】程式設計 (2)

瀏覽方式: 標題列表 簡短摘要
動機 :
該類別有太多Responsibility造成類別程式碼過多或是該類別和別類別互動太頻繁造成類別間couple tightly.

方式:
如果移出的方法需要用到原本類別的屬性,可考慮下列4種方式
(1)將該屬性和方法一起移出
(2)利用參數傳遞(Source class => Target Class)
(3)屬性很多的話,可將原類別當成參數傳遞( Source class => Target Class)
(4)Create or use a reference from the target class to the source( Target Class => Source Class)

Sample Code //待整理

avseq 發表在 痞客邦 留言(0) 人氣()

1.A design decision that is reasonable and correct one week can become incorrect in another.That is not a problem;the only problem is not to do something about it.

avseq 發表在 痞客邦 留言(0) 人氣()