Agile Design Principles, a Precursor to .Net Design Patterns
-
Upload
intertech-training -
Category
Software
-
view
1.251 -
download
3
description
Transcript of Agile Design Principles, a Precursor to .Net Design Patterns
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
[email protected]://www.intertech.com/Blog/
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.
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
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
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
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
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
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
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
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
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
Oxygen Blast Series
Slide 12@IntertechInc #oxygenblast
Many client-specific interfaces are better than one general-purpose interface
Interface Segregation Principle
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
Oxygen Blast Series
Slide 14@IntertechInc #oxygenblast
Depend upon Abstractions. Do not depend upon concretions.
Dependency Inversion Principle
Oxygen Blast Series
Slide 15@IntertechInc #oxygenblast
Benefits Maintainable / Resilient To Change Testable
Drawbacks Adds Complexity – Can “Overdo It”
Code Smells New()
DIP Continued
Oxygen Blast Series
Slide 16@IntertechInc #oxygenblast
Demo
SOLID
Oxygen Blast Series
Slide 17@IntertechInc #oxygenblast
Great resource: “Agile Principles, Patterns, and Practices in C#”
http://www.butunclebob.com/ArticleS.UncleBob.PrinciplesOfOod
http://en.wikipedia.org/wiki/Solid_(object-oriented_design)
Reference
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
Oxygen Blast Series
Slide 19@IntertechInc #oxygenblast
Questions or Feedback?Patrick Schaber – [email protected]
Thank You