Interface Segregation Principle
Definition:
No client should be forced to depend on methods it does not use.
Why It Matters:
Prevents bloated interfaces and unnecessary dependencies.
Analogy:
A restaurant menu should have separate sections, so customers only choose from relevant options.
Example (Language-Agnostic):
Instead of one 'Machine' interface with 'print', 'scan', and 'fax', create separate interfaces for each function.
Key Points to Remember:
• Create focused, small interfaces
• Improves flexibility
• Reduces implementation burden
Extra Notes from Class:
1. Discussed common mistakes students make when applying this principle. 2. Explored scenarios where
strict adherence might not be practical. 3. Related principle to real-world software projects we reviewed. 4.
Wrote pseudo-code in class to demonstrate the principle in action. 5. Compared with other principles to
understand overlaps and differences.
Class note 1: Example discussion point...
Class note 2: Example discussion point...
Class note 3: Example discussion point...
Class note 4: Example discussion point...
Class note 5: Example discussion point...
Class note 6: Example discussion point...
Class note 7: Example discussion point...
Class note 8: Example discussion point...
Class note 9: Example discussion point...
Class note 10: Example discussion point...