lets talk about good code (dallas techfest 2014)
DESCRIPTION
Many programmers are dedicated, or even obsessed, with writing “good” code. Often we follow certain patterns and practices because we believe they are the best solution for the problem, or because the “experts” tell us to. In this session, we will discuss what good code really is and what benefits it brings.Presented by Josh Rizzo and Jane Prusakova, Improving BCS.TRANSCRIPT
![Page 1: Lets talk About Good Code (Dallas TechFest 2014)](https://reader038.vdocuments.net/reader038/viewer/2022102518/5485823bb4af9fbf218b47fb/html5/thumbnails/1.jpg)
©2010 Improving Enterprises, Inc.
Good CodeWhat, Why, and How to Get There
Dallas TechFest 2014Jane Prusakova
Josh Rizzo@Improving Enterprises College Station
![Page 2: Lets talk About Good Code (Dallas TechFest 2014)](https://reader038.vdocuments.net/reader038/viewer/2022102518/5485823bb4af9fbf218b47fb/html5/thumbnails/2.jpg)
©2010 Improving Enterprises, Inc.
What is “good”?
FunctionalBug-freePerformantGood designTestedTestableEasy to change
READABLE
![Page 3: Lets talk About Good Code (Dallas TechFest 2014)](https://reader038.vdocuments.net/reader038/viewer/2022102518/5485823bb4af9fbf218b47fb/html5/thumbnails/3.jpg)
©2010 Improving Enterprises, Inc.
Usability
Users and clients Developers
![Page 4: Lets talk About Good Code (Dallas TechFest 2014)](https://reader038.vdocuments.net/reader038/viewer/2022102518/5485823bb4af9fbf218b47fb/html5/thumbnails/4.jpg)
©2010 Improving Enterprises, Inc.
![Page 5: Lets talk About Good Code (Dallas TechFest 2014)](https://reader038.vdocuments.net/reader038/viewer/2022102518/5485823bb4af9fbf218b47fb/html5/thumbnails/5.jpg)
©2010 Improving Enterprises, Inc.
“Programs must be written for people to read, and only incidentally for machines to execute.”
– Abelson and Sussman
![Page 6: Lets talk About Good Code (Dallas TechFest 2014)](https://reader038.vdocuments.net/reader038/viewer/2022102518/5485823bb4af9fbf218b47fb/html5/thumbnails/6.jpg)
©2010 Improving Enterprises, Inc.
Readability has valueNOW
Code is an asset
affects productivity
monetary value
![Page 7: Lets talk About Good Code (Dallas TechFest 2014)](https://reader038.vdocuments.net/reader038/viewer/2022102518/5485823bb4af9fbf218b47fb/html5/thumbnails/7.jpg)
Readability has value OVER TIME
Software evolves over time
Work by many different teams
Changes affect value
![Page 8: Lets talk About Good Code (Dallas TechFest 2014)](https://reader038.vdocuments.net/reader038/viewer/2022102518/5485823bb4af9fbf218b47fb/html5/thumbnails/8.jpg)
©2010 Improving Enterprises, Inc.
Readability has cost
More hard work
More time
More training
![Page 9: Lets talk About Good Code (Dallas TechFest 2014)](https://reader038.vdocuments.net/reader038/viewer/2022102518/5485823bb4af9fbf218b47fb/html5/thumbnails/9.jpg)
©2010 Improving Enterprises, Inc.
Readable code
Easy to readHas a narrative
UnambiguousWYSIWYG
Follows convention
![Page 10: Lets talk About Good Code (Dallas TechFest 2014)](https://reader038.vdocuments.net/reader038/viewer/2022102518/5485823bb4af9fbf218b47fb/html5/thumbnails/10.jpg)
©2010 Improving Enterprises, Inc.
Who is responsible?
It was hard to write It should be hard to read
![Page 11: Lets talk About Good Code (Dallas TechFest 2014)](https://reader038.vdocuments.net/reader038/viewer/2022102518/5485823bb4af9fbf218b47fb/html5/thumbnails/11.jpg)
©2010 Improving Enterprises, Inc.
Lets make code more…
READABLESee: https://github.com/joshrizzo/Readability
![Page 12: Lets talk About Good Code (Dallas TechFest 2014)](https://reader038.vdocuments.net/reader038/viewer/2022102518/5485823bb4af9fbf218b47fb/html5/thumbnails/12.jpg)
©2010 Improving Enterprises, Inc.
Visible codeShort and concise
Spacing and indent matter
“If we wish to count lines of code, we should not regard them as ‘lines produced’ but as ‘lines spent.’”
– Edsger Dijkstra
![Page 13: Lets talk About Good Code (Dallas TechFest 2014)](https://reader038.vdocuments.net/reader038/viewer/2022102518/5485823bb4af9fbf218b47fb/html5/thumbnails/13.jpg)
©2010 Improving Enterprises, Inc.
Code with a narrativeUse naming to show intent
Interface design
“Programming can be fun, so can cryptography; however they should not be combined.”
– Kreitzberg and Shneiderman
![Page 14: Lets talk About Good Code (Dallas TechFest 2014)](https://reader038.vdocuments.net/reader038/viewer/2022102518/5485823bb4af9fbf218b47fb/html5/thumbnails/14.jpg)
©2010 Improving Enterprises, Inc.
Easy to read
Cohesive level of abstraction
“The purpose of abstraction is not to be vague, but to create a new semantic level in which one can be absolutely precise.”
– Edsger Dijkstra
![Page 15: Lets talk About Good Code (Dallas TechFest 2014)](https://reader038.vdocuments.net/reader038/viewer/2022102518/5485823bb4af9fbf218b47fb/html5/thumbnails/15.jpg)
©2010 Improving Enterprises, Inc.
Readable++Simplicity
![Page 16: Lets talk About Good Code (Dallas TechFest 2014)](https://reader038.vdocuments.net/reader038/viewer/2022102518/5485823bb4af9fbf218b47fb/html5/thumbnails/16.jpg)
©2010 Improving Enterprises, Inc.
“Everything should be made as simple as possible, but not simpler.”
– Albert Einstein
![Page 17: Lets talk About Good Code (Dallas TechFest 2014)](https://reader038.vdocuments.net/reader038/viewer/2022102518/5485823bb4af9fbf218b47fb/html5/thumbnails/17.jpg)
©2010 Improving Enterprises, Inc.
Simple vs Fast
Correctness more important than speedSimple code is more likely to be and stay correct
Modularize code w/ performance concernsOptimize locally
![Page 18: Lets talk About Good Code (Dallas TechFest 2014)](https://reader038.vdocuments.net/reader038/viewer/2022102518/5485823bb4af9fbf218b47fb/html5/thumbnails/18.jpg)
©2010 Improving Enterprises, Inc.
![Page 19: Lets talk About Good Code (Dallas TechFest 2014)](https://reader038.vdocuments.net/reader038/viewer/2022102518/5485823bb4af9fbf218b47fb/html5/thumbnails/19.jpg)
©2010 Improving Enterprises, Inc.
Simple vs FlexibleRe-use is rare
Predictions of re-use are poor
Raises complexity significantly
Unused => not working
![Page 20: Lets talk About Good Code (Dallas TechFest 2014)](https://reader038.vdocuments.net/reader038/viewer/2022102518/5485823bb4af9fbf218b47fb/html5/thumbnails/20.jpg)
©2010 Improving Enterprises, Inc.
Simple vs Clever
Over engineering
Mixing abstractions
Inappropriate patterns
Complicated syntax
![Page 21: Lets talk About Good Code (Dallas TechFest 2014)](https://reader038.vdocuments.net/reader038/viewer/2022102518/5485823bb4af9fbf218b47fb/html5/thumbnails/21.jpg)
©2010 Improving Enterprises, Inc.
Good CodeWhat, Why, and How to Get There
https://github.com/joshrizzo/Readability
Dallas TechFest 2014Jane Prusakova
Josh Rizzo@Improving Enterprises College Station