improving the design of existing software
TRANSCRIPT
![Page 1: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/1.jpg)
Improving the Design of Existing Software
Steve Smith
Founder, DevIQ
@ardalis | DevIQ.com
![Page 2: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/2.jpg)
My Pluralsight Courses
![Page 3: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/3.jpg)
Weekly Dev TipsPodcast and Newsletter
• Ardalis.com/tips
• WeeklyDevTips.com
![Page 4: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/4.jpg)
Software Rots
![Page 5: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/5.jpg)
![Page 6: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/6.jpg)
![Page 7: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/7.jpg)
Technical Debt
• Low quality code and shortcuts in our applications
• Financial Debt
• Principal – Amount borrowed
• Interest – Additional cost of the debt
• Technical debt
• Principal – Amount of time required to code solution “properly”
• Interest – Additional time needed to work around improper code
http://deviq.com/technical-debt/
![Page 8: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/8.jpg)
http://www.jimhighsmith.com/
![Page 9: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/9.jpg)
![Page 10: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/10.jpg)
A Well-Designed Application is
Simpleto
Maintain and Extend
![Page 11: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/11.jpg)
Technical Debtis a
Design Decision
(or series of decisions)
![Page 12: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/12.jpg)
Paying Down Technical DebtImproves
Application Design and Quality
![Page 13: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/13.jpg)
![Page 14: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/14.jpg)
Preventive Maintenance
• Refactoring
• Eliminate Duplication
• Simplify Design
• Automated Tests
• Verify correctness
• Avoid regressions
• Increase Confidence
![Page 15: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/15.jpg)
When should you refactor?
• While delivering value
![Page 16: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/16.jpg)
“
”
You don’t need permission to practice basic hygiene when you write software.
http://ardalis.com/when-should-you-refactor/
Make cleaning up your code something you do as part of writing code.
![Page 17: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/17.jpg)
![Page 18: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/18.jpg)
Refactoring Should Not Change System Behavior
![Page 19: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/19.jpg)
The Refactoring Process
• Verify existing behavior
• Write Characterization Tests if none exist
• Find test points
• Break dependencies
• Apply Refactoring
• Confirm existing behavior is preserved
Commit the working code!
Commit the working code!
![Page 20: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/20.jpg)
Characterization Tests
Process
1. Write a test you know will fail
2. Use the output of the failing test to determine the existing behavior to assert
3. Update the test with the new value/behavior
4. Run the test again – it should now pass
![Page 21: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/21.jpg)
![Page 22: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/22.jpg)
Brownfield / Legacy Development
![Page 23: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/23.jpg)
Maximize Code Changes Made to
New Classes
![Page 24: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/24.jpg)
Why new classes?
• Nothing depends on them (yet)
• You can write them to be testable
• Even in an otherwise hard-to-test application
![Page 25: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/25.jpg)
Add High-Value Tests to Legacy Apps
• Probably not written Test-First
• Trying to Unit Test Everything is likely cost-prohibitive
• Start by writing tests for bugs
• Verify the bug behavior with a test
• Make the test pass by fixing the bug
![Page 26: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/26.jpg)
S O L I DPrinciples
http://flickr.com/photos/kevinkemmerer/2772526725/
![Page 27: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/27.jpg)
Principles of OO Design
0. Don’t Repeat Yourself (DRY)
1. Single Responsibility
2. Open/Closed
3. Liskov Substitution
4. Interface Segregation
5. Dependency Inversion
Pluralsight Course:
http://bit.ly/SOLID-OOP
![Page 28: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/28.jpg)
![Page 29: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/29.jpg)
![Page 30: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/30.jpg)
Don’t RepeatRepeat Yourself
•Duplication in logic calls for abstraction
•Duplication in process calls for automation
![Page 31: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/31.jpg)
Common Refactorings
• Replace Magic Number/String
• Parameterize Method
• Pull Up Field
• Pull Up Method
• Replace Conditional With Polymorphism
• Introduce Method
![Page 32: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/32.jpg)
Common Source of Repetition: Role Checksif(user.IsInRole(“Admins”)
{
// allow access to resource
}
// favor privileges over role checks
// ardalis.com/Favor-Privileges-over-Role-Checks
var priv = new ContentPrivilege(user, article);
if(priv.CanEdit())
{
// allow access
}
![Page 33: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/33.jpg)
Visual Studio Code Clones
• Find similar blocks of code in your projects/solution
• Can detect matches that are similar but vary in small ways (like variable names)
• Available in VS2015 Premium and Ultimate
![Page 34: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/34.jpg)
![Page 35: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/35.jpg)
Single Responsibility Principle
The Single Responsibility Principle states that every object should have a single responsibility, and that responsibility should be entirely encapsulated by the class.
Wikipedia
There should never be more than one reason for a class to change.
Robert C. “Uncle Bob” Martin
![Page 36: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/36.jpg)
What is a responsibility?
“My CustomerManager class is only responsible for anything to do with a Customer. That follows SRP, right?”
![Page 37: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/37.jpg)
Examples of Responsibilities
• Persistence
• Validation
• Notification
• Error Handling
• Logging
• Class Selection / Construction
• Formatting
• Parsing
• Mapping
![Page 38: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/38.jpg)
Dependency and Coupling
• Excessive coupling makes changing legacy software difficult
• Breaking apart responsibilities and dependencies is a large part of working with existing code
![Page 39: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/39.jpg)
Common Refactorings
• Extract Class
• Extract Method
• Move Method
![Page 40: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/40.jpg)
Heuristics and Code Smells
• Visual Studio Metrics
![Page 41: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/41.jpg)
Cyclomatic Complexity
https://en.wikipedia.org/wiki/Cyclomatic_complexity
![Page 42: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/42.jpg)
Keep
Cyclomatic Complexity
under 10
for every method
![Page 43: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/43.jpg)
![Page 44: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/44.jpg)
Code Smell: Regions
More on Regions: http://ardalis.com/regional-differences
![Page 45: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/45.jpg)
![Page 46: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/46.jpg)
Open / Closed Principle
The Open / Closed Principle states that software entities (classes, modules, functions, etc.) should be open for extension, but closed for modification.
Wikipedia
![Page 47: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/47.jpg)
Open / Closed Principle
Open to Extension
New behavior can be added in the future
Closed to Modification
Changes to source or binary code are not required
Dr. Bertrand Meyer originated the OCP term in his 1988 book, Object Oriented Software Construction
![Page 48: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/48.jpg)
Common Refactorings
• Extract Interface / Apply Strategy Pattern
• Parameterize Method
• Form Template Method
![Page 49: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/49.jpg)
OCP Fail
![Page 50: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/50.jpg)
OCP OK
![Page 51: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/51.jpg)
OCP Fail
public bool IsSpecialCustomer(Customer c)
{
if(c.Country == “US” && c.Balance < 50) return false;
if(c.Country == “DE” && c.Balance < 25) return false;
if(c.Country == “UK” && c.Balance < 35) return false;
if(c.Country == “FR” && c.Balance < 27) return false;
if(c.Country == “BG” && c.Balance < 29) return false;
if(c.Age < 18 || c.Age > 65) return false;
if(c.Income < 50000 && c.Age < 30) return false;
return true;
}
![Page 52: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/52.jpg)
OCP OK
private IEnumerable<ICustomerRule> _rules;
public bool IsSpecialCustomer(Customer customer)
{
foreach(var rule in _rules)
{
if(rule.Evaluate(customer) == false) return false;
}
return true;
}
![Page 53: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/53.jpg)
![Page 54: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/54.jpg)
Liskov Substitution Principle
The Liskov Substitution Principle states that Subtypes must be substitutable for their base types.
Agile Principles, Patterns, and Practices in C#
Named for Barbara Liskov, who first described the principle in 1988.
![Page 55: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/55.jpg)
Common Refactorings
• Collapse Hierarchy
• Pull Up / Push Down Field
• Pull Up / Push Down Method
![Page 56: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/56.jpg)
Liskov Substitution Fail
foreach(var employee in employees)
{
if(employee is Manager)
{
Helpers.PrintManager(employee as Manager);
break;
}
Helpers.PrintEmployee(employee);
}
![Page 57: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/57.jpg)
Liskov Substitution OK
foreach(var employee in employees)
{
employee.Print();
// or
Helpers.PrintEmployee(employee);
}
![Page 58: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/58.jpg)
Nulls Break Polymorphism
foreach(var employee in employees)
{
if(employee == null)
{
// print not found message
break;
}
Helpers.PrintEmployee(employee);
} http://ardalis.com/nulls-break-polymorphism
![Page 59: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/59.jpg)
![Page 60: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/60.jpg)
Interface Segregation Principle
The Interface Segregation Principle states that Clients should not be forced to depend on methods they do not use.
Agile Principles, Patterns, and Practices in C#
Corollary:
Prefer small, cohesive interfaces to “fat” interfaces
![Page 61: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/61.jpg)
Common Refactorings
• Extract Interface
![Page 62: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/62.jpg)
Keep Interfaces Small and Focused
![Page 63: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/63.jpg)
Membership Provider
![Page 64: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/64.jpg)
ISP Fail (sometimes)
public IRepository<T>
{
T GetById(int id);
IEnumerable<T> List();
void Create(T item);
void Update(T item);
void Delete(T item);
}
![Page 65: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/65.jpg)
ISP OK (i.e. to support CQRS)
public IRepository<T> : IReadRepository<T>,
IWriteRepository<T>
{ }
public IReadRepository<T>
{
T GetById(int id);
IEnumerable<T> List();
}
public IWriteRepository<T>
void Create(T item);
void Update(T item);
void Delete(T item);
}
Existing implementations of IRepository<T> are unaffected by pulling out smaller interfaces!No existing code breaks!
![Page 66: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/66.jpg)
![Page 67: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/67.jpg)
Dependency Inversion Principle
High-level modules should not depend on low-level modules. Both should depend on abstractions.
Abstractions should not depend on details. Details should depend on abstractions.
Agile Principles, Patterns, and Practices in C#
![Page 68: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/68.jpg)
Dependency Inversion Principle
• Depend on Abstractions
• Interfaces, not concrete types
• Inject Dependencies into Classes
• Structure Solution so Dependencies Flow Toward Core
• Onion Architecture (a.k.a. Ports and Adapters, a.k.a. Hexagonal Architecture)
![Page 69: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/69.jpg)
DIP Architecture (aka Ports and Adapters)
![Page 70: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/70.jpg)
Common Dependencies
• Framework
• Third Party Libraries
• Database
• File System
• Web Services
• System Resources (Clock)
• Configuration
• The new Keyword
• Static methods
• Thread.Sleep
• Random
See also responsibilities:• Persistence• Validation• Notification• Error Handling• Logging• Class Selection /
Construction• Formatting• Parsing• Mapping
![Page 71: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/71.jpg)
Common Refactorings
• Extract Class
• Extract Interface / Apply Strategy Pattern
• Extract Method
• Introduce Service Locator / Container
![Page 72: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/72.jpg)
DIP Fail
![Page 73: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/73.jpg)
Hidden Dependencies
• Checkout Depends on an available SMTP server, but the class doesn’t reflect this
• Follow the Explicit Dependencies Principle
• http://deviq.com/explicit-dependencies-principle/
![Page 74: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/74.jpg)
Some Improvement (Façade)
![Page 75: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/75.jpg)
DIP OK (Strategy Pattern / DI)
![Page 76: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/76.jpg)
DIP OK (Strategy Pattern / DI)
![Page 77: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/77.jpg)
Improving Quality Across the Industry
![Page 78: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/78.jpg)
![Page 79: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/79.jpg)
Self-Improvement and Quality
• How fast can you produce:
• Code you believe to be of high quality
• Code that maybe gets the job done, but you believe to be of low quality
• Which one can you produce more quickly?
• Why?
• How can we develop our skills and our tools so that building quality is natural and easier than not doing so?
![Page 80: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/80.jpg)
0
2
4
6
8
10
12
14
16
Week 1 Week 2 Week 3 Week 4 Week 5 Week 6 Week 7 Week 8 Week 9
User Stories Completed
High Quality Low Quality
![Page 81: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/81.jpg)
0
2
4
6
8
10
12
14
16
18
20
Week 1 Week 2 Week 3 Week 4 Week 5 Week 6 Week 7 Week 8 Week 9
User Stories Completed
High Quality Low Quality
![Page 82: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/82.jpg)
Summary
•Maintain / Improve Application Code
•Follow DRY/SOLID Principles
•Use Characterization Tests to “fix” behavior
•Apply Common Refactorings
•Re-run Tests After (and during) Refactorings
•Be Explicit About Class Dependencies
•Train and Practice to Write Better Code Faster
![Page 83: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/83.jpg)
Learn More
• DevIQ.com
• Ardalis.com
• WeeklyDevTips.com
• Twitter: @ardalis
• Pluralsight:
• SOLID Principles of OO Design http://bit.ly/SOLID-OOP
• N-Tier Architecture in C# http://bit.ly/PS-NTier1
• Refactoring Fundamentals http://bit.ly/PS-Refactoring
• Domain-Driven Design Fundamentals http://bit.ly/ddd-fundamentals
• Design Pattern Library http://bit.ly/PS-design-patterns
• Pair Programming http://bit.ly/PS-PairProgramming
![Page 84: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/84.jpg)
• New Coworking Space in Hudson, Ohio
• Private offices / Flex desk spaces
• Fiber internet
• Complimentary coffee / tea / water
• Great development community
• @techhubhudson
• Website online soon
Tech Hub Hudson
![Page 85: Improving the Design of Existing Software](https://reader031.vdocuments.us/reader031/viewer/2022021923/5a66e9fd7f8b9a91298b4967/html5/thumbnails/85.jpg)
Books
Refactoring http://amzn.to/110tscA
Refactoring to Patterns http://amzn.to/Vq5Rj2
Working Effectively with Legacy Code http://amzn.to/VFFYbn
Code Complete http://amzn.to/Vq5YLv
Clean Code http://amzn.to/YjUDI0