Software Engineering Fundamentals (SEF): MS.NET Coding Standards

Содержание

Слайд 2

Presentation overview

SOLID principles
KISS, DRY, YAGNI principles
Code readability

© Accenture. By Maksims Ahadovs &

Presentation overview SOLID principles KISS, DRY, YAGNI principles Code readability © Accenture.
Dmitri Kartashov-Gawski.

Слайд 3

SOLID principles

Defined by Robert C. Martin (not all elaborated by him)
Acronym by

SOLID principles Defined by Robert C. Martin (not all elaborated by him)
Michael Feathers
Maintainability, extensibility, robustness

© Accenture. By Maksims Ahadovs & Dmitri Kartashov-Gawski.

Слайд 4

Single Responsibility Principle

SRP: A class should have only one reason to change.
Advantages?
Small

Single Responsibility Principle SRP: A class should have only one reason to
and simple to understand classes
Easy to test
Easy to switch implementations

© Accenture. By Maksims Ahadovs & Dmitri Kartashov-Gawski.

Слайд 5

Open Closed Principle

OCP: A class should be open for extension, but closed

Open Closed Principle OCP: A class should be open for extension, but
for modification.
Advantages?
Minimize risk of introducing bugs into existing functionality

© Accenture. By Maksims Ahadovs & Dmitri Kartashov-Gawski.

Слайд 6

Liskov Substitution Principle

LSP: Let q(x) be a property provable about objects x

Liskov Substitution Principle LSP: Let q(x) be a property provable about objects
of type T. Then q(y) should be true for objects y of type S where S is a subtype of T.
LSP: Derived class should not break client code when used in place of base class.

© Accenture. By Maksims Ahadovs & Dmitri Kartashov-Gawski.

Слайд 7

Liskov Substitution Principle

Preconditions cannot be strengthened in a subtype
Postconditions cannot be weakened

Liskov Substitution Principle Preconditions cannot be strengthened in a subtype Postconditions cannot
in a subtype
Invariants of the supertype must be preserved in a subtype

© Accenture. By Maksims Ahadovs & Dmitri Kartashov-Gawski.

Слайд 8

Liskov Substitution Principle

Contravariance of method arguments in the subtype
Covariance of return types

Liskov Substitution Principle Contravariance of method arguments in the subtype Covariance of
in the subtype

© Accenture. By Maksims Ahadovs & Dmitri Kartashov-Gawski.

Слайд 9

Liskov Substitution Principle (contravariance)

© Accenture. By Maksims Ahadovs & Dmitri Kartashov-Gawski.

Liskov Substitution Principle (contravariance) © Accenture. By Maksims Ahadovs & Dmitri Kartashov-Gawski.

Слайд 10

Liskov Substitution Principle (covariance)

© Accenture. By Maksims Ahadovs & Dmitri Kartashov-Gawski.

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

Liskov Substitution Principle No new exceptions should be thrown by methods of
subtype

© Accenture. By Maksims Ahadovs & Dmitri Kartashov-Gawski.

Слайд 12

Liskov Substitution Principle

Advantages?
Imagine big and complex system like Windows OS. You extend

Liskov Substitution Principle Advantages? Imagine big and complex system like Windows OS.
a class which is used in tens of other classes. By adhering to LSP risk of breaking whole system is minimized.

© Accenture. By Maksims Ahadovs & Dmitri Kartashov-Gawski.

Слайд 13

Interface Segregation Principle

ISP: Client should not be forced to depend on methods

Interface Segregation Principle ISP: Client should not be forced to depend on
it does not use.
Advantages?
Implementer is not pushed to implement methods that it doesn’t need
Client has no temptation to use more than it needs

© Accenture. By Maksims Ahadovs & Dmitri Kartashov-Gawski.

Слайд 14

Dependency Inversion Principle

DIP: High-level modules should not depend on low-level modules. Both

Dependency Inversion Principle DIP: High-level modules should not depend on low-level modules.
should depend on abstractions.
Abstractions should not depend on details. Details should depend on abstractions.
Advantages?
Easy to switch implementations

© Accenture. By Maksims Ahadovs & Dmitri Kartashov-Gawski.

Слайд 15

Other principles

KISS: Keep It Simple, Stupid
DRY: Don’t Repeat Yourself
YAGNI: You Ain’t Gonna

Other principles KISS: Keep It Simple, Stupid DRY: Don’t Repeat Yourself YAGNI:
Need It

© Accenture. By Maksims Ahadovs & Dmitri Kartashov-Gawski.

Слайд 16

Code readability

Clear names
Avoid comments
Formatting

© Accenture. By Maksims Ahadovs & Dmitri Kartashov-Gawski.

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.

Tools StyleCop JetBrains R# © Accenture. By Maksims Ahadovs & Dmitri Kartashov-Gawski.

Слайд 18

Summary

Keep Your POOP SOLID and DRY

© Accenture. By Maksims Ahadovs & Dmitri

Summary Keep Your POOP SOLID and DRY © Accenture. By Maksims Ahadovs & Dmitri Kartashov-Gawski.
Kartashov-Gawski.

Слайд 19

References

SOLID in C# by Chris Klug (TechEd North America 2014)
Adaptive Code

References SOLID in C# by Chris Klug (TechEd North America 2014) Adaptive
via C#: Agile coding with design patterns and SOLID principles by Gary McLean Hall book

© Accenture. By Maksims Ahadovs & Dmitri Kartashov-Gawski.

Слайд 20

Code examples

https://github.com/maksims-ahadovs/SOLID

© Accenture. By Maksims Ahadovs, Dmitri Kartashov-Gawski & Artem Slobolinskyi.

Code examples https://github.com/maksims-ahadovs/SOLID © Accenture. By Maksims Ahadovs, Dmitri Kartashov-Gawski & Artem Slobolinskyi.
Имя файла: Software-Engineering-Fundamentals-(SEF):-MS.NET-Coding-Standards.pptx
Количество просмотров: 19
Количество скачиваний: 0