Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Pharmacist or a Doctor - What does your code base need?

Pharmacist or a Doctor - What does your code base need?

http://www.confreaks.com/videos/2921-gardencityruby-pharmacist-or-a-doctor-what-does-your-code-base-need

"This talk was presented by @pavanks and @anandhak at Garden Citry Ruby Conf 2014".

You might know of every single code quality & metrics tool in the Ruby ecosystem and what they give you, but do you know:

Which metrics do you currently need?
Do you really need them?
How do you make your team members own them?
Wait, there was a metaphor in the title

While a pharmacist knows about pretty much every medicine out there and what it cures, its really a doctor who figures out what is required given the symptoms of a patient.

Just like the vitals recorded for healthy adults, infants, pregnant women or an accident patient in an ICU changes, your code base needs different metrics in different contexts to help you uncover problems.

Talk take aways

Through a lot of examples, the talk helps:

Identify the current state of your code base
Understand different metrics and what do they tell you about your code base
Drive your team towards continuously fixing problems uncovered by these metrics

Anandha Krishnan

January 04, 2014
Tweet

More Decks by Anandha Krishnan

Other Decks in Programming

Transcript

  1. Disclaimer This talk is mostly platform/language independent. But, we think

    the Ruby community is very aligned to most of what we will be talking about
  2. We have made a lot of mistakes*... …all our life

    as hackers We want to talk about one such mistake with a couple of examples * No employers or paranoid androids were hurt in the process!
  3. About 3 months back... I saw this guy walk into

    a pharmacy and ask for some medicine for a toothache
  4. Medicines for → Headache → Fever → Dysentery → Rashes

    → Cuts from a knife (I am still scared about this one!)
  5. Doctors treat attack symptoms by... → Coming up with a

    problem hypothesis → Using Diagnostic tests → Prescribing the right treatment → Validating that the symptoms vanish
  6. Pharmacists understand... → The details of the medicines → They

    can reverse engineer to find the disease based on the medicines → Are not responsible for prescribing treatment
  7. Some facts → We took over the project from another

    team → Our knowledge of the code base was bad → Test Coverage was extremely low
  8. Fix coverage first → Regression bugs could be caught by

    tests → We focussed on increasing coverage → Started monitoring and improving coverage steadily over a period of 2 months
  9. We ended up... → Improving coverage drastically → However, things

    got marginally better, but just that, marginal
  10. This and a lot of similar mistakes... Across different projects,

    drove us to rethink our approach. We ended up realising something basic...
  11. We basically stopped doing this... → Crawl github to find

    a suitable gem → Setup it and start monitoring → Spend time and effort to improve what you are monitoring
  12. Measuring → Controller specs vs Model specs coverage → Just

    line coverage is not very useful* → Line → Branch → Unique path * The Single Metric Fallacy
  13. Improving → Adding unit tests to old untested code bases

    is dangerous → Higher level tests (functional tests) are a great safety net for refactoring