看板 OOAD 關於我們 聯絡資訊
最近寫了一個小小framework 運用了下面口訣提供了很大的幫助 :) Encapsulate the changes. //分開包裝所有的變化 Abstract the commons (or repeats). //提出相同(或重複)之處 Inherit the responsibility. //有相同的任務才繼承 Polymorphize the possibilities. //將所有用到的可能性變成多型 Classify the objectives (not objects). //將不同的目的(非物件)分成類別 Implement the supertypes. //先有超型態再對其撰碼 口訣用法: 當在寫OO程式的時候 一定會用到至少一種以上的OO特性(也就是口訣的開頭動詞) 所以當你用到該特性的時候 請檢視一下是否有達成該口訣的要求 因為這個口訣是自己對OO原則的了解所寫出的 若大家覺得用字不妥或不對 歡迎討論 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 203.77.52.127 ※ 編輯: leondemon 來自: 203.77.52.127 (03/14 06:46)
asoedarren :SRP勒? 03/19 00:51
leondemon :SRP等於第一句加第三句 XD 03/20 08:37
leondemon :就不同的Responsibility(changes)就封裝出來再去改 03/20 08:38
leondemon :相同的responsibility則用繼承方式去改寫或新加功能 03/20 08:39