SRP Andrea Francia
<ul><li>What is SRP? </li></ul><ul><li>Why you should apply SRP? </li></ul><ul><li>Why you shouldn’t apply SRP? </li></ul>
The Principle <ul><li>Single Responsibility Principle: </li></ul><ul><li>“ A class should have only one reason to change” ...
Problems without SRP <ul><li>Problems: </li></ul><ul><ul><li>Linking of gui.lib in CalcApp </li></ul></ul><ul><ul><li>If a...
Applying SRP <ul><li>Is better? Depends </li></ul><ul><ul><li>More Complex </li></ul></ul><ul><ul><li>Less Fragile  … but ...
Violation example: use of wxWidgets instead of wxBase
Violation example: bad use of wxWidgets <ul><li>Solution: extract responsibiliy </li></ul>
Too much SRP
Bad use of JPA Entities
Thanks <ul><li>Andrea Francia </li></ul><ul><ul><li>[email_address] </li></ul></ul><ul><ul><li>http:// www.andreafrancia.i...
Upcoming SlideShare
Loading in...5
×

Single Responsibility Principle @ AgileCamp Feb, 27 2010

1,273

Published on

Published in: Technology, Business
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,273
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
4
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Single Responsibility Principle @ AgileCamp Feb, 27 2010

  1. 1. SRP Andrea Francia
  2. 2. <ul><li>What is SRP? </li></ul><ul><li>Why you should apply SRP? </li></ul><ul><li>Why you shouldn’t apply SRP? </li></ul>
  3. 3. The Principle <ul><li>Single Responsibility Principle: </li></ul><ul><li>“ A class should have only one reason to change” </li></ul><ul><li>from the PPP Book: “Agile Software Development Principle, Patterns, and Practice” by Robert C. Martin </li></ul>
  4. 4. Problems without SRP <ul><li>Problems: </li></ul><ul><ul><li>Linking of gui.lib in CalcApp </li></ul></ul><ul><ul><li>If a change in GraphApp forces a change in Rectangle we may be force to rebuild, retest and redeploy CalcApp. </li></ul></ul>
  5. 5. Applying SRP <ul><li>Is better? Depends </li></ul><ul><ul><li>More Complex </li></ul></ul><ul><ul><li>Less Fragile … but in respect of what type of change? </li></ul></ul>
  6. 6. Violation example: use of wxWidgets instead of wxBase
  7. 7. Violation example: bad use of wxWidgets <ul><li>Solution: extract responsibiliy </li></ul>
  8. 8. Too much SRP
  9. 9. Bad use of JPA Entities
  10. 10. Thanks <ul><li>Andrea Francia </li></ul><ul><ul><li>[email_address] </li></ul></ul><ul><ul><li>http:// www.andreafrancia.it / </li></ul></ul><ul><ul><li>http:// blog.andreafrancia.it / </li></ul></ul>
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×