RubyConfUA - Measuring Agile Process with Ruby, Hubert Łępicki

Embed Size (px)

Citation preview

  • 8/7/2019 RubyConfUA - Measuring Agile Process with Ruby, Hubert picki

    1/51

    Me asuring Agile ProcessWith Ruby

    RubyConf Ukraine 2010

    Hubert [email protected]

    mailto:[email protected]:[email protected]
  • 8/7/2019 RubyConfUA - Measuring Agile Process with Ruby, Hubert picki

    2/51

    Me

  • 8/7/2019 RubyConfUA - Measuring Agile Process with Ruby, Hubert picki

    3/51

    Hubert picki

  • 8/7/2019 RubyConfUA - Measuring Agile Process with Ruby, Hubert picki

    4/51

    [email protected]

    [email protected]

    github.com/hubertlepicki

    twitter.com/hubertlepicki

    hubertlepicki.com

  • 8/7/2019 RubyConfUA - Measuring Agile Process with Ruby, Hubert picki

    5/51

  • 8/7/2019 RubyConfUA - Measuring Agile Process with Ruby, Hubert picki

    6/51

  • 8/7/2019 RubyConfUA - Measuring Agile Process with Ruby, Hubert picki

    7/51

    http://amberbit.com

  • 8/7/2019 RubyConfUA - Measuring Agile Process with Ruby, Hubert picki

    8/51

  • 8/7/2019 RubyConfUA - Measuring Agile Process with Ruby, Hubert picki

    9/51

  • 8/7/2019 RubyConfUA - Measuring Agile Process with Ruby, Hubert picki

    10/51

    Agile

  • 8/7/2019 RubyConfUA - Measuring Agile Process with Ruby, Hubert picki

    11/51

    Hot topic

  • 8/7/2019 RubyConfUA - Measuring Agile Process with Ruby, Hubert picki

    12/51

  • 8/7/2019 RubyConfUA - Measuring Agile Process with Ruby, Hubert picki

    13/51

    http://agilemanifesto.org

  • 8/7/2019 RubyConfUA - Measuring Agile Process with Ruby, Hubert picki

    14/51

    Individuals and interactions over processes and tools

    Working software over comprehensivedocumentation

    Customer collaboration over contract

    negotiation

    Responding to change over following aplan

  • 8/7/2019 RubyConfUA - Measuring Agile Process with Ruby, Hubert picki

    15/51

    no process and tools?

    no documentation?

    no contract negotiation?

    no plan?

  • 8/7/2019 RubyConfUA - Measuring Agile Process with Ruby, Hubert picki

    16/51

    WRONG

  • 8/7/2019 RubyConfUA - Measuring Agile Process with Ruby, Hubert picki

    17/51

    There are contractssimple

    flexible

    service over product

  • 8/7/2019 RubyConfUA - Measuring Agile Process with Ruby, Hubert picki

    18/51

    it "should have documentatio

    it "should be readable"

    it "can be in form of tests"

    it "can be in form of code"

  • 8/7/2019 RubyConfUA - Measuring Agile Process with Ruby, Hubert picki

    19/51

    there must be a plan

  • 8/7/2019 RubyConfUA - Measuring Agile Process with Ruby, Hubert picki

    20/51

    The processwell defined by methodology

    eXtreme Programming

    Scrum

    Kanban

    Crystal

  • 8/7/2019 RubyConfUA - Measuring Agile Process with Ruby, Hubert picki

    21/51

    What do they have incommon?

    iterations

    incremental development

    defined roles in project

  • 8/7/2019 RubyConfUA - Measuring Agile Process with Ruby, Hubert picki

    22/51

    What are the differences?eXtreme Programming: engineering

    practices

    Scrum: project management

    Kanban: fast delivery of features

  • 8/7/2019 RubyConfUA - Measuring Agile Process with Ruby, Hubert picki

    23/51

    Why do we (Rubyprogrammers) use Agile

    methodologies?they fit object oriented programming

    they have simple rules

    they can reduce/control chaos

  • 8/7/2019 RubyConfUA - Measuring Agile Process with Ruby, Hubert picki

    24/51

    Despite trying toimplement agile

    methodologies, sometimesthings go bad.

    how bad?

  • 8/7/2019 RubyConfUA - Measuring Agile Process with Ruby, Hubert picki

    25/51

    I used to work on aproject we were going to

    finish in October 2007we finished in October

    2008

    that bad

    (that was BEFORE we started AmberBit;))

  • 8/7/2019 RubyConfUA - Measuring Agile Process with Ruby, Hubert picki

    26/51

    What is to blame?bad programmers

    bad management

    wrong implementation of agilemethodologies(http://www.halfarsedagilemanifesto.org/)

  • 8/7/2019 RubyConfUA - Measuring Agile Process with Ruby, Hubert picki

    27/51

    If a project fails, you want to know whatwent wrong

    During development, you want to knowif things are likely to go wrong

  • 8/7/2019 RubyConfUA - Measuring Agile Process with Ruby, Hubert picki

    28/51

    You need to measure theprocess

    yeah, but how?

  • 8/7/2019 RubyConfUA - Measuring Agile Process with Ruby, Hubert picki

    29/51

    Let's thing what can gowrong during the project

    poor implementation of agilemethodologies

    communication problems

    software quality degrades

    project doesn't meet budget, scope or time

  • 8/7/2019 RubyConfUA - Measuring Agile Process with Ruby, Hubert picki

    30/51

    and many more

  • 8/7/2019 RubyConfUA - Measuring Agile Process with Ruby, Hubert picki

    31/51

    What to measure - a fewexamples

    project size

    team velocity

    project progress

    value of one story point in time

  • 8/7/2019 RubyConfUA - Measuring Agile Process with Ruby, Hubert picki

    32/51

    number of passing/failing tests

    code complexity

    code coverage

    test to code ratio

  • 8/7/2019 RubyConfUA - Measuring Agile Process with Ruby, Hubert picki

    33/51

    ToolsYour issue tracker

    Ruby

    CI builds

  • 8/7/2019 RubyConfUA - Measuring Agile Process with Ruby, Hubert picki

    34/51

    Project sizerake stats

  • 8/7/2019 RubyConfUA - Measuring Agile Process with Ruby, Hubert picki

    35/51

    +----------------------+-------+-----| Name | Lines | LO+----------------------+-------+-----| Controllers | 519 | 40| Helpers | 43 | 3| Models | 658 | 49| Libraries | 119 | 8

    | Model specs | 854 | 71| View specs | 5 || Helper specs | 18 | 1| Acceptance specs | 371 | 29+----------------------+-------+-----| Total | 2587 | 205+----------------------+-------+-----

    Code LOC: 1021 Test LOC: 1036

  • 8/7/2019 RubyConfUA - Measuring Agile Process with Ruby, Hubert picki

    36/51

    # Quick and dirty way to get

    # in source code of your apDir.glob("app/**/*.rb").col`cat #{f} | wc -l`.to_i

    end.sum

  • 8/7/2019 RubyConfUA - Measuring Agile Process with Ruby, Hubert picki

    37/51

    # Better, get only number o

    Dir.glob("app/**/*.rb").colFile.readlines(f).select{|l| !(l =~ /^\s*($|#)/)

    }.sizeend.sum

  • 8/7/2019 RubyConfUA - Measuring Agile Process with Ruby, Hubert picki

    38/51

    Test resultsWhen using RSpec, write your own

    formatter

    or hook into BaseFormatter:

  • 8/7/2019 RubyConfUA - Measuring Agile Process with Ruby, Hubert picki

    39/51

    Monkeypatching RSpclass Spec::Core::Formatters::

    alias_method :old_dump_summ:dump_summary

    def dump_summary(*args)old_dump_summary(*args)

    Faraday.get("http://mydom"passed=#{args"&failed=#{ar

    endend

  • 8/7/2019 RubyConfUA - Measuring Agile Process with Ruby, Hubert picki

    40/51

    Code complexitywhy bother?

    it can be a measure of technical debt

    debt removed earlier is easier to manage

  • 8/7/2019 RubyConfUA - Measuring Agile Process with Ruby, Hubert picki

    41/51

    Static code analysis withRuby

    Flog - http://ruby.sadi.st/Flog.html

    Saikuro - http://saikuro.rubyforge.org/

    ^^ these are 1.8-only ^^

    metric_abc - http://github.com/hubertlepicki/metric_abc

  • 8/7/2019 RubyConfUA - Measuring Agile Process with Ruby, Hubert picki

    42/51

    metric_abc in action$ metric_abc user.rbuser.rb > User > update_flagg

    user.rb > User > initialize: 1user.rb > User > vote_on: 13user.rb > User > generate_reauser.rb > User > thumbnail_uruser.rb > User > visit_ids: 8user.rb > User > already_voteuser.rb > User > suggested_lo...

  • 8/7/2019 RubyConfUA - Measuring Agile Process with Ruby, Hubert picki

    43/51

    ok, now what?calculate metrics

    store metrics in database

    visualize metric changes over time

  • 8/7/2019 RubyConfUA - Measuring Agile Process with Ruby, Hubert picki

    44/51

    examples

  • 8/7/2019 RubyConfUA - Measuring Agile Process with Ruby, Hubert picki

    45/51

  • 8/7/2019 RubyConfUA - Measuring Agile Process with Ruby, Hubert picki

    46/51

  • 8/7/2019 RubyConfUA - Measuring Agile Process with Ruby, Hubert picki

    47/51

  • 8/7/2019 RubyConfUA - Measuring Agile Process with Ruby, Hubert picki

    48/51

  • 8/7/2019 RubyConfUA - Measuring Agile Process with Ruby, Hubert picki

    49/51

    how to plot?Gnuplot.open do |gp|

    Gnuplot::Plot.new( gp ) do |

    x = ProjectSize.all.colley = ProjectSize.all.colleplot.title "Project Size"plot.ylabel "LOCs"plot.xlabel "days"

    plot.data

  • 8/7/2019 RubyConfUA - Measuring Agile Process with Ruby, Hubert picki

    50/51

    Final notesdo not trust metrics, treat them as

    inteligence reports

    analyse periodically

    analyse failed projects

    take actios to fix processes in your

    teams

  • 8/7/2019 RubyConfUA - Measuring Agile Process with Ruby, Hubert picki

    51/51

    Thank you!