principles:interface_segregation_principle
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
— | principles:interface_segregation_principle [2018-09-26 12:10] – created 62.228.239.6 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Interface Segregation Principle ====== | ||
+ | ===== Variants and Alternative Names ===== | ||
+ | |||
+ | ===== Context ===== | ||
+ | * [[contexts: | ||
+ | |||
+ | |||
+ | ===== Principle Statement ===== | ||
+ | Don't expose methods to your clients, methods that they don't use. | ||
+ | |||
+ | ===== Description ===== | ||
+ | |||
+ | |||
+ | ===== Rationale ===== | ||
+ | Exposing functionality that the client class does not need at most a security risk and at the very least noise for the client class. | ||
+ | You don't want your class' | ||
+ | |||
+ | ===== Strategies ===== | ||
+ | /*How to make a design more compliant to this principle*/ | ||
+ | |||
+ | ===== Caveats ===== | ||
+ | |||
+ | See section [[#contrary principles]]. | ||
+ | |||
+ | |||
+ | ===== Origin ===== | ||
+ | |||
+ | |||
+ | ===== Evidence ===== | ||
+ | /* Comment out what is not applicable and explain the rest: */ | ||
+ | |||
+ | /* * [[wiki: | ||
+ | /* * [[wiki: | ||
+ | /* * [[wiki: | ||
+ | /* * [[wiki: | ||
+ | |||
+ | ===== Relations to Other Principles ===== | ||
+ | |||
+ | ==== Generalizations ==== | ||
+ | |||
+ | ==== Specializations ==== | ||
+ | |||
+ | ==== Contrary Principles ==== | ||
+ | |||
+ | ==== Complementary Principles ==== | ||
+ | |||
+ | ==== Principle Collections ==== | ||
+ | |||
+ | |||
+ | ===== Examples ===== | ||
+ | |||
+ | ==== Coffee Maker ==== | ||
+ | Let's say your coffee maker logic receives input from various sensors which are external components to it. Eg: tankOutOfWater() and waterHeated() from the WaterTank and HeatSensor components respectively. You don't want the WaterTank component to be able to access the waterHeated() method. You can do this, by making your business logic implement the interfaces TankObserver and TemperatureObserver, | ||
+ | |||
+ | ===== Description Status ===== | ||
+ | /* Choose one of the following and comment out the rest: */ | ||
+ | [[wiki: | ||
+ | / | ||
+ | / | ||
+ | |||
+ | ===== Further Reading ===== | ||
+ | |||
+ | |||
+ | ===== Discussion ===== | ||
+ | |||
+ | Discuss this wiki article and the principle on the corresponding [[talk: |
principles/interface_segregation_principle.txt · Last modified: 2021-10-18 21:55 by christian