Bad code doesn't exist, but code quality is a real and hard issue to address. Presentation given at Wicked Good Ruby Boston 2012
Matt AimonettiBoston 2013W I C K E DBAD RUBY
View Slide
@mattettihttp://matt.aimonetti.netMattAimonetti
@mattettihttp://matt.aimonetti.netMattAimonettiSteveMartocci
of Rubyprogramming“17,520 hours”
Avdi Grimm“the messiest, nastiestbig-ball-of-mud codeI have seen in my entirecareerhas been in Rails projects.”
Matt Van Horn“I once saw a Rails controllerover 3KLOC long with 500line create and updatemethods that were 85% cut &pasted from each other.”
there isn’t suchthing as bad code
println "Hello World"
name“Code is neither good or evil,but only a place for good andevil”Caesar Marcus “coder” Aurelius
good / bien (fr) / bueno (es)“having desirable quality”
bad / mauvais (fr) / malo (es)“undesirable”
Not scientific terms• Religion• Ethics• Philosophy
Spice Girls“So tell me what you want,what you really, really want”
1. define expected outcome
2. evaluate solutions
3. implement
4. re-evaluate
Me“you aren’t paid to write‘good’ code, you’re paid todeliver great products”
don’twrite code
materializeideas
understandwhat you arebuildingbusiness objectivestimelineproposition valueplayersrisk factors...
emo code
delivered the expectedoutcome
but then...
hard to understand
hard to maintain
hard to scale
slow
Every otherHacker Newscomment“You’re doing it wrong”
Sandi Metz“Classes can be no longerthan one hundred lines ofcode”
Sandi Metz“Methods can be no longerthan five lines of code”
SomeStackOverflowRubyist“You can’t write good codeunless you use TDD”
• fast iterations• level of confidence• robustness• syntax beauty• abstraction level• simplicity• known patterns• performance• limited dependencies• test first• learning curve
Amy Hoy“If you try to dictate to otherpeople what their valuesshould be, you’re an asshole”
communicate!
focus on the outcome whilelearning & improving
@mattetti
@mattetti@sandimetz@kytrinyx