How to clean your dirty code | Jonatan Jönsson | LTG-12
-
Upload
lean-tribe -
Category
Business
-
view
1.153 -
download
0
description
Transcript of How to clean your dirty code | Jonatan Jönsson | LTG-12
![Page 2: How to clean your dirty code | Jonatan Jönsson | LTG-12](https://reader036.fdocuments.us/reader036/viewer/2022062307/5549253eb4c905a54c8ba400/html5/thumbnails/2.jpg)
Who am I?
![Page 3: How to clean your dirty code | Jonatan Jönsson | LTG-12](https://reader036.fdocuments.us/reader036/viewer/2022062307/5549253eb4c905a54c8ba400/html5/thumbnails/3.jpg)
Reusable Designs
![Page 4: How to clean your dirty code | Jonatan Jönsson | LTG-12](https://reader036.fdocuments.us/reader036/viewer/2022062307/5549253eb4c905a54c8ba400/html5/thumbnails/4.jpg)
Reusable Modules
![Page 5: How to clean your dirty code | Jonatan Jönsson | LTG-12](https://reader036.fdocuments.us/reader036/viewer/2022062307/5549253eb4c905a54c8ba400/html5/thumbnails/5.jpg)
Dirty Versus Clean Code
What does it display?
Red/Green
0
1
Red/Blue Green/Red
![Page 6: How to clean your dirty code | Jonatan Jönsson | LTG-12](https://reader036.fdocuments.us/reader036/viewer/2022062307/5549253eb4c905a54c8ba400/html5/thumbnails/6.jpg)
Dirty Versus Clean Code
What does it display?
Red/Green
0
1
Red/Blue Green/Red
![Page 7: How to clean your dirty code | Jonatan Jönsson | LTG-12](https://reader036.fdocuments.us/reader036/viewer/2022062307/5549253eb4c905a54c8ba400/html5/thumbnails/7.jpg)
Naming Is Important
![Page 8: How to clean your dirty code | Jonatan Jönsson | LTG-12](https://reader036.fdocuments.us/reader036/viewer/2022062307/5549253eb4c905a54c8ba400/html5/thumbnails/8.jpg)
Is This You?
![Page 9: How to clean your dirty code | Jonatan Jönsson | LTG-12](https://reader036.fdocuments.us/reader036/viewer/2022062307/5549253eb4c905a54c8ba400/html5/thumbnails/9.jpg)
Which Square Fits Your Product?
![Page 10: How to clean your dirty code | Jonatan Jönsson | LTG-12](https://reader036.fdocuments.us/reader036/viewer/2022062307/5549253eb4c905a54c8ba400/html5/thumbnails/10.jpg)
Total Rewrite Cycle
![Page 11: How to clean your dirty code | Jonatan Jönsson | LTG-12](https://reader036.fdocuments.us/reader036/viewer/2022062307/5549253eb4c905a54c8ba400/html5/thumbnails/11.jpg)
Iterative Refactoring
![Page 14: How to clean your dirty code | Jonatan Jönsson | LTG-12](https://reader036.fdocuments.us/reader036/viewer/2022062307/5549253eb4c905a54c8ba400/html5/thumbnails/14.jpg)
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
![Page 15: How to clean your dirty code | Jonatan Jönsson | LTG-12](https://reader036.fdocuments.us/reader036/viewer/2022062307/5549253eb4c905a54c8ba400/html5/thumbnails/15.jpg)
Readable Test?
![Page 16: How to clean your dirty code | Jonatan Jönsson | LTG-12](https://reader036.fdocuments.us/reader036/viewer/2022062307/5549253eb4c905a54c8ba400/html5/thumbnails/16.jpg)
Builder Pattern To the Rescue
![Page 17: How to clean your dirty code | Jonatan Jönsson | LTG-12](https://reader036.fdocuments.us/reader036/viewer/2022062307/5549253eb4c905a54c8ba400/html5/thumbnails/17.jpg)
Fail Fast - Preferably at Compile-time
Bad: doSomeActionThatRequiresAuthenticatedUser(User authenticatedUser)
Good: doSomeAction(AuthenticatedUser user)
![Page 18: How to clean your dirty code | Jonatan Jönsson | LTG-12](https://reader036.fdocuments.us/reader036/viewer/2022062307/5549253eb4c905a54c8ba400/html5/thumbnails/18.jpg)
Don’t Make the Client Do Anything the Module Could Do
![Page 19: How to clean your dirty code | Jonatan Jönsson | LTG-12](https://reader036.fdocuments.us/reader036/viewer/2022062307/5549253eb4c905a54c8ba400/html5/thumbnails/19.jpg)
Using the Right Data TypeUsing a list Using a set
![Page 21: How to clean your dirty code | Jonatan Jönsson | LTG-12](https://reader036.fdocuments.us/reader036/viewer/2022062307/5549253eb4c905a54c8ba400/html5/thumbnails/21.jpg)
Packaging By-Layer vs By-Feature
By Layer By Feature
![Page 22: How to clean your dirty code | Jonatan Jönsson | LTG-12](https://reader036.fdocuments.us/reader036/viewer/2022062307/5549253eb4c905a54c8ba400/html5/thumbnails/22.jpg)
The Ultimate Benchmark of Modularization
![Page 23: How to clean your dirty code | Jonatan Jönsson | LTG-12](https://reader036.fdocuments.us/reader036/viewer/2022062307/5549253eb4c905a54c8ba400/html5/thumbnails/23.jpg)
What Tools Are You Using?
![Page 24: How to clean your dirty code | Jonatan Jönsson | LTG-12](https://reader036.fdocuments.us/reader036/viewer/2022062307/5549253eb4c905a54c8ba400/html5/thumbnails/24.jpg)
What Tools Are You Using?
Eclipse Refactoring Support
![Page 25: How to clean your dirty code | Jonatan Jönsson | LTG-12](https://reader036.fdocuments.us/reader036/viewer/2022062307/5549253eb4c905a54c8ba400/html5/thumbnails/25.jpg)
Peer Review - Pair Programming
![Page 28: How to clean your dirty code | Jonatan Jönsson | LTG-12](https://reader036.fdocuments.us/reader036/viewer/2022062307/5549253eb4c905a54c8ba400/html5/thumbnails/28.jpg)
Recommended Reading
![Page 29: How to clean your dirty code | Jonatan Jönsson | LTG-12](https://reader036.fdocuments.us/reader036/viewer/2022062307/5549253eb4c905a54c8ba400/html5/thumbnails/29.jpg)
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