HeadFirst設計模式一書中的9條設計原則(Design Principle)

招聘公司評價

1, [封裝變化]:找出應用中可能變化需要變化之處,把他們獨立出來,不要和那些不需要變化之處的代碼混在一起.(Identify theaspects of your application that vary separate them from what thesame.)

2,針對接口編程(Progrma to an interface,not an implementation.)

3,多用組合少用繼承(Favor composition over inheritance.)

4,爲了交互對象之間的鬆耦合設計而努力!(Strive for loosely coupled designs between objects that interact.)

5,類應該擴展開放,對修改關閉(Classes should be open for extension but closed for modification.)

6,要依賴抽象,不要依賴具體類(Depend on abstractions,Do not depend on concrete classes.)

7,最少知識原則:只和你的密友談話(Only talk to your friends.)

8,別打電話給(調用)我,我會打電話給(調用)你(Don't call us,we'll call you.)

9,一個類應該只有一個引起變化的原因(A class should have only one reason to change.)

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章