Single Responsibility Principle @ AgileCamp Feb, 27 2010

1,702 views
1,549 views

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,702
On SlideShare
0
From Embeds
0
Number of Embeds
17
Actions
Shares
0
Downloads
6
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>

×