< Return to Video

GoGaRuCo 2014- The Scientific Method of Troubleshooting

  • 0:14 - 0:18
    First of all, I just want to start off
    by thanking the organizer.
  • 0:18 - 0:20
    They really put in a lot of effort
  • 0:20 - 0:22
    to make me feel really special as a speaker.
  • 0:22 - 0:25
    Also as an attendee,
    watching these other talks
  • 0:25 - 0:28
    so I just want to give them a huge thanks
  • 0:28 - 0:31
    Can I get an extra round of
    applaud for the organizers
  • 0:36 - 0:39
    And also, thanks everyone for being here.
  • 0:40 - 0:41
    So, I'm Blithe
  • 0:41 - 0:43
    You can find me @blithe
    on Twitter and Github
  • 0:45 - 0:48
    I work for a company call Big Nerd Ranch
  • 0:48 - 0:50
    It's based in Atlanta and
  • 0:50 - 0:52
    some people know it. Alright!
  • 0:52 - 0:55
    It's based in Atlanta and
    I work remotely full time in Oakland
  • 0:55 - 0:57
    We do a couple of things at
    Big Nerd Ranch
  • 0:57 - 1:01
    We develop apps, we write books
    and we also teach courses.
  • 1:02 - 1:05
    And of course, we're hiring
    good people, always.
  • 1:06 - 1:09
    As you heard, I used to be a scientist
  • 1:09 - 1:11
    I have a PhD in Physical Chemistry
  • 1:11 - 1:14
    And a lot of people ask me
    what is physical chemistry?
  • 1:14 - 1:15
    what does that mean?
  • 1:15 - 1:18
    Well, if you think about it
    It's right on the border between
  • 1:18 - 1:23
    what you know as physics and
    what you know as chemistry
  • 1:23 - 1:27
    That means I spent a
    long time in grad school
  • 1:27 - 1:30
    It also means I've done a lot
    of experiments
  • 1:30 - 1:33
    A lot of people asked me
    "How did you do it?
  • 1:33 - 1:34
    How did you make it
    through 6 years of grad school
  • 1:35 - 1:36
    make it to the end?"
  • 1:36 - 1:39
    And I did it by using the scientific method
  • 1:41 - 1:45
    and I'm still using it everyday
  • 1:45 - 1:49
    I'm a developer, but
    I'm still using the scientific method everyday
  • 1:49 - 1:51
    How many of you have gotten an error
  • 1:52 - 1:53
    Google it
  • 1:53 - 1:56
    pull the first answer straight from StackOverflow
  • 1:56 - 1:58
    and put it in your code and run it
  • 1:59 - 2:00
    I think we all tried it
  • 2:02 - 2:03
    And did it solve your problem?
  • 2:04 - 2:05
    Maybe
  • 2:05 - 2:07
    Maybe it did.
    Maybe if you were lucky
  • 2:07 - 2:08
    But probably not
  • 2:09 - 2:10
    Most of the time, probably not
  • 2:10 - 2:11
    and it was pretty inefficient
  • 2:11 - 2:13
    and the more important question is
  • 2:13 - 2:16
    Did you learn anything from that?
  • 2:17 - 2:21
    The most important part of troubleshooting is learning
  • 2:21 - 2:24
    If you solved a problem without learning
    from it,
  • 2:24 - 2:26
    It's only a temporary fix
  • 2:26 - 2:32
    It's either going to come back later or
    you're going to make the same mistake in the future
  • 2:34 - 2:38
    Learning is how you level up as a developer
  • 2:38 - 2:40
    by learning from your experiences
  • 2:40 - 2:43
    And that bring me back to the scientific method
  • 2:43 - 2:48
    How can using the scientific method
    help you level up as a developer?
  • 2:48 - 2:50
    Well, What is it?
  • 2:50 - 2:55
    Well, if you Google it and go straight to
    Wikipedia you'll see this definition
  • 2:55 - 2:58
    It's a set of techniques for acquiring knowledge
  • 2:58 - 3:01
    And I love this definition because it can apply to anything
  • 3:01 - 3:05
    any career, including being a developer
  • 3:05 - 3:08
    The scientific method, it's methodical
  • 3:08 - 3:13
    It's an established procedure and
    scientists have been using it since the 17th century
  • 3:13 - 3:15
    It's also systematic
  • 3:15 - 3:19
    It's a step-by-step process
  • 3:19 - 3:24
    and it's for gaining knowledge
    and incorporating that into your process
  • 3:24 - 3:29
    and the time for reflection is built right into the
    scientific method
  • 3:30 - 3:35
    The other day, a coworker of mine popped up
    in the company chat room and said
  • 3:35 - 3:40
    "Has anyone seen Ruby string interpolation fail?"
  • 3:40 - 3:42
    and I thought that's a pretty interesting question
  • 3:42 - 3:45
    Why do you ask? Why are you asking that?
  • 3:45 - 3:50
    So we dug a little deeper and they were
    using factory girl sequencing method
  • 3:50 - 3:54
    to create a series of users
    with unique email addresses.
  • 3:54 - 3:57
    So email 1, email 2, email 3...
  • 3:57 - 3:59
    and it wasn't working. It was failing.
  • 3:59 - 4:02
    It was trying to create users
    with the same email address
  • 4:02 - 4:04
    and it was failing and
    they couldn't figure out why
  • 4:04 - 4:06
    and their solution,
  • 4:06 - 4:09
    they ended up just rolling
    their own sequencing method
  • 4:09 - 4:12
    Well, that may have solved
    their problem temporarily,
  • 4:12 - 4:15
    that wasn't really the
    most elegant solution
  • 4:15 - 4:16
    and it turned out,
  • 4:16 - 4:20
    the real problem was that they
    were missing the hash symbol
  • 4:20 - 4:23
    that was required for interpolation
  • 4:23 - 4:26
    so simple mistakes, but we all
    make simple mistakes like that
  • 4:26 - 4:28
    We all make them all the times
  • 4:28 - 4:32
    But maybe using the scientific
    method would have helped in this case
  • 4:33 - 4:37
    The first step of the scientific
    method is defining the problem
  • 4:37 - 4:43
    As a scientist, this means saying what is
    the information that you're trying to gain?
  • 4:43 - 4:49
    What knowledge are you
    trying to gain or learn?
  • 4:49 - 4:52
    What's important to keep in mind
    when you're defining the problem is
  • 4:52 - 4:57
    forget what you think you know
    and question everything
  • 4:57 - 5:02
    Just think about open up your mind, question
    everything and just define the problem
  • 5:02 - 5:06
    It's also important to get rid of
    your emotions at this point
  • 5:06 - 5:10
    You want to, maybe you're on a tight deadline
    maybe you think you know what the answer is
  • 5:10 - 5:15
    I'm just going to go do this. I already
    know what's wrong blah blah blah
  • 5:15 - 5:18
    Get rid of all that and
    just define the problem
  • 5:18 - 5:21
    You can do that by
    answering a few questions
  • 5:21 - 5:24
    What is behavior that
    you're expecting to happen?
  • 5:24 - 5:26
    What's actually happening?
  • 5:26 - 5:29
    and how are those two things different?
  • 5:29 - 5:32
    and how will you know
    when you solved your problem?
  • 5:32 - 5:36
    What is your criteria for success?
  • 5:36 - 5:39
    This is particularly important when
  • 5:39 - 5:42
    when other people come and
    ask you to help them troubleshoot
  • 5:42 - 5:44
    Don't listen to their assumptions.
  • 5:44 - 5:46
    Get rid of that out of the way.
  • 5:46 - 5:49
    and just start from scratch and
    answer these simple questions
  • 5:49 - 5:52
    What do you want to happen?
    What's actually happening?
  • 5:52 - 5:55
    How will you know when
    you fixed the problem?
  • 5:55 - 5:57
    Once you defined your problem,
  • 5:57 - 5:59
    you can start by doing
    some background research
  • 5:59 - 6:02
    and in reality, you guys are already doing this.
  • 6:02 - 6:04
    Everyone's doing it.
  • 6:04 - 6:07
    In grad school, we would just be constantly reading
  • 6:07 - 6:09
    Before we would ever start an experiment,
  • 6:09 - 6:12
    we would just be reading for days and days and days
  • 6:12 - 6:14
    Reading recent articles
  • 6:14 - 6:18
    or sometimes really old article that we would have to go to the library and dig up
  • 6:18 - 6:21
    We were just constantly reading
  • 6:21 - 6:25
    And the reason is because you want
    to have enough background information
  • 6:25 - 6:31
    So that you know you're starting
    with the right experiment
  • 6:31 - 6:34
    As a scientist, it's really expensive both
  • 6:34 - 6:37
    It cost a lot of time and money to do an experiment
  • 6:37 - 6:40
    So you want to make sure you're starting with the right experiment
  • 6:40 - 6:45
    and you do that by making sure you have enough background information
  • 6:45 - 6:48
    As a developer, you can do that by knowing your environment
  • 6:48 - 6:51
    So you need to know the language that you're working in
  • 6:51 - 6:54
    and you can always become a little more familiar with it
  • 6:54 - 6:58
    go dig in that dark area that you're unfamiliar with
  • 6:58 - 7:01
    or how does this work? What's going on here?
  • 7:01 - 7:04
    When you're working on a specific application,
  • 7:04 - 7:08
    you can look at what are the dependencies that you're using
  • 7:08 - 7:13
    Get to know those and even which version of those dependency are you using
  • 7:13 - 7:17
    For the case of the factory girl sequencing,
  • 7:17 - 7:20
    probably just taking a look at the documentation might have helped
  • 7:20 - 7:24
    Oh, I'm missing the hash symbol. That's it.
  • 7:24 - 7:26
    You also want to be reading the literature
  • 7:26 - 7:29
    You want to stay up to date with blog post
  • 7:29 - 7:32
    Always be reading what's coming out,
    what's new
  • 7:32 - 7:37
    There's always a lot of content out there,
    so you want to be reading it
  • 7:37 - 7:39
    For your specific dependency,
  • 7:39 - 7:40
    you can look at the README
  • 7:40 - 7:43
    or the changelog for the most recent version
  • 7:43 - 7:46
    What changed, what's different
  • 7:46 - 7:50
    You can also look at the specific source code
    of the version you're using
  • 7:50 - 7:54
    Either on GitHub or using bundle open and the gem name
  • 7:54 - 7:57
    You can pull it right up,
    right on your computer
  • 7:57 - 8:00
    And dig around in there.
    Look at what's going on.
  • 8:00 - 8:03
    And also a helpful thing is to look at the test suite
  • 8:03 - 8:06
    of this dependency that you're looking at
  • 8:06 - 8:08
    Sometimes that helps you tell
    the expect behavior of the gem
  • 8:08 - 8:11
    What's suppose to be happening
  • 8:11 - 8:15
    Another helpful source of background information is
    just discussion
  • 8:15 - 8:17
    with your friends and colleagues
  • 8:17 - 8:20
    Maybe they have already encounter your problem
  • 8:20 - 8:22
    and they know the perfect solution
  • 8:22 - 8:26
    The best first experiment for you to start with
  • 8:26 - 8:27
    That's really hellpful
  • 8:27 - 8:31
    Particularly, when you're struggling on a problem
  • 8:31 - 8:33
    maybe you been working on it for a long time
  • 8:33 - 8:35
    and you're not getting anywhere
  • 8:35 - 8:38
    it's time to get up and go ask somebody for help
  • 8:38 - 8:40
    Have you seen anything like this?
  • 8:40 - 8:42
    And that's exactly what my colleague did
  • 8:42 - 8:44
    They popped in the company chatroom
  • 8:44 - 8:46
    "Hey, I need some help on this"
  • 8:46 - 8:48
    We have a rule at Big Nerd Ranch
  • 8:48 - 8:50
    If you're working on something for more than an hour
  • 8:50 - 8:51
    and you're not making progress
  • 8:51 - 8:52
    Don't!
  • 8:52 - 8:55
    It's time to stop and go ask somebody for help
  • 8:55 - 8:58
    It's better to get help from other people
  • 8:58 - 9:03
    And of course, sometime the good
    old rubber duck is a good helpful solution
  • 9:03 - 9:05
    Maybe the rubber duck doesn't talk back,
  • 9:05 - 9:07
    but just by explaining your problem
  • 9:07 - 9:12
    and how you got there is a good way to get ideas
  • 9:12 - 9:18
    You also want to make sure you can
    replicate the problem that you're having
  • 9:18 - 9:19
    Make it fail.
  • 9:19 - 9:23
    I mean can you even reproduce it?
    Is it an error you can reproduce?
  • 9:23 - 9:26
    And what are the steps that it takes to do that
  • 9:26 - 9:28
    Once you have that information,
  • 9:28 - 9:30
    you can go ahead and write an automated test
  • 9:30 - 9:32
    to help you solve that problem
  • 9:33 - 9:36
    After you gather a lot of background information,
  • 9:36 - 9:38
    you can then establish a hypothesis
  • 9:38 - 9:44
    A hypothesis needs to be educated and based in evidence
  • 9:44 - 9:46
    So this goes back to all the research
    that you've been doing
  • 9:46 - 9:50
    And it also need to be something that you can test
  • 9:50 - 9:52
    So this goes back to defining your problem
  • 9:52 - 9:55
    and your criteria for success
  • 9:55 - 9:57
    So once you have a hypothesis,
  • 9:57 - 10:00
    then you can start to design an experiment
  • 10:00 - 10:02
    And the most important part of an experiment design
  • 10:02 - 10:05
    is that it test your hypothesis, of course.
  • 10:05 - 10:09
    Don't do an experiment that doesn't test your hypothesis
  • 10:09 - 10:12
    Couple of tips for designing an experiment
  • 10:12 - 10:16
    One good thing to start with is just dividing and conquering your code base
  • 10:16 - 10:19
    Well first of all, hopefully you've
    written an automated test
  • 10:19 - 10:22
    So you can just run that test over and over again
  • 10:22 - 10:25
    to focus on the condition that you're working on
  • 10:25 - 10:30
    So that isolate a lot other behavior that you don't
    need to test immediately right now
  • 10:30 - 10:34
    Of course, you can always comment
    out big chunks of codes
  • 10:34 - 10:36
    If you're like "I know this stuff is working.
  • 10:36 - 10:37
    Let me kind of comment it out
  • 10:37 - 10:41
    and just run the part of the code
    that I need to look at right now."
  • 10:41 - 10:45
    Breakpoints are excellent helpful way to do it
  • 10:45 - 10:48
    Say your code has to go through 10 steps
  • 10:48 - 10:50
    and only the last one isn't working
  • 10:50 - 10:51
    Go ahead and enter a breakpoint
  • 10:51 - 10:53
    or a binding .pry right in there
  • 10:53 - 10:58
    You can stop and just look at the code is broken,
    that is not working
  • 11:00 - 11:02
    You can also
  • 11:02 - 11:06
    Say you suspect there's a problem
    with the dependency or a gem
  • 11:06 - 11:09
    What you can do is maybe create a new app
  • 11:09 - 11:12
    and only use that one dependency or API
  • 11:12 - 11:14
    Are you still having the problem?
  • 11:14 - 11:17
    OK, well maybe you just got rid of all
    of the other code that you have written
  • 11:17 - 11:19
    and you know it just with that
  • 11:19 - 11:21
    you can replicate it in a fresh app
  • 11:21 - 11:26
    That's another way you can isolate the code
  • 11:27 - 11:30
    Another important thing is to limit the variables
  • 11:30 - 11:31
    that you're testing
  • 11:31 - 11:34
    When you look at beginner troubleshoot sometimes
  • 11:34 - 11:37
    They try to change many variables at once
  • 11:37 - 11:39
    Maybe it's a problem with the controller over here
  • 11:39 - 11:43
    and the view or maybe it's in the model. I don't know.
  • 11:43 - 11:47
    and sometimes they get down a road
    that's really hard to come back from
  • 11:47 - 11:51
    and they can't even answer the question
    "what has changed?"
  • 11:51 - 11:53
    So you really don't want to do that
  • 11:53 - 11:56
    You want to limit your experiment
    to one variable at a time.
  • 11:56 - 11:58
    Let's test one variable
  • 11:58 - 12:01
    and finish our experiment before we start another one
  • 12:01 - 12:03
    so that we know
  • 12:03 - 12:08
    and we need to make sure we do
    the analysis part of the experiment
  • 12:08 - 12:12
    Don't be afraid to try something weird
  • 12:12 - 12:14
    Sometimes, you know you think, you're thinking
  • 12:14 - 12:17
    "Ah this never gonna work
    but I'll try it anyway."
  • 12:17 - 12:20
    And you try it and you find your solution
  • 12:20 - 12:23
    Don't be afraid to do that.
    Try something strange.
  • 12:23 - 12:25
    You can also try maybe
  • 12:25 - 12:28
    try something that you know is
    going to break your program
  • 12:28 - 12:30
    Go throw some gibberish in there.
    Type it in there.
  • 12:30 - 12:33
    And you know it's going to break it.
  • 12:33 - 12:35
    You know it's going to fail.
  • 12:35 - 12:38
    What happen when you run your program
    and it doesn't fail?
  • 12:38 - 12:40
    Maybe that code was never even getting run
  • 12:40 - 12:43
    Maybe you're not including that file or something
  • 12:43 - 12:46
    So try something strange
  • 12:46 - 12:48
    A friend of mine told me a story the other day
  • 12:48 - 12:51
    about how they've created a table
  • 12:51 - 12:53
    anytime they were trying to do a join with that table,
  • 12:53 - 12:56
    it was throwing some obscure error
    and they couldn't figure it out
  • 12:56 - 12:59
    What's wrong with this one table?
    What's wrong with it?
  • 12:59 - 13:01
    So they ended up, they just
  • 13:01 - 13:04
    they got rid of the table
  • 13:04 - 13:06
    They created a new one and they named it Bananas.
  • 13:06 - 13:08
    Just something weird.
  • 13:08 - 13:09
    Like just do it weird.
  • 13:09 - 13:11
    And that actually fixed their problem.
  • 13:11 - 13:13
    So Bananas worked.
  • 13:13 - 13:14
    And they're just like "What? What is going on?
  • 13:14 - 13:16
    Why? Why did that work"
  • 13:16 - 13:21
    and it turned out they had named
    their original table attributes
  • 13:22 - 13:25
    So of course that's a protected name
    so it didn't work
  • 13:25 - 13:27
    So trying something weird,
  • 13:27 - 13:30
    naming the table Bananas,
    that worked for them.
  • 13:32 - 13:35
    How many of you have ever
    done something like this?
  • 13:35 - 13:38
    Where you dig, you super deep dive. Yeah.
  • 13:38 - 13:40
    You're like oh it's way down here.
  • 13:40 - 13:42
    There's some weird problem.
  • 13:42 - 13:44
    And it ends up being
    just right on the surface.
  • 13:44 - 13:46
    Something simple.
  • 13:46 - 13:48
    When you're designing your experiment,
  • 13:48 - 13:50
    you want to focus on
  • 13:50 - 13:52
    Think about the hierarchy of blame.
  • 13:52 - 13:53
    Think about OK,
  • 13:53 - 13:57
    what is the most likely
    candidate for this problem?
  • 13:57 - 14:00
    Once you eliminated
    the most likely candidates,
  • 14:00 - 14:04
    then you can go on
    to the harder problems
  • 14:04 - 14:05
    For example,
  • 14:05 - 14:07
    more recently changed code
  • 14:07 - 14:10
    is probably more likely to be at fault
  • 14:10 - 14:14
    than codes that's been in
    production for a long time
  • 14:14 - 14:16
    and something that you wrote
  • 14:16 - 14:19
    is probably more likely to
    be the problem than say,
  • 14:19 - 14:21
    something in Ruby
  • 14:22 - 14:26
    But through your experiments go ahead
    and eliminate the most likely candidate
  • 14:26 - 14:28
    and then work your way down
  • 14:28 - 14:32
    Don't start by trying to figure out
    what's wrong with Ruby
  • 14:33 - 14:35
    After you designed your experiment,
  • 14:35 - 14:37
    go ahead and carry it out
  • 14:37 - 14:39
    and you're going to start
    gathering your data
  • 14:39 - 14:42
    that you're going to use for your analysis
  • 14:43 - 14:44
    So you need to think about OK,
  • 14:44 - 14:47
    what's the current status of your program now?
  • 14:47 - 14:48
    What's happening now?
  • 14:49 - 14:51
    Were there any changes?
  • 14:51 - 14:52
    Are there any new messages?
  • 14:52 - 14:56
    Are there any new results from your experiment?
  • 14:56 - 14:57
    What else changed recently?
  • 14:57 - 15:00
    Were there any other things that you changed?
  • 15:00 - 15:02
    What does the log file say?
  • 15:02 - 15:04
    Gather all that information
  • 15:05 - 15:06
    And this one may seem obvious
  • 15:06 - 15:09
    but it need to be said
    even for senior developers
  • 15:09 - 15:12
    Read the error message!
  • 15:12 - 15:13
    Just read it.
  • 15:13 - 15:14
    Read it out loud.
  • 15:14 - 15:15
    Even that alone will help it.
  • 15:15 - 15:16
    Just read it.
  • 15:17 - 15:18
    Take a look at the stack trace.
  • 15:18 - 15:20
    Look at the line number.
  • 15:20 - 15:21
    What's going on?
  • 15:21 - 15:24
    That's very useful information for a reason
  • 15:24 - 15:26
    So gather that information
  • 15:26 - 15:28
    as part of your experiment.
  • 15:29 - 15:30
    Once you have all your data,
  • 15:30 - 15:33
    you can start doing your analysis
  • 15:33 - 15:35
    and you really don't
    want to skip this part
  • 15:35 - 15:37
    This is the most important part
  • 15:37 - 15:39
    because this where the learning happens
  • 15:39 - 15:42
    This is where you level up as a developer
  • 15:43 - 15:46
    and it's built right into the scientific method
  • 15:48 - 15:49
    So now that you've done your experiment
  • 15:49 - 15:51
    Did it solve your problem?
  • 15:51 - 15:54
    That test that you wrote, is it passing now?
  • 15:54 - 15:56
    and what about all the rest of your test suite?
  • 15:56 - 15:59
    Make sure it's also passing
  • 15:59 - 16:02
    Make sure you solved your problem
    without breaking something else
  • 16:02 - 16:06
    And make sure you met all
    your criteria for success
  • 16:07 - 16:09
    And you also want to think about
  • 16:09 - 16:12
    what did you learn from that experiment?
  • 16:12 - 16:15
    What information can you get from that?
  • 16:15 - 16:17
    Don't just move on to the next thing and say
  • 16:17 - 16:20
    "OK, it's fixed now. Let's go"
  • 16:20 - 16:22
    And take a moment,
  • 16:22 - 16:24
    Take the time to reflect on your experiment.
  • 16:24 - 16:27
    What went well?
    What didn't go well?
  • 16:27 - 16:29
    Think about that
  • 16:29 - 16:31
    And most importantly,
  • 16:31 - 16:33
    you need to understand
  • 16:33 - 16:36
    why you solved your problem
  • 16:36 - 16:38
    Have you ever said,
  • 16:38 - 16:41
    "Well, I don't why it works,
    but it works."
  • 16:42 - 16:44
    I have news for you.
    You didn't fix it.
  • 16:44 - 16:47
    You didn't solve your problem.
  • 16:47 - 16:49
    It's the understanding
  • 16:49 - 16:52
    that cement the knowledge in your brain.
  • 16:52 - 16:55
    That's what make you a better developer.
  • 16:55 - 16:57
    And for those of you in leadership positions,
  • 16:57 - 17:00
    maybe you're teaching a newer developer
  • 17:00 - 17:04
    It's important that you make sure
    that they understand the why
  • 17:04 - 17:06
    So make them explain it to you,
  • 17:06 - 17:09
    Why did this change solved your problem?
  • 17:10 - 17:13
    Your results from your experiment
  • 17:13 - 17:14
    will also help you determine
  • 17:14 - 17:18
    what's going to happen in your next experiment.
  • 17:18 - 17:20
    Maybe you solved your problem already
  • 17:20 - 17:23
    and you don't have to do another experiment
  • 17:23 - 17:26
    but it will influence your experiment in the future
  • 17:26 - 17:29
    Maybe now you know
    a better first experiment to start with
  • 17:29 - 17:30
    "I know.
  • 17:30 - 17:33
    I know the fix.
    I'll start with this next time."
  • 17:33 - 17:35
    Or if you didn't solve your problem,
  • 17:35 - 17:37
    maybe you have a new error message
  • 17:37 - 17:39
    "Ok, you can work with that.
  • 17:39 - 17:41
    Now what's the new experiment?"
  • 17:41 - 17:43
    Or "Oh maybe it's a problem with this gem.
  • 17:43 - 17:47
    I should do more
    background research on that"
  • 17:48 - 17:50
    Another important part of the analysis
  • 17:50 - 17:52
    is embracing your successes.
  • 17:53 - 17:54
    This is really important.
  • 17:54 - 17:55
    A lot of people they just,
  • 17:55 - 17:57
    they sort of skip over this part
  • 17:57 - 17:59
    and go back to work
  • 17:59 - 18:01
    But it's really important.
  • 18:01 - 18:03
    If you did solve your problem,
  • 18:03 - 18:05
    let that sink in
  • 18:05 - 18:07
    because that's going to drive you
  • 18:07 - 18:09
    for future troubleshooting problems
  • 18:10 - 18:12
    You need to remember all those problems
  • 18:12 - 18:13
    that you solved before
  • 18:13 - 18:15
    and know that you can do it
  • 18:15 - 18:17
    and that you can keep going
  • 18:17 - 18:19
    And even if you didn't solved
    your problem this time
  • 18:19 - 18:21
    and you're still working on it
  • 18:21 - 18:23
    maybe you got a new error message.
  • 18:23 - 18:28
    That's progress and that's
    something to be celebrated
  • 18:30 - 18:32
    Another important part of being a scientist
  • 18:32 - 18:34
    is keeping a good lab notebook
  • 18:34 - 18:36
    and the reason you do this is because
  • 18:36 - 18:40
    it tells the story of your experiences
  • 18:40 - 18:43
    either to you in the future when
    you're going back to look at it
  • 18:43 - 18:45
    or to somebody else
  • 18:45 - 18:48
    maybe another developer in the future
  • 18:48 - 18:51
    So this is the picture of one of my
    lab notebook from grad school.
  • 18:51 - 18:55
    I probably filled about 10 of these
    and they're like 300 pages each
  • 18:55 - 18:59
    So I did a lot of documenting in grad school.
  • 18:59 - 19:01
    The reason I included this is just to say
  • 19:01 - 19:05
    " it's OK to have a paper lab notebook
    and write the things that you're doing
  • 19:05 - 19:09
    That's OK. Digital work also."
  • 19:09 - 19:11
    And the reason you keep
    a lab notebook is because
  • 19:11 - 19:14
    you're just not going to remember it
  • 19:14 - 19:16
    you're not going to remember
  • 19:16 - 19:17
    As a grad student,
  • 19:17 - 19:21
    we probably did about 20 to
    30 experiments a day
  • 19:21 - 19:24
    each just changing one variable at a time.
  • 19:24 - 19:27
    And there's just no way we would've remember
  • 19:27 - 19:29
    all of the things that we tried
  • 19:29 - 19:33
    And think about how many experiments
    you do as a developer each day
  • 19:33 - 19:35
    when you're troubleshooting
  • 19:35 - 19:37
    And maybe you think
  • 19:37 - 19:40
    "OK, well I'm already just
    recording all this stuff in the log.
  • 19:40 - 19:42
    It's all saved over there.
  • 19:42 - 19:44
    I can always go back and look
  • 19:44 - 19:49
    But that's not an sufficient lab notebook
  • 19:49 - 19:53
    Too much information can be just
    as bad as too little information
  • 19:53 - 19:54
    So it's up to you
  • 19:54 - 19:59
    to glean the meaning from
    these experiment that you're doing
  • 19:59 - 20:01
    and record that
  • 20:01 - 20:04
    One of the best first step for
    keeping a good lab notebook
  • 20:04 - 20:07
    is writing a good commit message
  • 20:07 - 20:09
    It's all fresh in your brain
  • 20:09 - 20:12
    and so you can maybe you solve the problem
  • 20:12 - 20:14
    so you can commit that change and push it
  • 20:14 - 20:16
    So write some explanation in that
  • 20:16 - 20:20
    that commit message and let
    people know what's going on
  • 20:20 - 20:22
    and people will see this in the future
  • 20:22 - 20:24
    Either you'll come back and look at it
  • 20:24 - 20:29
    or maybe another developer who's working
    in the codebase will come back and look
  • 20:29 - 20:33
    Additionally , if you added test for
    the scenario that you're working on,
  • 20:33 - 20:36
    that's also a good documentation for what's going on.
  • 20:36 - 20:38
    "OK, this was the the problem.
  • 20:38 - 20:40
    We added a test for it now."
  • 20:42 - 20:44
    Also, right after you solve a problem,
  • 20:44 - 20:46
    you want to update the documentation.
  • 20:46 - 20:48
    Is it missing anything?
  • 20:48 - 20:50
    Did you have that error because
  • 20:50 - 20:53
    the documentation wasn't good enough?
  • 20:53 - 20:55
    So go ahead and go update the README.
  • 20:55 - 20:58
    Or maybe you were missing
    some environment variable
  • 20:58 - 21:02
    Go ahead and set up an example
    environment variable file
  • 21:02 - 21:05
    so people know "Hey, you need this thing."
  • 21:05 - 21:07
    to save them that time
  • 21:07 - 21:09
    So that's all part of good documentation.
  • 21:09 - 21:10
    so keep that
  • 21:10 - 21:13
    Set that up for other people.
  • 21:13 - 21:15
    You can also contribute to open source.
  • 21:15 - 21:21
    So say you find a problem in
    someone else software or gem,
  • 21:21 - 21:23
    go ahead and let them know
  • 21:23 - 21:27
    So open up an issue on Github
    if it doesn't already exist.
  • 21:27 - 21:31
    Let them know the step that
    it takes to recreate this problem.
  • 21:32 - 21:35
    If you were able to write a test for it,
  • 21:35 - 21:38
    go ahead and submit a pull request with that test
  • 21:38 - 21:41
    Sometimes that's helpful even if you
    don't know how to solve the problem.
  • 21:41 - 21:43
    That's helpful for maintainers to say
  • 21:43 - 21:45
    "Oh, this is the test that's failing."
  • 21:45 - 21:46
    And of course,
  • 21:46 - 21:48
    if you do know how how to solve the problem,
  • 21:48 - 21:50
    go ahead and submit a pull request for that
  • 21:50 - 21:52
    You just got some open source contribution
  • 21:52 - 21:54
    and that's awesome
  • 21:55 - 21:59
    You can also write about your experiences
  • 22:00 - 22:03
    Have you ever written something up and then
  • 22:03 - 22:08
    later down the road and you're like
    googling for that same problem
  • 22:08 - 22:10
    and you come back and
    you find your own blog post?
  • 22:11 - 22:12
    Yes. Yes.
  • 22:12 - 22:16
    And you're like "Man,
    thank you so much old me.
  • 22:16 - 22:18
    That was really helpful.
  • 22:18 - 22:20
    Thank you for writing that down."
  • 22:20 - 22:23
    So think about all those other people out there
  • 22:23 - 22:26
    that are getting the same reaction
    when they find your blog post
  • 22:26 - 22:28
    and they're like "Man, that was really helpful blog post.
  • 22:28 - 22:30
    Thank you for writing that down."
  • 22:30 - 22:33
    So if you're not doing this already,
    you should be doing this
  • 22:33 - 22:35
    Anyone can start a blog.
  • 22:35 - 22:38
    If you don't already have one, go start it.
  • 22:40 - 22:42
    You can also write failed experiment.
  • 22:42 - 22:44
    Don't be afraid to do that.
  • 22:44 - 22:48
    In grad school, we always joked about
    starting a journal of failed experiments
  • 22:48 - 22:52
    That way we would publish a million papers that way
  • 22:52 - 22:55
    Like well, these are the million things
    we tried and they didn't work
  • 22:55 - 22:57
    But that's OK. If you...
  • 22:57 - 23:00
    Sometimes that's also helpful
  • 23:00 - 23:04
    and maybe somebody comes along
    and read this and can help you
  • 23:04 - 23:05
    and say "Hey,
  • 23:05 - 23:07
    you might try doing it this way.
  • 23:07 - 23:09
    That might solve your problem."
  • 23:10 - 23:12
    The most important part
  • 23:12 - 23:16
    about keeping a lab notebook
    is sharing the the knowledge
  • 23:16 - 23:18
    In academia, it's all about
  • 23:18 - 23:22
    gaining knowledge and
    then sharing that knowledge
  • 23:22 - 23:25
    either through publication
    or through teaching
  • 23:25 - 23:30
    and I think developers can
    really learn a lot from that
  • 23:30 - 23:32
    So as you're doing these experiments,
  • 23:32 - 23:33
    go ahead and share that information
  • 23:33 - 23:35
    Maybe tweet about it
  • 23:35 - 23:39
    or blog about it, like I said
  • 23:39 - 23:42
    or you can even come and present
    a talk at a conference like this
  • 23:42 - 23:44
    "Hey, here's this weird
    thing that I figured out.
  • 23:44 - 23:46
    Let me tell you about it."
  • 23:47 - 23:50
    So that's really the most important part
  • 23:50 - 23:52
    is sharing that knowledge with other people
  • 23:52 - 23:54
    and teaching it to other people
  • 23:54 - 24:00
    And so I'm really looking forward to
    seeing all of your lab notebooks online.
  • 24:00 - 24:02
    Thanks very much
Title:
GoGaRuCo 2014- The Scientific Method of Troubleshooting
Description:

more » « less
Video Language:
English
Duration:
24:21

English subtitles

Revisions