clean code days 2016 · why you can't establish clean code on your own the lone stranger...
TRANSCRIPT
![Page 1: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/1.jpg)
Clean CodeDays 2016
28.06.2016
http://slides.com/carstenwindler/the-lone-stranger
![Page 2: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/2.jpg)
Why you can't establishClean Code on your own
The Lone Stranger
Carsten Windler, HolidayPirates GmbH
![Page 3: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/3.jpg)
if ( is_array($fields ) ) { if ( isset($fields['blog_id']) ) { $blog_id = $fields['blog_id']; } elseif ( isset($fields['domain']) && isset($fields['path']) ) { $key = md5( $fields['domain'] . $fields['path'] ); $blog = wp_cache_get($key, 'blog-lookup'); if ( false !== $blog ) return $blog; if ( substr( $fields['domain'], 0, 4 ) == 'www.' ) { $nowww = substr( $fields['domain'], 4 ); $blog = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->blogs WHERE domain IN (%s,%s) AND path = %s ORDER BY CHAR_LENGTH(domain) DESC" } else { $blog = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->blogs WHERE domain = %s AND path = %s", $fields['domain'], $fields['path'] ) ); } if ( $blog ) { wp_cache_set($blog->blog_id . 'short', $blog, 'blog-details'); $blog_id = $blog->blog_id; } else { return false; } } elseif ( isset($fields['domain']) && is_subdomain_install() ) { $key = md5( $fields['domain'] ); $blog = wp_cache_get($key, 'blog-lookup'); if ( false !== $blog ) return $blog; if ( substr( $fields['domain'], 0, 4 ) == 'www.' ) { $nowww = substr( $fields['domain'], 4 ); $blog = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->blogs WHERE domain IN (%s,%s) ORDER BY CHAR_LENGTH(domain) DESC", $nowww, $fields[ } else { $blog = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->blogs WHERE domain = %s", $fields['domain'] ) ); } if ( $blog ) { wp_cache_set($blog->blog_id . 'short', $blog, 'blog-details'); $blog_id = $blog->blog_id; } else { return false; } } else { return false; }} else { if ( ! $fields ) $blog_id = get_current_blog_id(); elseif ( ! is_numeric( $fields ) ) $blog_id = get_id_from_blogname( $fields ); else $blog_id = $fields;}
$blog_id = (int) $blog_id;
$all = $get_all == true ? '' : 'short';$details = wp_cache_get( $blog_id . $all, 'blog-details' );
if ( $details ) { if ( ! is_object( $details ) ) { if ( $details == -1 ) { return false; } else { // Clear old pre-serialized objects. Cache clients do better with that.
![Page 4: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/4.jpg)
unprofessionalwill make you unhappy
a.k.a. Sisyphos™other developers will keep the coderottingwill introduce new bugsleads to trouble with other developers
![Page 5: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/5.jpg)
So the answer isnot really surprisingly
![Page 6: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/6.jpg)
Clean Code!... but how?
![Page 7: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/7.jpg)
So youdecided tointroduceClean Codeto your
projectSorry...
![Page 8: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/8.jpg)
Introducing Clean Code toan existing project
takes timeis painfulis cumbersome
...is totally worth it
![Page 9: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/9.jpg)
Management
Customer
Co-Worker
Otherdepartments
People you might need to convince:
![Page 10: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/10.jpg)
#1 - The Arguments
![Page 11: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/11.jpg)
The Management
![Page 12: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/12.jpg)
Now you have to explain why you wantto spent more time on doing the same
stuff as before.
The Business likes charts.Let's give them some charts.
![Page 13: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/13.jpg)
Project without Clean Code*
LifeTechnology changeRequirements changePersonnel change
*simplification; not necessarily related to any real project
![Page 14: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/14.jpg)
Technology changeFramework updateLanguage updateInfrastructure change because of technical need
Requirements changeNew top prio feature requires many changes
Personnel changeTruck factor hits you
![Page 15: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/15.jpg)
Truck Factor explained
your former lead dev(yes, under the truck)
![Page 16: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/16.jpg)
Project as a rollercoaster
![Page 17: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/17.jpg)
Project with Clean Code
![Page 18: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/18.jpg)
Sloppiness Short TermBoost (SSTB)
Clean Code LongTerm Benefit
(CCLTB)
Projects compared
![Page 19: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/19.jpg)
Time considerations
t 0 t1 t2
StartupPhase
ConsolidationPhase
Credit Interest
![Page 20: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/20.jpg)
f(x ) dx < f(x ) dx∫t0
t1s ∫
t0
t1c
fewer backlog items are left when doing sloppyprogramming instead of clean code in the
startup phase
t 0 t 1
f(x )s
f(x )c
![Page 21: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/21.jpg)
f(x ) dx > f(x ) dx∫t0
t2s ∫
t0
t2c
more backlog items left when doing sloppyprogramming instead of Clean Code over
project lifetime
t 0 t 2
f(x )c
f(x )s
![Page 22: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/22.jpg)
Sometimes it's a Businessdecision to make debts
StartupMan
![Page 23: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/23.jpg)
Sometimes it's ignorance
![Page 24: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/24.jpg)
???
Wait, wait, wait... it's for theManagement, so keep it simple!
f(x ) dx > f(x ) dx∫t0
t2s ∫
t0
t2c
![Page 25: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/25.jpg)
Quality is an investment
Developer scalability
Lower per-bug-costs
Customer satisfaction
Why Clean Code matters
![Page 26: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/26.jpg)
Quality as an investmentdon't think short term future changes on platform orrequirements will be easieravoid piling up technical debt
![Page 27: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/27.jpg)
Developer scalabilitynew developers can be added to aproject easiergathered experience and techniquescan be transferred to other projects
![Page 28: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/28.jpg)
Lower per-bug-costscatching a bug on developmentstage is much cheaper than onLivepreventing regressions with liveoutage
![Page 29: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/29.jpg)
Customer SatisfactionCustomer experiences morestable productbetter reputation
![Page 30: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/30.jpg)
The Customer...ouch...Leave it up to the Management, if you can!
![Page 31: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/31.jpg)
Now you have to explain why you wantthem to spent more money on getting
the same results as before.
![Page 32: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/32.jpg)
Quality is an investment
End-Customer satisfaction
Develop agile
Why Clean Code matters foryour customer
![Page 33: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/33.jpg)
Quality is an investmentdon't think short termfuture changes on platform orrequirements will be easierCustomer is lesser depending on yourcompany*
*you probably don't want to tell that though
![Page 34: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/34.jpg)
End-Customer satisfactionmore stable producthappier customersbetter reputationlesser outages
![Page 35: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/35.jpg)
Develop agileIntroduce and evaluate newfeatures faster
![Page 36: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/36.jpg)
Co-Workers
![Page 37: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/37.jpg)
Now you have to explain whyyou want them to spent moretime on doing the same stuff
than beforeYes, once again!
![Page 38: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/38.jpg)
Happy refactoring
Saves development timeEgo
Lesser stress during deploys
Developer scalability
![Page 39: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/39.jpg)
Happy refactoringtests give you a much moreconfidence when refactoringthus it will encourage to refactor ifneeded
![Page 40: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/40.jpg)
Saves timeautomated tests can save a lot of timeyou don't need to click through half ofthe application to test a single smallfeaturebugs are usually easier to solve whenyou just worked on a topic than weeksafter
![Page 41: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/41.jpg)
Egobugs discovered by others are often abit embarassingoverall project / developer reputationincreases
![Page 42: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/42.jpg)
Lesser stressduring deploys
deploy with confidence
![Page 43: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/43.jpg)
Developer scalabilityeasier to integrate new colleagues
![Page 44: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/44.jpg)
Turn developers from this...
![Page 45: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/45.jpg)
... into this
![Page 46: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/46.jpg)
How to get developers on your sidelive what you meanprovide good examples on the projectinhouse workshopsfind alliesprovide THE TOOLS
![Page 47: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/47.jpg)
#2 The Tools
![Page 48: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/48.jpg)
Code StyleGuides
Improve readabilityA matter ofprofessionalismVery easy to introduce
![Page 49: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/49.jpg)
Code StyleGuides
best use existing codestandardssniffers help you check andreformat automaticallyrun e.g. on pre-commit onchanged files only
![Page 50: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/50.jpg)
Software Metrics
![Page 51: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/51.jpg)
What can you do with these numbers?
![Page 52: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/52.jpg)
Hey Bob, how is yourproject going?
Awesome! During last the Refactoring Sprint we managed to dropthe overall cyclomatic complexity by ~5 points (which is great).However we still have a maintenability index of 64.32 on the
Middleware which we will change ASAP.
Nice
![Page 53: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/53.jpg)
![Page 54: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/54.jpg)
![Page 55: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/55.jpg)
Your project on a T-Shirt
![Page 56: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/56.jpg)
![Page 57: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/57.jpg)
REFACTORING TIME!!
![Page 58: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/58.jpg)
Why is my code so bad?
![Page 59: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/59.jpg)
Software
Metricseasy to introducewill show you how good /how bad your codebaseactually ismake developers awareof software qualityhelps identifying problemareas
Source CodeAnalyzer
easy to introducewill give you direct hintswhere in your code thingsgo wrongCopy & Paste detectorswill not allow lazynessprevents bad code fromgetting added to thecodebase
![Page 60: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/60.jpg)
Putting the finger where it hurts
![Page 61: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/61.jpg)
However no tool will makeyou a better programmer
![Page 62: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/62.jpg)
Never stop learning!
![Page 63: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/63.jpg)
Code Reviewsfairly easy it introduce*actually a must have
can prevent really nasty bugsgreat for sharing knowledge
be careful - don't be arrogantsome devs prefer eye-to-eye reviews,others are ok with comments in theMerge Request
*assuming you use Version Control Systems
![Page 64: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/64.jpg)
Tests
![Page 65: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/65.jpg)
KISSKeep It teSted, Stupid!
Tests are not optional, they are mandatory.
Period.
We mean it.
Seriously.
![Page 66: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/66.jpg)
Write / RefactorAutomated Tests
Ideal world
![Page 67: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/67.jpg)
But what if wehave no Unit Tests
yet??
![Page 68: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/68.jpg)
Write / RefactorBugs
Harsh reality
![Page 69: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/69.jpg)
Writing Tests for untested classesusually requires refactoring
refactoring without tests == risky!chicken-egg-problemconcentrate on Unit Tests for new classesfor legacy code, try to find simple classes to start with
![Page 70: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/70.jpg)
ManualTests
E2E
Unit Tests
The Almighty Test Pyramid
E2Enot (yet) available
not an option
![Page 71: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/71.jpg)
- slow- a bit fragile
- require test mode
E2E Tests
your way to go before you start with refactoring
+ require no refactoring+ require no deep code knowledge
+ can be done in a sane amount of time
![Page 72: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/72.jpg)
Workflowstools are nothing without controlsetup clearly documented workflowsbe stubborn, otherwise sloppiness willcome backjust like animals, some developers willSMELL any fear or weaknessso it's a good idea to automize
![Page 73: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/73.jpg)
Continuous IntegrationFail build immediately
Code SnifferSource Code AnalyzerUnit TestsAcceptance Tests
ReportsSoftware MetricsTest coverage
![Page 74: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/74.jpg)
Whatisleft?
![Page 75: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/75.jpg)
Clean Code is NOT aboutbeing the best coder in the
world.(although you have to be pretty good)
![Page 76: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/76.jpg)
Clean Code is aboutprofessionalism.
![Page 77: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/77.jpg)
Clean Code is aboutknowing that sloppy code
will cost a lot of money.
![Page 78: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/78.jpg)
And:
Clean Code is about beingproud of your code!
![Page 79: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/79.jpg)
And your job.
![Page 80: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/80.jpg)
It's probably the best job inthe world.
![Page 81: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/81.jpg)
Thank you.
![Page 82: Clean Code Days 2016 · Why you can't establish Clean Code on your own The Lone Stranger Carsten Windler, HolidayPirates GmbH](https://reader035.vdocuments.us/reader035/viewer/2022071020/5fd47b940ae6416c131786fc/html5/thumbnails/82.jpg)
Image creditsOffice work businesshttps://stocksnap.io/photo/HZCASACP3N Top view of phone, earphones pen and diaryhttps://www.pexels.com/photo/top-view-of-phone-earphones-pen-and-diary-6662/
Guy working manhttps://stocksnap.io/photo/GDAGX2JKI4
Red fire truckhttps://stocksnap.io/photo/I2W591P4EV Man wearing black and red checkered long sleeve...https://www.pexels.com/photo/man-wearing-black-and-red-checkered-long-sleeve-shirt-wearing-black-wayfarer-sunglasses-sitting-on-white-wooden-chair-69212/ Man in white shirt using Macbookhttps://www.pexels.com/photo/man-in-white-shirt-using-macbook-pro-52608/
Bow tie fashion man personhttps://www.pexels.com/photo/bow-tie-fashion-man-person-5198/ All above images are licensed under CC0. Thank you very much for making this great work available freely!