View
1.153
Download
0
Category
Tags:
Preview:
DESCRIPTION
Presentation at Lean Tribe Gathering 12 in Växjö, 10 dec 2012.
Citation preview
How To Clean Your Dirty CodeAnd Why It Matters
Jonatan Jönsson
2012-12-10
jonatan.jonsson@softhouse.se
Who am I?
Reusable Designs
Reusable Modules
Dirty Versus Clean Code
What does it display?
Red/Green
0
1
Red/Blue Green/Red
Dirty Versus Clean Code
What does it display?
Red/Green
0
1
Red/Blue Green/Red
Naming Is Important
Is This You?
Which Square Fits Your Product?
Total Rewrite Cycle
Iterative Refactoring
See Every Part of Your Code As an API
• Easy to use right, hard (preferably impossible) to misuse
• Easy to evolve
• The cleanliness of your tests reflects the quality of your API
• Be as small as possible, ”when in doubt leave it out”, Joshua Bloch
Readable Test?
Builder Pattern To the Rescue
Fail Fast - Preferably at Compile-time
Bad: doSomeActionThatRequiresAuthenticatedUser(User authenticatedUser)
Good: doSomeAction(AuthenticatedUser user)
Don’t Make the Client Do Anything the Module Could Do
Using the Right Data TypeUsing a list Using a set
Packaging By-Layer vs By-Feature
By Layer By Feature
The Ultimate Benchmark of Modularization
What Tools Are You Using?
What Tools Are You Using?
Eclipse Refactoring Support
Peer Review - Pair Programming
(c)lean tribe
jonatan.jonsson@softhouse.se
Recommended Reading
Referenceshttp://www.osnews.com/story/19266/WTFs_m - WTFs per minute cartoon
http://jester.sourceforge.net/ - Test coverage tool
http://en.wikipedia.org/wiki/Mutation_testing
How To Design A Good API and Why it Matters - Joshua Bloch
Recommended