Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Single Responsibility Principle @ AgileCamp Feb, 27 2010

2,287 views

Published on

Published in: Technology, Business
  • Be the first to comment

  • Be the first to like this

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>

×