49 lines (28 sloc)
Programming principles (SOLID)
Single Responsibility Principle
Open Closed Principle
- Do one thing and do it well.
- Short and focused methods, small and focused classes.
Liskov Substitution Principle
- Be open for extension and closed for modification.
Interface Segregation Principle
- Derived classes can stand in for base classes.
- Replacing an object with an instance of a subtype shouldn't alter the correctness of a program.
- Make interfaces fine grained and client specific.
- Expose only those things that you absolutely have to.
- Many client-specific interfaces are better than one general-purpose interface.
Don't Repeat Yourself (DRY)
- Depend on abstractions, not concrete implementations.
The Boy Scout Principle
- Clipboard inheritance is an anti-pattern.
You Ain't Gonna Need It (YAGNI)
- Clean up after yourself, clean up after others.
- For instance, add some unit tests if there are none.
Separation Of Concerns
- Focus on current actual requirements.
- Focusing one's attention upon some aspect.
- For instance, don't mix your UI and your database logic all together.
- (Similar to Single Responsibility Principle).