Agile Design Principles, a Precursor to .Net Design Patterns

3,963 views

Published on

Before diving into full-blown design patterns it is good to review what have become known as the Agile Design Principles. Maintaining an understanding of design principles is key as we use design patterns in our projects because the two are so closely tied together. In this hour session Tim Star will discuss the Single responsibility principle (SRP), Open Closed Principle (OCP), Liskov Substitution Principle (LSP), Interface Segregation Principle (ISP) and the Dependency Inversion Principle (DIP).

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

No Downloads
Views
Total views
3,963
On SlideShare
0
From Embeds
0
Number of Embeds
2,783
Actions
Shares
0
Downloads
20
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Agile Design Principles, a Precursor to .Net Design Patterns

  1. 1. Oxygen Blast Series Slide 1 @IntertechInc #oxygenblast SOLID Agile Software Design Principles- C# A Consulting Division Presentation Month Date, 2006 — © — All Rights Reserved Tim Star tstar@intertech.com http://www.intertech.com/Blog/
  2. 2. Oxygen Blast Series Slide 2 @IntertechInc #oxygenblast Intertech Training  Training through hands-on, real world business examples.  Our site, your site, or live online – globally.  Agile/Scrum, Citrix, VMware, Oracle, IBM, Microsoft, Java/Open Source, and web and mobile technologies. Consulting  Design and develop software that powers businesses and governments of all sizes.  On-site consulting, outsourcing, and mentoring.  Agile, .NET, Java, SQL Server, mobile development including iPhone and Android platforms and more…. Instructors Who Consult, Consultants Who Teach Our Company  Over 35 awards for growth, innovation and workplace best practices.  99.7% satisfaction score from our consulting and training customers.  Yearly “Best Places to Work” winner in Minnesota.
  3. 3. Oxygen Blast Series Slide 3 @IntertechInc #oxygenblast  Principal Consultant / .Net Architect  Writing Software over 20 Years  5 X Microsoft MVP  Visual Studio ALM Ranger – 6 years  MCPD Enterprise App Development 3.5/4.0 Framework  MCTS WPF/TFS  MCP – VS ALM and Testing with MTM  MCT Experience – Tim Star
  4. 4. Oxygen Blast Series Slide 4 @IntertechInc #oxygenblast Single Responsibility Principle (SRP) Open Closed Principle (OCP) Liskov Substitution Principle (LSP) Interface Segregation Principle (ISP) Dependency Inversion Principle (DIP) Simple Examples Agenda
  5. 5. Oxygen Blast Series Slide 5 @IntertechInc #oxygenblast We want the “ability to develop software quickly, in the face of rapidly changing requirements”. – “Uncle Bob” Martin  Flexibility  Maintainability  Testability Motivation
  6. 6. Oxygen Blast Series Slide 6 @IntertechInc #oxygenblast  Every class should have a single responsibility, and that responsibility should be entirely encapsulated by the class. All its services should be narrowly aligned with that responsibility  Martin defines a responsibility as a reason to change, and concludes that a class or module should have one, and only one, reason to change. Single Responsibility Principle
  7. 7. Oxygen Blast Series Slide 7 @IntertechInc #oxygenblast  Benefits  Highly cohesive classes are easier to maintain  Simplifies testing  Drawbacks  More classes tends to add complexity  Code Smells  Class with 1000’s of Lines of Code  Class with Many unrelated or loosely related Methods SRP Continued
  8. 8. Oxygen Blast Series Slide 8 @IntertechInc #oxygenblast  Software entities (classes, modules, functions, etc.) should be open for extension, but closed for modification Open Closed Principle
  9. 9. Oxygen Blast Series Slide 9 @IntertechInc #oxygenblast  Benefits  Working code stays working  Changes are achieved via new code  Drawbacks  Tends to add complexity  Code Smells  Switch logic  If/Then/Else  TypeOf() OCP Continued
  10. 10. Oxygen Blast Series Slide 10 @IntertechInc #oxygenblast  Objects in a program should be replaceable with instances of their subtypes without altering the correctness of that program Liskov Substitution Principle
  11. 11. Oxygen Blast Series Slide 11 @IntertechInc #oxygenblast  Benefits  Reuse  Maintainable  Robust  Drawbacks  Code Smells  Method Hiding  Not Implemented Exception  Covariance object[] array = new String[10];  Derived Class Violates Reasonable Assumptions LSP Continued
  12. 12. Oxygen Blast Series Slide 12 @IntertechInc #oxygenblast  Many client-specific interfaces are better than one general- purpose interface Interface Segregation Principle
  13. 13. Oxygen Blast Series Slide 13 @IntertechInc #oxygenblast  Benefits  Less Code  Lower Test Impact with Change  Drawbacks  Adds Complexity – Can “Overdo It”  Code Smells  Long Interfaces  Interfaces with Unrelated Concerns ISP Continued
  14. 14. Oxygen Blast Series Slide 14 @IntertechInc #oxygenblast  Depend upon Abstractions. Do not depend upon concretions. Dependency Inversion Principle
  15. 15. Oxygen Blast Series Slide 15 @IntertechInc #oxygenblast  Benefits  Maintainable / Resilient To Change  Testable  Drawbacks  Adds Complexity – Can “Overdo It”  Code Smells  New() DIP Continued
  16. 16. Oxygen Blast Series Slide 16 @IntertechInc #oxygenblast  Demo SOLID
  17. 17. Oxygen Blast Series Slide 17 @IntertechInc #oxygenblast  Great resource: “Agile Principles, Patterns, and Practices in C#”  http://www.butunclebob.co m/ArticleS.UncleBob.Principl esOfOod  http://en.wikipedia.org/wiki/ Solid_(object- oriented_design) Reference
  18. 18. Oxygen Blast Series Slide 18 @IntertechInc #oxygenblast Next Oxygen Blasts  July 30th  iOS 7: Utilizing Push Notifications in Your App with Xcode 5  August 13th  Creating Your Own Dynamic LINQ Statements with Expression Trees Upcoming Training  .NET Design Patterns  June 16-18th  To learn more: http://bit.ly/1wBnImm Upcoming Webinars and Training
  19. 19. Oxygen Blast Series Slide 19 @IntertechInc #oxygenblast Questions or Feedback? Patrick Schaber – pschaber@Intertech.com Thank You

×