Top Banner
Design patterns: The Single-Responsibility Principle Grzegorz Wilczyński 11th november 2012
10

Single responsibility principle

May 06, 2015

Download

Technology

Single responsibility principle
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Single responsibility principle

Design patterns: The Single-Responsibility

Principle

Grzegorz Wilczyński 11th november 2012

Page 2: Single responsibility principle

SOLID

The principles when applied together intend to make it more likely that a programmer will create a system that is easy to maintain and extend over time.

http://en.wikipedia.org/wiki/Solid_(object-oriented_design)

Page 3: Single responsibility principle

SOLID

Single responsibilityOpen-closedLiskov substitutionInterface segregationDependency inversion

http://en.wikipedia.org/wiki/Solid_(object-oriented_design)

Page 4: Single responsibility principle

BIBLE

http://www.amazon.com/Agile-Principles-Patterns-Practices-C/dp/0131857258

Page 5: Single responsibility principle

Rule #1

A class should have only one reason to change.

"Agile Principles, Patterns, and Practices in C#" Robert C. Martin

Page 6: Single responsibility principle

Rule #2

A class should have only one reason to change.

"Agile Principles, Patterns, and Practices in C#" Robert C. Martin

Page 7: Single responsibility principle

So please don't...

http://3.bp.blogspot.com/-FQZ4VT_gbRY/T8RvXLTPWMI/AAAAAAAABP0/JCckSpENM88/s640/SingleResponsibilityPrinciple.jpg

Page 8: Single responsibility principle

Step 1

http://www.remondo.net/wp-content/uploads/2012/03/SingleResponsibilityPrincipleRadio.png

Page 9: Single responsibility principle

Step 2

http://www.remondo.net/wp-content/uploads/2012/03/SingleResponsibilityPrincipleRadioManagers.png

Page 10: Single responsibility principle

Homework

$ git branch gw-solid-1

end time: 16.11.2012