SOLID as a Rock

Topics covered
Popular Clips
Episode Highlights
Interface Segregation
The Interface Segregation Principle (ISP) emphasizes creating smaller, more specific interfaces to enhance code maintainability and flexibility. Joe Zack highlights that a method should only interact with the parts of an interface it needs, using a car braking system as an example where only relevant information is required 1. This approach prevents the need to implement unnecessary methods, as Alan Underwood points out with the .NET membership provider example, which requires implementing numerous methods for simple tasks 1.
If your interface requires a lot of methods to be implemented that often aren't needed, your code smells.
--- Michael Outlaw
Alan also notes that smaller interfaces simplify unit testing, as they allow for easier creation of mock classes 2.
  Â
Interface Implementation
Implementing interfaces effectively involves organizing them in a way that maintains clarity and flexibility. Joe Zack and Alan Underwood discuss the importance of keeping interfaces concise and organized, suggesting methods like placing them in separate folders or even within the same file for small classes 2. This organization aids in maintaining a clean codebase, especially when adhering to SOLID principles, which often result in numerous small classes.
If you're following these solid principles, you're probably going to end up with so many freaking classes that you can't really use the file explorer much anyway.
--- Joe Zack
Michael Outlaw adds that understanding the substitutable nature of interfaces can prevent code smells, such as unnecessary type checks, which complicate code maintenance 3.
Related Episodes
Design Patterns Part 1
Answers 383 questionsDesign Patterns Part 3
Answers 383 questionsC# 6 and Roslyn
Answers 383 questionsDesigning Data-Intensive Applications – Scalability
Answers 383 questions

Clean Code - How to Write Classes the Right Way
Answers 383 questionsClean Code - How to Write Amazing Functions
Answers 383 questionsHow to be a Programmer
Answers 383 questions94. Data Structures - Primitives
Answers 383 questions

Clean Code - How to Build Maintainable Systems
Answers 383 questionsSilverlighting through your College Enumeration
Answers 383 questions95. Data Structures – Arrays and Array-ish
Answers 383 questionsI is for Interface
Answers 383 questions
Aspectacular with Vlad Hrybok
Answers 383 questionsBoxing and Unboxing in .NET
Answers 383 questions86. Lightning Talks
Answers 383 questions
