hurting code for fun profit hurting code · 2020. 5. 16. · rubyconf 2007, charlotte nc hurting...

127
RubyConf 2007, Charlotte NC Ryan Davis, Seattle.rb Hurting Code for Fun & Profit Hurting Code for Fun and Profit 1 Friday, November 2, 2007

Upload: others

Post on 10-Feb-2021

4 views

Category:

Documents


0 download

TRANSCRIPT

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    Hurting Codefor Fun

    and Profit1Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    Setting Expectations

    • FIX: 117 slides in 45 minutes.• This is going to be fast.• Hopefully fast enough to have time at the end.

    • This is a departure from my usual type of talk.• It is more about improving yourself than it is

    about improving code.

    2Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    A Story

    3Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    4Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    Legacy Code

    • Any code you haven't written personally is legacy code.

    • Every company already has tons of legacy code.

    • Even startups.

    5Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    6Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    7Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    8Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    9Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    10Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    11Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    Or:12Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    New Place, Inc.

    13Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    14Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    15Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    16Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    @#$%!!!

    17Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    CRAC

    K!

    18Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    BLAM

    !

    19Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    SNICK!CR

    ACK!

    BAM!!!

    20Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    YAY!

    21Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    Moral of this story?

    22Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    People willpress charges

    if you hurt them23Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    Code won’t.

    24Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    This talk is a“coming out”event for me

    25Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    My name is Ryan, and…

    26Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    …I like to hurt code…

    27Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    …and I'm OK!

    28Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    Why hurt code?

    • Hurting code is fun!

    • It can make you a better tester and developer.

    • It can make code cleaner, clearer, easier to test.

    29Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    Ruby Sadism:nounDeriving pleasure from inflicting pain on software.Esp. bad software.

    30Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    It is just another way of looking at software

    development.

    31Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    I cackle everytime I can find code I can punish.

    32Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    Code that has complexity I know I

    can strip out.

    33Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    It is about changing your perspective on

    bad code.

    34Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    Make it fun to hunt it down and fix it and

    you'll do it more often.

    35Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    Ruby Sadism comes in many forms:

    36Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    Killing a bug by writing a new test.

    37Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    Reading overly clever code and

    itching to rip it to shreds.

    38Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    Nuking bad design, making it faster with less

    code.

    39Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    and many, many more.

    40Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    An Example

    • A 2 month social media rails project dragged on for 12 months.

    • Tying ActiveRecord to WebDAV. Emulating the entire DB via WebDAV properties.Needlessly complex and slow!

    • So, I ripped out WebDAV over the weekend.

    41Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    Finished in 74.77783 seconds.622 tests, 2502 assertions

    After:

    Before:

    Finished in 5.258559 seconds.330 tests, 961 assertions

    42Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    Test Time Over 6 Months

    Post DAV

    DAV

    43Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    For Some Reason,People Love Complexity.

    44Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    They revel in it.

    45Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    Ruby does not seem unique in this regard.

    46Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    I am not one of those people.

    47Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    But, I used to be one of those people.

    48Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    I got better...

    49Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    20071984 1986 1988 1990 1992 1994 1996 1998 2000 2002 2004

    10

    0

    1

    2

    3

    4

    5

    6

    7

    8

    9

    Year

    Fu/Sty

    le U

    nit

    s

    Pascal

    C

    Logo

    UNIX/

    Smalltalk/

    OO Epiphany

    C++

    Ruby

    Ruby

    Sadism/

    Asceticism

    Perl/

    Python/

    etc

    BASIC

    My Programming History

    50Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    Ruby Asceticism:nounCharacterized by or suggesting the practice of severe self-discipline & abstention from all forms of indulgence.

    51Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    Flagellants

    52Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    Test First is a form of self-discipline.

    53Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    YAGNI is a form of abstention.

    54Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    Ruby Ascetics:

    Real Life™ Ruby

    Eschew material possesions.

    Eschew extra complexity.

    Self-disciplined to achieve higher

    spirituality.

    Self-disciplined to achieve better

    understanding of self & coding mind.

    55Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    What is Indulgence?

    • Needless complexity and overly-clever code.

    • Code or design you don't immediately need.The “what abouts”.

    • Technical debt.

    56Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    Technical Debt

    • Skipping design is like borrowing money.

    • Refactoring is like repaying principal.

    • Interest is paid as time dealing with complexity.

    —Ward Cunningham–ComplexityAsDebt, c2.com

    57Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    80:20 aka Pareto Principal

    • In most systems, there is an imbalance between producers/consumers, money/people, etc.

    • 85+% of the land is owned by 5% of the people.

    • 80% of the time spent in only 20% of the code.

    • Use this tendency to focus efforts efficiently and objectively.

    58Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    Signal : Noise

    • Often related to 80:20.• Focus on what's important.• Unclutter, minimize interruptions and extraneous

    tasks to get the real work done.

    • As my favorite manager likes to say:• Big Alligators, Little Alligators, Swamp

    59Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    In Other Words:

    “A developer’s obligation is to make sure that the code as written makes the clearest possible statement as to how the solution

    was understood at the time of writing.”

    –Ward Cunningham, c2.com

    60Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    I think Ruby sadism and asceticism are

    very powerful.

    61Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    But getting there isn't easy.

    62Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    It requires understanding yourself

    as much as you understand the code.

    63Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    IntrospectionOriented Development

    64Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    How do do better?

    How did overlook that bug?

    Where am lacking clarity?

    How can use my tools better?

    Where do waste most of my time?

    How do focus better?

    Where am holding myself back?

    Am wrong?I65Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    Ask these questionsconstantly!

    66Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    Self-Improvement:Read!

    • 1 nerd book / month = 12× industry avg.

    • c2.com & other wikis w/ smart people.

    • Get as close to the experts as possible.

    • 10-20-ish smart blogs.

    67Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    Self-Improvement:Focus!

    • Stay away from:• WTF, coding horror, and other idiot forums.• A bazillion blogs in your feed reader.• Tons of high flow mailing lists.

    • Work on what's actually important.

    68Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    –7 Habits of Highly Effective People–Covey

    Urgent Not Urgent

    Important

    Not Important

    Pressing MattersFire Fighting

    Deadline Driven Projects

    PreventionProactive Planning

    Implementing SystemsBurnout Prevention

    InterruptionsSome FirefightsMost Meetings

    TVYoutube

    Other Time wasters

    69Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    • Learn one new language a year.• Learn your tools, in depth. Now in depther.• Examine your development habits.• Study something non-coding oriented.• Cross-discipline people are always more

    interesting and often write better code.

    Self-Improvement:Grow!

    70Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    Self-Improvement:Push!

    Write more code, lots of it.

    Quantity > Quality(sometimes)

    71Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    Pottery Challenge

    • A pottery teacher told half his class that their grade will depend on one single piece that they'll produce at the end of the term.

    • He told the other half that their grade will be based on the volume of all the pieces they create.

    • Which half do you think produced better work by the end?

    72Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    “The function of the overwhelming majority of your artwork is simply to

    teach you how to make the small fraction of your artwork that soars.

    One of the basic and difficult lessons every artist must learn is that even the failed

    pieces are essential.”

    —Art & Fear—Bayles & Orland

    73Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    • Be competitive.

    • Challenge the Status Quo.

    • They are almost always wrong.

    • (Even when they’re right)

    Self-Improvement:Push, more!

    74Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    Don't be a sheep

    75Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    Self-Improvement:Feel!

    • Let your emotions flow. Have an opinion.• But don't let them rule you.

    • zentest, flog, & heckle all came from love of good developer tools.

    • vlad & image_science came from hate of impossibly complex code.• I spent 10 hrs debugging ONE issue in

    capistrano before writing vlad.

    76Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    Self-Improvement:Feedback

    • Use feedback:

    • Ask for it.

    • Listen to it.

    • Feed the feedback back.

    77Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    Find Your Balance

    0% Action 100%

    Thought

    0%

    100%

    CodeCowboy

    Mentarbator

    Analysis-Paralysis Sweet

    Spot

    CouchPotato

    78Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    Tools That Can Help

    79Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    autotest

    • You probably didn't realize that using autotest is a form of ruby sadism and asceticism, did you?

    • Poor doom guy...

    80Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    • Complexity reporter based on ABC metrics.

    • Flog score correlates to testing complexity.

    • Higher the flog score, the harder it is to get complete (& good) test coverage.

    Flogclass Test def blah # 11.2 = a = eval "1+1" # 1.2 + 6.0 + if a == 2 then # 1.2 + 1.2 + 0.4 + puts "yay" # 1.2 end endend

    Test#blah: (11.2) 6.0: eval 1.2: branch 1.2: == 1.2: puts 1.2: assignment 0.4: lit_fixnum

    81Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    main#none: (22.9) 7.0: to_proc_normal 3.3: assignment 3.1: branch 2.0: inject 1.8: constantize 1.8: association 1.6: columns 1.6: options 1.4: [] 1.4: block_pass 1.4: map 1.2: include? 1.2: keys

    Needless Complexity 1if MODELS.keys.inject(true) {|b, klass| b and klass.constantize.columns.map(&:name).include? association.options[:foreign_key]} then # ...end

    1line if(!) 132chars 132avg len22.9flog

    82Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    Needless Complexity 2

    main#none: (23.5) 7.5: to_proc_normal 4.7: assignment 3.4: branch 2.2: inject 1.9: constantize 1.7: columns 1.5: block_pass 1.5: map 1.5: association 1.3: include? 1.3: keys 1.3: options 1.1: []

    fk = association.options[:foreign_key]if MODELS.keys.inject(true) {|b, klass| b and klass.constantize.columns.map(&:name).include? fk} then # ...end

    3lines 144chars 48avg chars23.5flog

    83Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    Needless Complexity 3

    main#none: (22.8) 7.0: assignment 6.0: to_proc_normal 4.5: branch 2.3: map 2.2: inject 1.6: constantize 1.5: association 1.4: columns 1.3: include? 1.3: options 1.3: keys 1.2: block_pass 1.1: []

    fk = association.options[:foreign_key]columns = MODELS.keys.map { |key| key.constantize.columns.map(&:name) }if columns.inject(true) {|b, column| b and column.include? fk} then # ...end

    4lines 182chars 45avg chars23.5flog

    84Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    Needless Complexity 4

    main#none: (20.8) 6.0: to_proc_normal 4.6: assignment 3.3: branch 2.3: map 1.6: constantize 1.5: association 1.4: columns 1.3: keys 1.3: options 1.2: block_pass 1.2: include? 1.1: [] 1.1: all?

    fk = association.options[:foreign_key]columns = MODELS.keys.map { |key| key.constantize.columns.map(&:name) }if columns.all? {|column| column.include? fk} then # ...end

    4lines 165chars 41avg chars20.8flog

    85Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    Needless Complexity 5

    main#none: (15.9) 5.9: assignment 4.5: branch 2.3: map 1.6: constantize 1.5: association 1.4: columns 1.3: name 1.3: options 1.3: keys 1.2: include? 1.1: [] 1.1: all?

    fk = association.options[:foreign_key]columns = MODELS.keys.map { |key| key.constantize.columns.map { |c| c.name } }if columns.all? {|column| column.include? fk} then # ...end

    4lines 172chars 43avg chars15.9flog

    Cleaner, Clearer, and Much Faster

    86Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    Coverage ToolsAre awesome at showing gaping holes.

    87Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    …but…

    88Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    Do not signify quality of tests at all.

    89Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    "We have 100% coverage"

    90Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    … So What?!?

    91Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    You can have 100% coverage with 0

    assertions.

    92Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    (or, more often, bad assertions)

    93Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    Absurd Exampleclass Life def meaning 42 endend

    class TestLife < Test::Unit::TestCase def test_meaning actual = Life.new.meaning expected = 6 * 9 # assert_equal expected, actual endend

    94Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    What does 100% coverage mean then?

    95Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    Coverage is the X-ray of the code world.

    96Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    Don't use it when you're bleeding out.

    97Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    Heckle• Most sadistic tool I've written.

    • Mutates your implementation (on the fly) to verify that your tests are good.

    • If your tests still pass after mutation, you missed an edge case.

    98Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    In Closing

    99Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    Frank Herbert was wrong

    100Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    Fear is not themind-killer

    101Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    Apathy is themind-killer

    102Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    You have to careabout the code

    103Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    Love it

    104Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    or Hate it

    105Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    Either is preferableto Apathy

    106Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    Preferable to the developer who says

    107Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    “I’m just paidto write code”

    108Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    You'll wind up maintaining their code

    109Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    (because they will move on)

    110Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    Hating their code.

    111Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    Their impact on the project.

    112Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    On the team.

    113Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    So Love the code…

    114Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    …or Hate it.

    115Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    If you love it:

    116Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    Nurture it.

    117Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    Grow it.

    118Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    Make it beautiful.

    119Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    If you hate it:

    120Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    Hurt it.

    121Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    Pare it back.

    122Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    Rewrite it.

    123Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    Just be passionate about what you work on.

    124Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    Otherwise you'redead inside

    125Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    …and so is your code.

    126Friday, November 2, 2007

  • RubyConf 2007, Charlotte NC

    Ryan Davis, Seattle.rbHurting Code for Fun & Profit

    Thank You.

    127Friday, November 2, 2007