Содержание
- 2. Presentation overview SOLID principles KISS, DRY, YAGNI principles Code readability © Accenture. By Maksims Ahadovs &
- 3. SOLID principles Defined by Robert C. Martin (not all elaborated by him) Acronym by Michael Feathers
- 4. Single Responsibility Principle SRP: A class should have only one reason to change. Advantages? Small and
- 5. Open Closed Principle OCP: A class should be open for extension, but closed for modification. Advantages?
- 6. Liskov Substitution Principle LSP: Let q(x) be a property provable about objects x of type T.
- 7. Liskov Substitution Principle Preconditions cannot be strengthened in a subtype Postconditions cannot be weakened in a
- 8. Liskov Substitution Principle Contravariance of method arguments in the subtype Covariance of return types in the
- 9. Liskov Substitution Principle (contravariance) © Accenture. By Maksims Ahadovs & Dmitri Kartashov-Gawski.
- 10. Liskov Substitution Principle (covariance) © Accenture. By Maksims Ahadovs & Dmitri Kartashov-Gawski.
- 11. Liskov Substitution Principle No new exceptions should be thrown by methods of the subtype © Accenture.
- 12. Liskov Substitution Principle Advantages? Imagine big and complex system like Windows OS. You extend a class
- 13. Interface Segregation Principle ISP: Client should not be forced to depend on methods it does not
- 14. Dependency Inversion Principle DIP: High-level modules should not depend on low-level modules. Both should depend on
- 15. Other principles KISS: Keep It Simple, Stupid DRY: Don’t Repeat Yourself YAGNI: You Ain’t Gonna Need
- 16. Code readability Clear names Avoid comments Formatting © Accenture. By Maksims Ahadovs & Dmitri Kartashov-Gawski.
- 17. Tools StyleCop JetBrains R# © Accenture. By Maksims Ahadovs & Dmitri Kartashov-Gawski.
- 18. Summary Keep Your POOP SOLID and DRY © Accenture. By Maksims Ahadovs & Dmitri Kartashov-Gawski.
- 19. References SOLID in C# by Chris Klug (TechEd North America 2014) Adaptive Code via C#: Agile
- 20. Code examples https://github.com/maksims-ahadovs/SOLID © Accenture. By Maksims Ahadovs, Dmitri Kartashov-Gawski & Artem Slobolinskyi.
- 22. Скачать презентацию