Well, I cannot remote into my home PC tonight so I decided to add another tip. Something that is taught from the very beginning of software design; however, something that I see broken every day in all projects I have worked on:
Code against interfaces and not concrete classes:
- Interfaces give an ability to design by contract
- Interfaces give an ability to reuse code from unrelated types (as long as they implement the same interface)
- Interfaces are easier for developers to implement instead of deriving from base class
Plus for abstract classes:
- Any method that's added is automatically implemented by derived classes
- Any added method does not have to be implemented by derived class, unlike an interface
No comments:
Post a Comment