< Return to Video

RailsConf 2014 - Reading Code Good by Saron Yitbarek

  • 0:17 - 0:18
    SARON YITBAREK: So, hello. My name is Saron.
  • 0:18 - 0:21
    Thank you guys so much for coming to my talk.
  • 0:21 - 0:23
    I'm really, really excited to be here.
  • 0:23 - 0:26
    And as you can tell from the title of this
    talk,
  • 0:26 - 0:28
    grammar is very important to me.
  • 0:28 - 0:30
    So, before we begin, I want to start off
  • 0:30 - 0:34
    by telling you a story. A year ago today,
  • 0:34 - 0:37
    I was not a programmer. This is a, a
  • 0:37 - 0:39
    really big confession that I'm sharing with
    you. A
  • 0:39 - 0:43
    year ago today, I was this chick. I worked
  • 0:43 - 0:47
    at tech startups. I did business development,
    sales, marketing.
  • 0:47 - 0:50
    All of those non-technical roles. And I loved
    it.
  • 0:50 - 0:51
    If you've ever worked at a tech start up,
  • 0:51 - 0:54
    the best part is telling other people that
    you
  • 0:54 - 0:56
    work at a tech start up, because they instantly
  • 0:56 - 0:58
    think you're awesome and cool because you
    are.
  • 0:58 - 1:01
    But I realized, over time, after that honeymoon
    phase
  • 1:01 - 1:05
    was over, that my biggest skill, the best
    thing
  • 1:05 - 1:08
    I had to offer my company, was being able
  • 1:08 - 1:11
    to talk. And that didn't seem very valuable.
    And
  • 1:11 - 1:14
    I was always surrounded by programmers. By
    these tech
  • 1:14 - 1:18
    people who could build beautiful, powerful
    things. And so
  • 1:18 - 1:20
    I found myself always creeping on them and
    looking
  • 1:20 - 1:22
    at what they did and feeling like what they
  • 1:22 - 1:24
    did was so much cooler and so much more
  • 1:24 - 1:26
    interesting than anything I could ever do.
  • 1:26 - 1:29
    So, I quit my job, I started learning how
  • 1:29 - 1:31
    to code. I applied and got accepted to the
  • 1:31 - 1:34
    Flat Iron school, which is a three month programming
  • 1:34 - 1:37
    boot camp. And when we graduated, I was so
  • 1:37 - 1:39
    excited. I could finally build stuff. I could
    make
  • 1:39 - 1:42
    stuff. I was valuable. I could be a contributing
  • 1:42 - 1:46
    member to society, as my mother tells me.
  • 1:46 - 1:49
    And this is actually very important. One thing
    they
  • 1:49 - 1:51
    don't tell you when you graduate from a programming
  • 1:51 - 1:52
    boot camp is that you have to click your
  • 1:52 - 1:56
    heels and hold up a keyboard, otherwise it's
    not
  • 1:56 - 1:57
    official.
  • 1:57 - 1:59
    So I was so proud. I was so excited.
  • 1:59 - 2:01
    I learned all this stuff. I worked really,
    really
  • 2:01 - 2:05
    hard. I'm apparently standing on a rock of
    code
  • 2:05 - 2:08
    stuff that I conquered. But I was also painfully
  • 2:08 - 2:12
    aware of all the other stuff left to learn.
  • 2:12 - 2:14
    So there's the stuff I didn't know. There's
    the
  • 2:14 - 2:16
    stuff I didn't know I didn't know. There was
  • 2:16 - 2:17
    the stuff that I thought I knew, but I
  • 2:17 - 2:19
    forgot, but I didn't know I'd forgotten it
    yet.
  • 2:19 - 2:21
    So that's gonna be a nice surprise in the
  • 2:21 - 2:23
    future. And then, by the way, all the stuff
  • 2:23 - 2:27
    changes all the time. So welcome to programming.
  • 2:27 - 2:29
    And I was painfully aware of how much of
  • 2:29 - 2:31
    a novice I was. And this is the novice
  • 2:31 - 2:34
    track, so hopefully this applies to you too.
    And
  • 2:34 - 2:37
    this actually describes Dreyfus, or Dreyfus's
    Model of Skill
  • 2:37 - 2:40
    Acquisition, that says that when you start
    at zero,
  • 2:40 - 2:42
    when you start a new skill, you start at
  • 2:42 - 2:44
    the novice level. You move up over time to
  • 2:44 - 2:47
    an advanced beginner. Then you go on to confident,
  • 2:47 - 2:49
    proficient, and hopefully an expert.
  • 2:49 - 2:51
    And so, I don't want to be a novice.
  • 2:51 - 2:52
    I don't think anyone here wants to be a
  • 2:52 - 2:54
    novice. That's not fun. I want to be an
  • 2:54 - 2:56
    expert. And I want that cape. That's who I
  • 2:56 - 2:59
    want to be. So I started asking people and
  • 2:59 - 3:01
    did some research on, how can I become an
  • 3:01 - 3:04
    expert? How can I go from this poor novice
  • 3:04 - 3:06
    person who kind of sort of thinks she knows
  • 3:06 - 3:08
    what she's doing to, like, that cape-wearing
    expert. How
  • 3:08 - 3:10
    do I do that?
  • 3:10 - 3:12
    And the most popular answer I got was reading
  • 3:12 - 3:14
    code. Which is both really helpful but also
    not
  • 3:14 - 3:17
    very helpful. Because that leads to all these
    other
  • 3:17 - 3:18
    questions, like, what code do I read? How
    often
  • 3:18 - 3:21
    do I read it? And the best way to
  • 3:21 - 3:24
    start an adventure is to start it with friends.
  • 3:24 - 3:26
    So these are my friends. I think I drew
  • 3:26 - 3:29
    them very flatteringly. And so these are some
    of
  • 3:29 - 3:31
    my programming buddies from the Flat Iron
    school, and
  • 3:31 - 3:35
    I got them together and I said, yo. If
  • 3:35 - 3:37
    you get programming people together to start
    a code
  • 3:37 - 3:39
    reading club, you have to start the conversation
    with
  • 3:39 - 3:41
    yo. Otherwise it just won't work.
  • 3:41 - 3:47
    So I said, yo, we should read code together.
  • 3:47 - 3:48
    And so we decided that we were gonna dedicate
  • 3:48 - 3:52
    one hour every single Sunday at 11 AM. By
  • 3:52 - 3:54
    the way, this is a huge deal for me.
  • 3:54 - 3:56
    I don't wake up before two on a weekend.
  • 3:56 - 3:59
    So I'm, I'm already winning just by declaring
    that
  • 3:59 - 4:00
    this might happen.
  • 4:00 - 4:02
    And so we decided that we're gonna make this
  • 4:02 - 4:06
    a regular thing. And we decided to call it
  • 4:06 - 4:09
    Code Club. Because we are creative geniuses.
  • 4:09 - 4:11
    So the first question was what code should
    we
  • 4:11 - 4:13
    read? And we did some research. We asked,
    you
  • 4:13 - 4:15
    know, the mentors and senior developers that
    we knew.
  • 4:15 - 4:18
    We said, what would be a great starting point
  • 4:18 - 4:20
    for a novice to start reading code? And they
  • 4:20 - 4:22
    said, you should read anything.
  • 4:22 - 4:24
    This is not helpful. Please do not answer
    in
  • 4:24 - 4:26
    this way if someone asks you, where do you
  • 4:26 - 4:29
    start? And so we came up with our own
  • 4:29 - 4:32
    rules. We decided that the point of reading
    code
  • 4:32 - 4:36
    was to find code that we thought was inspirational
  • 4:36 - 4:38
    and would be great examples. So we decided
    that
  • 4:38 - 4:42
    whatever we read, it was gonna be exemplary
    code.
  • 4:42 - 4:45
    And we defined exemplary as having four attributes.
    We
  • 4:45 - 4:47
    said that one, it had to be somewhat popular.
  • 4:47 - 4:50
    Something that was well-used. Something that
    was endorsed by
  • 4:50 - 4:53
    the, the developer community. Something that
    hopefully was well-documented,
  • 4:53 - 4:55
    so that if we got stuck we wanted somewhere
  • 4:55 - 4:56
    to go to.
  • 4:56 - 4:59
    Third, it should be well-written, and four
    it should
  • 4:59 - 5:01
    be well-maintained. So knowing that it had,
    you know,
  • 5:01 - 5:04
    recent commits and people were still keeping,
    you know,
  • 5:04 - 5:08
    maintaining it was really important to us.
  • 5:08 - 5:10
    And we thought that if we did this, we
  • 5:10 - 5:13
    studied our exemplary code and read every
    Sunday, we
  • 5:13 - 5:16
    were gonna go from novice programmers to bad
    ass
  • 5:16 - 5:20
    experts. So, the one suggestion that I actually
    did
  • 5:20 - 5:23
    get from a much more senior person than I,
  • 5:23 - 5:25
    said, why don't you start with Sinatra? You've
    done
  • 5:25 - 5:27
    Sinatra. You know it. You're kind of familiar
    with
  • 5:27 - 5:29
    it. So we said, great. We'll start with the
  • 5:29 - 5:32
    get method, which is something that I never
    really
  • 5:32 - 5:34
    understood.
  • 5:34 - 5:38
    And so we gathered on the Google, and we
  • 5:38 - 5:39
    got together and we said, we're gonna get
    through
  • 5:39 - 5:41
    the get method. The get method in one hour?
  • 5:41 - 5:43
    Totally doable. If you've seen the get method
    in
  • 5:43 - 5:45
    Sinatra, I think it's like seven lines of
    code,
  • 5:45 - 5:48
    which sounds perfectly doable. No. This is
    a trick.
  • 5:48 - 5:50
    This is a huge lie.
  • 5:50 - 5:52
    Because every single line is completely abstracted
    code, and
  • 5:52 - 5:54
    you have to go through all these other files
  • 5:54 - 5:55
    to find out what they're doing, and then they
  • 5:55 - 5:57
    have more abstracted code. Then you go to
    other
  • 5:57 - 6:00
    files, and it became just one rabbit hole
    after
  • 6:00 - 6:02
    another. And we found that we really got nowhere
  • 6:02 - 6:04
    with it. And so we went from being really
  • 6:04 - 6:07
    excited to completely overwhelmed.
  • 6:07 - 6:11
    So, I'm a really, really big believer in retros.
  • 6:11 - 6:14
    I like taking the opportunity to reflect on
    what
  • 6:14 - 6:16
    I just did, especially if it's something that
    I'm
  • 6:16 - 6:18
    doing for the very first time. So, at the
  • 6:18 - 6:21
    end of the very first Code Club session, we
  • 6:21 - 6:25
    paused and we said, how was this experience,
    on
  • 6:25 - 6:28
    an individual level? How did each person feel?
  • 6:28 - 6:31
    What did we learn? And most importantly, how
    can
  • 6:31 - 6:33
    we improve? The idea was to keep this going
  • 6:33 - 6:35
    every week, so what can we do to make
  • 6:35 - 6:38
    sure that the next time we do this, we
  • 6:38 - 6:40
    learn a ton?
  • 6:40 - 6:42
    And the first and most important part about
    the
  • 6:42 - 6:46
    code-reading experience, is to pick a manageable
    code base.
  • 6:46 - 6:49
    It was very, very disappointing, and a huge
    hit
  • 6:49 - 6:50
    to our ego, to know that we couldn't even
  • 6:50 - 6:52
    figure out a get method, that started out
    looking
  • 6:52 - 6:54
    like just seven lines of code.
  • 6:54 - 6:56
    And so, picking something that is manageable,
    that is
  • 6:56 - 6:59
    digestible, that you can actually get through
    and understand
  • 6:59 - 7:01
    is really, really important. This is the first
    guideline
  • 7:01 - 7:04
    of having your own code club, and definitely
    the
  • 7:04 - 7:05
    most important.
  • 7:05 - 7:08
    So we decided that, for us, one hundred lines
  • 7:08 - 7:10
    of code was the great limit. And it was
  • 7:10 - 7:13
    a pretty arbitrary number, but it ended up
    being
  • 7:13 - 7:16
    perfect. Because what happened was, in that
    hundred lines
  • 7:16 - 7:18
    of code, you have just enough that you can
  • 7:18 - 7:20
    complete a full gem or library. And that's
    a
  • 7:20 - 7:22
    great accomplishment. Being able to say, hey,
    I read
  • 7:22 - 7:24
    through this whole thing and I finished it?
    Even
  • 7:24 - 7:26
    if you didn't understand it, you feel really
    good
  • 7:26 - 7:27
    about yourself.
  • 7:27 - 7:29
    Second, it gives you the amount of time and
  • 7:29 - 7:32
    flexibility to stop and comfortably ask questions.
    So if
  • 7:32 - 7:35
    there's something you haven't seen before,
    you can say,
  • 7:35 - 7:36
    hey, can we slow down? Cause I, I don't
  • 7:36 - 7:39
    really get this. Can someone explain it to
    me?
  • 7:39 - 7:40
    And you don't feel like you're slowing anyone
    else
  • 7:40 - 7:41
    down.
  • 7:41 - 7:44
    Second, you have the opportunity to try things.
    One
  • 7:44 - 7:46
    of my favorite parts about reading code is
    finding
  • 7:46 - 7:48
    new methods that I haven't seen before, or
    maybe
  • 7:48 - 7:50
    finding methods that I haven't seen in a long
  • 7:50 - 7:53
    time. And so being able to stop the session
  • 7:53 - 7:54
    and say, can we open up IRB and just
  • 7:54 - 7:56
    play with this and see how this works is
  • 7:56 - 7:58
    really, really valuable.
  • 7:58 - 8:00
    And the third thing was research topics. So
    there
  • 8:00 - 8:03
    were always patterns that we've seen that
    look kind
  • 8:03 - 8:05
    of familiar, that we've seen in other places.
    Being
  • 8:05 - 8:08
    able to stop and look things up on StackOverflow
  • 8:08 - 8:10
    or just Google was a really great opportunity.
    And
  • 8:10 - 8:14
    so with that limit, limited code base, we're
    able
  • 8:14 - 8:18
    to do these things while also getting through
    code.
  • 8:18 - 8:20
    Which brings me to the second really, really
    important
  • 8:20 - 8:23
    part about reading code. It's not really about
    reading
  • 8:23 - 8:25
    the code. Reading the code is just the starting
  • 8:25 - 8:27
    point. All these other things that I mentioned,
    the
  • 8:27 - 8:28
    parts where you kind of get off track and
  • 8:28 - 8:31
    you kind of digress and you have conversations.
    Those
  • 8:31 - 8:34
    are the things that matter. That's the real
    value
  • 8:34 - 8:35
    in reading code.
  • 8:35 - 8:39
    So, the learning happens in these digressions.
    In these
  • 8:39 - 8:42
    conversations. I am very, very sensitive to
    getting off
  • 8:42 - 8:44
    track and making sure that everything I do
    is
  • 8:44 - 8:46
    very focused, so this is a little bit difficult
  • 8:46 - 8:48
    for me. But over time, I got to see
  • 8:48 - 8:51
    a lot of value in it.
  • 8:51 - 8:53
    The third thing is that it's a team effort.
  • 8:53 - 8:54
    Do not go at this alone. It will be
  • 8:54 - 8:56
    very painful and you will not have a good
  • 8:56 - 8:59
    time. So knowing that I had other people that
  • 8:59 - 9:02
    were about my same level and that, you know,
  • 9:02 - 9:03
    we knew what we knew and we knew what
  • 9:03 - 9:06
    we didn't know, made it really, really easy
    to
  • 9:06 - 9:08
    start on this journey and to keep going.
  • 9:08 - 9:10
    It's really important to make sure that everyone
    you
  • 9:10 - 9:13
    do this with feels comfortable enough to raise
    their
  • 9:13 - 9:14
    hand and say, can we stop here? I don't
  • 9:14 - 9:16
    quite get that. Or, I know you just said
  • 9:16 - 9:17
    that, but can you say it a different way,
  • 9:17 - 9:19
    because it didn't make sense to me the first
  • 9:19 - 9:19
    time.
  • 9:19 - 9:22
    So it's really important that everyone is
    comfortable, that
  • 9:22 - 9:26
    everyone is engaged, and in order to do that,
  • 9:26 - 9:27
    we find it very helpful to have a tour
  • 9:27 - 9:30
    guide. So every week we trade off, and we
  • 9:30 - 9:32
    have one person lead the conversation. This
    is just
  • 9:32 - 9:34
    one person to say, hey, we're gonna start
    on
  • 9:34 - 9:37
    line two. We're gonna keep going. Stephanie
    do you
  • 9:37 - 9:38
    have a question? Dan, what do you think about
  • 9:38 - 9:40
    this? Ian, have you seen this before? And
    having
  • 9:40 - 9:43
    someone stop at all the right places, make
    sure
  • 9:43 - 9:46
    everyone is engaged and excited is a really
    important
  • 9:46 - 9:48
    part of this journey.
  • 9:48 - 9:51
    So we found, very quickly, that finding exemplary
    code
  • 9:51 - 9:54
    that's only a hundred lines is very, very
    difficult.
  • 9:54 - 9:56
    I think we ran out after a couple of
  • 9:56 - 9:59
    weeks. And so, out of necessity, we had to
  • 9:59 - 10:01
    kind of lower our standards. We had to say,
  • 10:01 - 10:03
    the most important part is really that we
    finish
  • 10:03 - 10:05
    getting through the code base, so we're gonna,
    you
  • 10:05 - 10:08
    know, not worry about whether it's well-maintained
    or well-written.
  • 10:08 - 10:11
    We're just gonna find code that's a hundred
    lines.
  • 10:11 - 10:14
    And this ended up being a really great thing.
  • 10:14 - 10:16
    So one day, the very first week that we
  • 10:16 - 10:19
    decided to lower our standards, we were looking
    at
  • 10:19 - 10:21
    a method that we didn't really think was very
  • 10:21 - 10:26
    well-written. And Dan said, this method sucks.
    How would
  • 10:26 - 10:27
    we write it?
  • 10:27 - 10:29
    And he gave us our very first point of
  • 10:29 - 10:32
    interaction. And that's the fifth guide line,
    is to
  • 10:32 - 10:35
    find these opportunities to interact with
    the code. Because
  • 10:35 - 10:37
    in him asking that one question, it lead to
  • 10:37 - 10:41
    a very interesting conversation. One, about
    what the intent
  • 10:41 - 10:43
    was. What was the point of that method? What
  • 10:43 - 10:44
    was it doing?
  • 10:44 - 10:47
    Two, why was it written that way? Was it
  • 10:47 - 10:49
    because the developer had a certain style?
    Was it
  • 10:49 - 10:51
    because it was a fork from a different gem
  • 10:51 - 10:53
    and they were just kind of, you know, maintaining
  • 10:53 - 10:56
    that, that writing style stylistically? And
    how does it
  • 10:56 - 10:58
    fit in to the overall design and architecture
    of
  • 10:58 - 11:00
    the entire code base? Did this one stand out
  • 11:00 - 11:02
    as being worse than the other ones? Or did
  • 11:02 - 11:05
    it just kind of follow the general pattern?
  • 11:05 - 11:08
    And so, these questions were awesome, because
    now it's
  • 11:08 - 11:10
    not just about reading code, it's about going
    on
  • 11:10 - 11:12
    a little adventure. We got to pretend that
    we
  • 11:12 - 11:15
    were the developer, and we were the ones that,
  • 11:15 - 11:17
    that were building this code and connecting
    what we
  • 11:17 - 11:20
    knew, in our world and in our workplace, to
  • 11:20 - 11:23
    this specific situation. So having that moment
    of interaction
  • 11:23 - 11:26
    really changed the game for us.
  • 11:26 - 11:29
    So, this leads to the sixth point, which is,
  • 11:29 - 11:31
    it doesn't have to be exemplary. Actually,
    reading bad
  • 11:31 - 11:33
    code is awesome. Because the fact that you
    get
  • 11:33 - 11:35
    to say, as a novice, that this is bad
  • 11:35 - 11:37
    code, and you get to, like, you know, have
  • 11:37 - 11:39
    an opinion on someone else's work, you feel
    really
  • 11:39 - 11:43
    good about that. It makes you feel fairly
    adequate.
  • 11:43 - 11:45
    And so it doesn't have to be exemplary. It
  • 11:45 - 11:46
    can be really bad, and you can learn a
  • 11:46 - 11:49
    lot from that as well.
  • 11:49 - 11:53
    So, everything was going swimmingly. It was
    going awesome.
  • 11:53 - 11:55
    And then one day, we encountered a gem that
  • 11:55 - 11:58
    talked about rack middleware. And in that
    conversation, Dan,
  • 11:58 - 12:01
    who comes up with awesome things to say, says,
  • 12:01 - 12:03
    guys, I don't think I really understand how
    rack
  • 12:03 - 12:06
    middleware works. And we said, Dan, it's,
    it's obvious.
  • 12:06 - 12:08
    This is how it works. And then we realized
  • 12:08 - 12:11
    that none of us really knew how it worked.
  • 12:11 - 12:14
    And in that conversation, we found a knowledge
    gap.
  • 12:14 - 12:16
    We found this, this thing that we thought
    we
  • 12:16 - 12:18
    understood, that at one point we did understand,
    but
  • 12:18 - 12:21
    we'd just forgotten about. So the following
    week, instead
  • 12:21 - 12:24
    of doing our regular code review session where
    we
  • 12:24 - 12:27
    just read through the code, we, instead, took
    a
  • 12:27 - 12:29
    break. We did some research on what rack middleware
  • 12:29 - 12:31
    was, how it worked, when you'd modify it,
    what
  • 12:31 - 12:33
    you do with it. We watched a few RailsCast
  • 12:33 - 12:35
    videos, did some, you know, looked at some
    blog
  • 12:35 - 12:38
    posts. And the following week, we shared that
    knowledge
  • 12:38 - 12:39
    together.
  • 12:39 - 12:41
    So we had a much higher-level conversation,
    but it
  • 12:41 - 12:44
    just emphasizes the fact that it's not really
    about
  • 12:44 - 12:46
    reading code. It's about reading code that's
    a launching
  • 12:46 - 12:51
    point for more interesting conversation.
  • 12:51 - 12:52
    The eighth thing is you gotta keep at it.
  • 12:52 - 12:54
    So, I've never told my code club this, and
  • 12:54 - 12:57
    they're gonna find out, which is awesome.
    But I
  • 12:57 - 12:58
    thought it was kind of a chore. It really
  • 12:58 - 13:01
    wasn't fun at first. It wasn't that exciting.
    It
  • 13:01 - 13:02
    was something that I felt like I had to
  • 13:02 - 13:04
    do. I don't like waking up in the morning
  • 13:04 - 13:06
    on a Sunday. So it was really something that
  • 13:06 - 13:08
    I had to force myself to do. But over
  • 13:08 - 13:10
    time is when I saw the value. I was
  • 13:10 - 13:12
    really looking forward to that first code
    reading session,
  • 13:12 - 13:15
    when it ended and I said, yeah, I'm now,
  • 13:15 - 13:16
    like, ten steps closer to being an expert.
  • 13:16 - 13:18
    But that's not how it works. It really takes
  • 13:18 - 13:20
    time to get the value from it. So keep
  • 13:20 - 13:22
    at it long enough and hopefully you'll see
    the
  • 13:22 - 13:25
    value as well.
  • 13:25 - 13:29
    So everything was going swimmingly again,
    and then we
  • 13:29 - 13:31
    read the omniauth-meetup gem. So right now
    I'm a
  • 13:31 - 13:34
    developer for the New York tech meetup. Yes,
    it's
  • 13:34 - 13:36
    a meetup group. Yes. This is a real job.
  • 13:36 - 13:39
    And there we use the omniauth-meetup gem to
    authenticate
  • 13:39 - 13:43
    our members. And this is something that was
    very
  • 13:43 - 13:45
    interesting, because it was very unexpected
    for me.
  • 13:45 - 13:47
    For me, I read code because I felt like
  • 13:47 - 13:48
    that's what I had to do to be a
  • 13:48 - 13:51
    better programmer. That's what everyone told
    me to do.
  • 13:51 - 13:53
    But when I looked at a gem that I
  • 13:53 - 13:56
    found personally interesting and personally
    relevant, it made the
  • 13:56 - 13:59
    whole thing so much more exciting. Cause I
    use
  • 13:59 - 14:00
    that gem. I used it all the time. I
  • 14:00 - 14:02
    knew what it was supposed to do. I knew
  • 14:02 - 14:04
    it wasn't, what it wasn't supposed to do,
    and
  • 14:04 - 14:05
    having the opportunity to look under the hood
    and
  • 14:05 - 14:08
    see how it did it got me really, really
  • 14:08 - 14:09
    excited.
  • 14:09 - 14:11
    And so the ninth guideline is to find interesting
  • 14:11 - 14:14
    code bases. Things on topics or problems that
    maybe
  • 14:14 - 14:17
    you've had. Things that you've worked on before.
    That
  • 14:17 - 14:20
    makes it a whole lot more interesting.
  • 14:20 - 14:22
    And then there are the unexpected benefits.
    Things that
  • 14:22 - 14:26
    I really didn't consider at all. The first
    is
  • 14:26 - 14:28
    that, you get to explore the organization
    of the
  • 14:28 - 14:31
    code base. So we really focused on reading,
    literally,
  • 14:31 - 14:33
    the lines of code. But just as interesting
    was
  • 14:33 - 14:35
    the file structure, was, what are the folders
    called?
  • 14:35 - 14:37
    And what are the files named? And how do
  • 14:37 - 14:38
    we work together?
  • 14:38 - 14:40
    And we got the opportunity to see that and
  • 14:40 - 14:42
    get exposed to that from all different types
    of
  • 14:42 - 14:45
    gems and libraries. The second was, you get
    to
  • 14:45 - 14:49
    really see how collaborative code is. When
    you start
  • 14:49 - 14:51
    as a programmer, people tell you that open
    source
  • 14:51 - 14:53
    is amazing and this beautiful thing, where
    people from
  • 14:53 - 14:56
    all over the world collaborate and build great
    things
  • 14:56 - 14:58
    together. But when you actually see it for
    yourself
  • 14:58 - 15:00
    and you see that that gem that you love
  • 15:00 - 15:02
    is really just a fork from this other gem
  • 15:02 - 15:04
    and really this gem is dependent on all these
  • 15:04 - 15:06
    other things that you didn't think would ever
    have
  • 15:06 - 15:08
    a connection, that's really powerful. And
    it makes the
  • 15:08 - 15:12
    whole thing so much more beautiful.
  • 15:12 - 15:14
    And the third, and honestly the most important
    one,
  • 15:14 - 15:16
    especially as a novice, is it's a great opportunity
  • 15:16 - 15:19
    to build your confidence. I didn't fully appreciate
    how
  • 15:19 - 15:22
    intimidating it was to open up source code
    until
  • 15:22 - 15:24
    I had to do it for Code Club. Cause
  • 15:24 - 15:26
    that first day, when I said, guys we're really
  • 15:26 - 15:28
    gonna open up this gem and try to understand
  • 15:28 - 15:30
    what's going on. And I think it was maybe
  • 15:30 - 15:32
    a month and a half into doing this, so
  • 15:32 - 15:34
    it's been about, like, six code clubs at this
  • 15:34 - 15:37
    point, or at that point, when I was at
  • 15:37 - 15:38
    work and I wanted to know how this gem
  • 15:38 - 15:40
    worked, I just opened it up. I didn't even
  • 15:40 - 15:42
    think twice about it. Because by that point,
    it'd
  • 15:42 - 15:44
    become such a habit. It had become so normal
  • 15:44 - 15:47
    to look into how things worked. And having
    that
  • 15:47 - 15:50
    frame of mind and that mindset is really,
    really
  • 15:50 - 15:52
    important. It really makes you feel a lot
    more
  • 15:52 - 15:53
    competent.
  • 15:53 - 15:56
    So, obviously by now, I have fully convinced
    you
  • 15:56 - 15:58
    that you do want to start your own code
  • 15:58 - 15:59
    club. But you can't call it code club cause
  • 15:59 - 16:01
    I called that. So you have to find out
  • 16:01 - 16:03
    your own name. But I wanted to review the
  • 16:03 - 16:04
    guidelines.
  • 16:04 - 16:06
    So the first is, manageable code base. For
    us,
  • 16:06 - 16:08
    it was a hundred lines of code. If you
  • 16:08 - 16:11
    feel like that's too low for you, definitely
    raise
  • 16:11 - 16:13
    the stakes, but I think having a limit is
  • 16:13 - 16:14
    very important.
  • 16:14 - 16:18
    Two. Understanding that the learning really
    does happen in
  • 16:18 - 16:21
    the digressions and in the conversations.
  • 16:21 - 16:23
    Three, that it's a team effort. Make sure
    you
  • 16:23 - 16:25
    go at it with other people, and make sure
  • 16:25 - 16:27
    that you check in and see that everyone is
  • 16:27 - 16:31
    engaged and just as excited and hopefully
    you are.
  • 16:31 - 16:33
    Four, to pick a tour guide, to take turns
  • 16:33 - 16:35
    and have someone lead the conversations. It's
    also a
  • 16:35 - 16:38
    great opportunity for people to lead and kind
    of
  • 16:38 - 16:39
    feel like they're, they're taking charge as
    well. It's
  • 16:39 - 16:43
    a different type of confidence booster.
  • 16:43 - 16:45
    Five, to find those moments when you can interact
  • 16:45 - 16:47
    with the code, where you can say, how would
  • 16:47 - 16:49
    I do that? How do I feel about that?
  • 16:49 - 16:51
    Even asking that question of, what do you
    think
  • 16:51 - 16:53
    of this code and having an opinion is very,
  • 16:53 - 16:54
    very powerful.
  • 16:54 - 16:57
    Six, it doesn't have to be good. You can
  • 16:57 - 16:59
    learn just as much from bad code as you
  • 16:59 - 17:01
    can from good code.
  • 17:01 - 17:04
    Seven, find those knowledge gaps and find
    a way
  • 17:04 - 17:06
    to fill them. And hopefully fill them together.
  • 17:06 - 17:09
    Finally, to, to keep at it and make sure
  • 17:09 - 17:10
    that this is a habit, it's something you do
  • 17:10 - 17:12
    on a weekly basis or a monthly basis.
  • 17:12 - 17:14
    And finally to find interesting code bases.
    You're gonna
  • 17:14 - 17:17
    find the experience much more enjoyable.
  • 17:17 - 17:21
    So, the question that I had, every single
    week,
  • 17:21 - 17:23
    was, how does this get me to an expert?
  • 17:23 - 17:25
    I wanted to feel that moment where I said,
  • 17:25 - 17:28
    yes, now I am so much closer, and I
  • 17:28 - 17:32
    can feel myself growing and getting that cape,
    finally.
  • 17:32 - 17:34
    And it didn't really happen quite that way.
    That
  • 17:34 - 17:37
    transformation wasn't quite as visible and
    as tangible as
  • 17:37 - 17:39
    I would have liked it to be. And so,
  • 17:39 - 17:41
    I thought a lot about why. I thought a
  • 17:41 - 17:43
    lot about, if I can't feel the change in
  • 17:43 - 17:46
    a very tangible, physical way, how do I know
  • 17:46 - 17:48
    that I'm becoming an expert?
  • 17:48 - 17:51
    And I found this really great infographic
    on Twitter
  • 17:51 - 17:54
    a couple months ago that I repurposed for
    my
  • 17:54 - 17:58
    own agenda, that I think really explains the
    process
  • 17:58 - 18:00
    and the result.
  • 18:00 - 18:02
    So this is what information looks like. It
    looks
  • 18:02 - 18:05
    like Skittles. And information is just all
    these little
  • 18:05 - 18:09
    data points that are separate and isolated,
    that happen
  • 18:09 - 18:11
    to kind of relate and, just by being in
  • 18:11 - 18:13
    the same bucket.
  • 18:13 - 18:15
    And then eventually, you're able to connect
    these little
  • 18:15 - 18:18
    dots, and you're able to have knowledge. And
    knowledge
  • 18:18 - 18:21
    is being able to tell a story. Being able
  • 18:21 - 18:23
    to say, I can start from that yellow skittle
  • 18:23 - 18:25
    in the corner, and if I go right, I
  • 18:25 - 18:26
    can get to that green one, and then I
  • 18:26 - 18:29
    go, shoom, go all the way down to orange,
  • 18:29 - 18:30
    and then if I make a left, or, a
  • 18:30 - 18:33
    right I'm at green. And then if I make
  • 18:33 - 18:34
    a right again, I'm at red. And that's how
  • 18:34 - 18:36
    I get from yellow to red.
  • 18:36 - 18:40
    It's understanding that, that path.
  • 18:40 - 18:42
    And then wisdom is saying, you know what,
    I
  • 18:42 - 18:43
    don't need to go through all those skittles.
    I
  • 18:43 - 18:45
    can just go straight from yellow to red if
  • 18:45 - 18:46
    I make my own path. And you know, I
  • 18:46 - 18:48
    don't even need that path to be straight.
    It's
  • 18:48 - 18:50
    gonna be all straight, cause I'm a rebel.
  • 18:50 - 18:52
    And so, this was kind of the journey of
  • 18:52 - 18:55
    reading code together. The information and
    all those little
  • 18:55 - 18:57
    data points come from all the code bases that
  • 18:57 - 18:58
    you get to read, from all the things that
  • 18:58 - 19:01
    you're exposed to that you've never seen before.
  • 19:01 - 19:03
    Those points where things connect and you
    have knowledge
  • 19:03 - 19:06
    and you have these stories and these paths,
    that
  • 19:06 - 19:09
    comes from having really good code reading
    sessions. That
  • 19:09 - 19:11
    comes from working with other people who give
    you
  • 19:11 - 19:14
    their input, from asking those questions that
    you're gonna
  • 19:14 - 19:17
    ask that are very insightful, and it also
    comes
  • 19:17 - 19:20
    from leveraging everyone else's experiences.
    So when I go
  • 19:20 - 19:22
    to work and I use a gem, I can
  • 19:22 - 19:23
    say, hey, I've seen this before.
  • 19:23 - 19:25
    When Dan goes to work and, and uses a
  • 19:25 - 19:27
    specific method, he can say, I've done that
    before.
  • 19:27 - 19:30
    And, in doing that, we're finding all these
    connections
  • 19:30 - 19:32
    that would have been way harder to find on
  • 19:32 - 19:33
    our own.
  • 19:33 - 19:35
    And then, finally, we'll be able to see that,
  • 19:35 - 19:38
    of all that noise, of all those patterns and
  • 19:38 - 19:41
    designs and concepts and all those lines of
    code,
  • 19:41 - 19:42
    the ones that we really care about are just
  • 19:42 - 19:44
    yellow and red. And those are the ones that
  • 19:44 - 19:46
    keep popping out, over and over again, over
    time.
  • 19:46 - 19:48
    And eventually we have wisdom and we're much
    closer
  • 19:48 - 19:51
    to being experts.
  • 19:51 - 19:54
    So, these are just a handful of the code
  • 19:54 - 19:57
    bases that we've read. If you're interested
    in looking
  • 19:57 - 19:58
    at them. I think most of them are about
  • 19:58 - 20:00
    a hundred lines. I think one or two may
  • 20:00 - 20:02
    be a little bit bigger. But take a look,
  • 20:02 - 20:04
    and I'd love to hear kind of your stories
  • 20:04 - 20:06
    and see what you get from that.
  • 20:06 - 20:09
    That is my website, bloggytoons dot com slash
    code-club.
  • 20:09 - 20:11
    There's a page that has links to all of
  • 20:11 - 20:15
    these gems and a few other ones as well.
  • 20:15 - 20:17
    That's the end. That's my handle. I pretty
    much
  • 20:17 - 20:19
    Tweet, like, mostly about programming and,
    like, cake. So
  • 20:19 - 20:23
    you've been warned. But, and that's the website
    again.
  • 20:23 - 20:25
    So I think that's pretty much it. Any questions?
Title:
RailsConf 2014 - Reading Code Good by Saron Yitbarek
Description:

more » « less
Video Language:
English
Duration:
20:53

English subtitles

Revisions