< Return to Video

RailsConf 2014 - Living Social Lightning Talks

  • 0:18 - 0:21
    ??: Hi everyone. So we're gonna do,
  • 0:21 - 0:23
    we're at Living Social.
  • 0:23 - 0:28
    We build this consumer marketing platform.
  • 0:28 - 0:30
    We, you go to LivingSocial dot com and
  • 0:30 - 0:32
    it looks like it's just deals.
  • 0:32 - 0:34
    I know it's small and boring.
  • 0:34 - 0:35
    But there's like, actually a phenomenal
  • 0:35 - 0:38
    amount of stuff under the water line.
  • 0:38 - 0:41
    We have, most of our apps are written
  • 0:41 - 0:43
    in Ruby and Rails. But we also have teams
  • 0:43 - 0:48
    working in Clojure, Scala. I almost said SmallTalk.
  • 0:48 - 0:53
    That would be a lie. iOS, like native iOS,
  • 0:53 - 0:57
    native Android, big data stuff, operations.
  • 0:57 - 1:01
    All sorts of stuff. So there's tons of interesting,
  • 1:01 - 1:04
    wei- like, big problems that we come upon.
  • 1:04 - 1:06
    And we're gonna do a few lightning talks on
  • 1:06 - 1:08
    those technical things, and then also a
  • 1:08 - 1:13
    few on how we operate as a distributed team,
  • 1:13 - 1:16
    and how we just operate as developers.
  • 1:16 - 1:20
    So, the first person that's gonna speak to
    you
  • 1:20 - 1:22
    is Ed Weng. He's a, he's a graduate from
  • 1:22 - 1:24
    our Hungry Academy training program,
  • 1:24 - 1:27
    where we pull basically just, like,
  • 1:27 - 1:29
    thirty random people off the streets.
  • 1:29 - 1:32
    No. They, they, it was not,
  • 1:32 - 1:33
    we did not press gang them.
  • 1:33 - 1:36
    We, they applied, we put them through a,
  • 1:36 - 1:37
    was it nine weeks? Nine, nine months?
  • 1:37 - 1:37
    ED WENG: Six months.
  • 1:37 - 1:37
    ??: Six months.
  • 1:37 - 1:40
    E.W.: I don't know where you got nine weeks.
  • 1:40 - 1:43
    ??: Nine. It was some number of months. It
  • 1:43 - 1:46
    was six months. They did a really intensive
    training
  • 1:46 - 1:53
    program, and are all really amazing developers.
    And so
  • 1:53 - 1:55
    he's a Hungry Academy grad. He works on our
  • 1:55 - 2:01
    mobile consumer apps and if you meet him later,
  • 2:01 - 2:03
    ask him about his pen pal. So this is
  • 2:03 - 2:04
    Ed.
  • 2:04 - 2:08
    E.W.: Hey guys.
  • 2:08 - 2:09
    [applause]
  • 2:09 - 2:12
    So, so my name is Ed Weng, and what
  • 2:12 - 2:14
    I'm gonna talk to you today is about sharing
  • 2:14 - 2:17
    templates in a service-oriented architecture.
  • 2:17 - 2:21
    Cool. So, if you've never been to our site
  • 2:21 - 2:22
    before, if you go to LivingSocial dot com,
    this
  • 2:22 - 2:25
    is the page that you land on. And to
  • 2:25 - 2:29
    give you some context about our architecture,
    about two
  • 2:29 - 2:31
    and a half, three years ago, we were still
  • 2:31 - 2:33
    a monolithic Rails app, right. So everything
    was inside
  • 2:33 - 2:36
    this one gigantic Rails app.
  • 2:36 - 2:38
    Since then, we've been working very hard to
    kind
  • 2:38 - 2:41
    of break things out into smaller micro services.
    So
  • 2:41 - 2:44
    if you come to this page, this is actually
  • 2:44 - 2:46
    in an app that we call browse, and browse
  • 2:46 - 2:50
    is responsible for surfacing the browse experience
    to our
  • 2:50 - 2:50
    customers.
  • 2:50 - 2:54
    So, you can see some of the deals on,
  • 2:54 - 2:56
    on our site. If you click on, let's say,
  • 2:56 - 2:59
    the Audible deal, you actually get taken to
    a
  • 2:59 - 3:01
    page that looks like this. So, most of our
  • 3:01 - 3:03
    users won't be able to tell, but they actually
  • 3:03 - 3:06
    just left the browse app, and now they're
    in
  • 3:06 - 3:09
    an app that we call sponsors. So, sponsors
    is
  • 3:09 - 3:12
    responsible for surfacing deals that are sponsored.
    So this
  • 3:12 - 3:14
    deal is sponsored by Audible dot com, hence
    its
  • 3:14 - 3:18
    free. And let's say a user then decides to
  • 3:18 - 3:21
    click on this tab up on the top. The
  • 3:21 - 3:22
    shop tab.
  • 3:22 - 3:26
    They'd get taken to here. And this app, again,
  • 3:26 - 3:28
    is not the sponsors app anymore. It's an app
  • 3:28 - 3:31
    that we call products, and products is responsible
    for
  • 3:31 - 3:34
    surfacing physical goods that we sell to our
    customers.
  • 3:34 - 3:36
    So, if we were to look back at the
  • 3:36 - 3:38
    last three slides I just showed you, and I
  • 3:38 - 3:39
    were to ask you, what is the one common
  • 3:39 - 3:42
    thing that appears on all three slides? You
    might
  • 3:42 - 3:46
    say it's the nav bar. And you'd be correct.
  • 3:46 - 3:48
    One of the things that we kind of discovered
  • 3:48 - 3:50
    along the way of splitting things out into
    smaller
  • 3:50 - 3:53
    services, is things that might be very simple
    in
  • 3:53 - 3:56
    a monolithic Rails app can become quite complex
    when
  • 3:56 - 3:59
    you move towards a service-oriented architecture.
    So the big
  • 3:59 - 4:01
    question that, that we're gonna ask ourselves
    today is,
  • 4:01 - 4:04
    well, when it comes to sharing views, how
    exactly
  • 4:04 - 4:07
    do we keep ourselves dry, right?
  • 4:07 - 4:10
    So, I don't need to tell you guys that,
  • 4:10 - 4:12
    you know, out of the box, in a monolithic
  • 4:12 - 4:16
    Rails app, you have partials and layouts,
    right. So,
  • 4:16 - 4:18
    how much you show the nav-bar in every single
  • 4:18 - 4:20
    page. Well, you'll throw it into a partial
    called
  • 4:20 - 4:22
    nav-bar, and then you'll just go into your
    application
  • 4:22 - 4:24
    layout, you'll render the nav-bar, and then
    it just
  • 4:24 - 4:27
    shows up everywhere, right. This is great
    for a
  • 4:27 - 4:29
    monolithic Rails app. But as soon as you move
  • 4:29 - 4:32
    to a service-oriented architecture, it starts
    to break down.
  • 4:32 - 4:35
    Well, why is that? The first thing is that
  • 4:35 - 4:37
    it's a lot of copy and paste coding, right,
  • 4:37 - 4:39
    so any time you want to make a change,
  • 4:39 - 4:41
    you have to copy that nav-bar into a bunch
  • 4:41 - 4:43
    of different places. The second thing is that
    it
  • 4:43 - 4:47
    requires changes in multiple places, and so
    it, it
  • 4:47 - 4:49
    kind of slows your development down. Any time
    you
  • 4:49 - 4:51
    want to make a tweak, you have to go
  • 4:51 - 4:55
    to five, ten, fifteen services and issue a,
    a
  • 4:55 - 4:58
    pull request, so that you know, the nav-bar
    is
  • 4:58 - 5:01
    updated in that specific application.
  • 5:01 - 5:03
    What we've noticed is that, things tend to
    get
  • 5:03 - 5:05
    out of sync very quickly if you, if you
  • 5:05 - 5:08
    take this approach. So, it leads to a bad
  • 5:08 - 5:11
    kind of user experience, in that the nav-bar
    starts
  • 5:11 - 5:14
    to change as you go from page to page.
  • 5:14 - 5:16
    So this doesn't really work for us.
  • 5:16 - 5:17
    The next thing that you might think of doing
  • 5:17 - 5:20
    is, well, what about putting everything inside
    an engine
  • 5:20 - 5:22
    or a gem, right? And this is a, a
  • 5:22 - 5:24
    much better solution, right. Why is it much
    better?
  • 5:24 - 5:26
    Well, the first thing is that it, it eliminates
  • 5:26 - 5:28
    that copy and paste coding that we were just
  • 5:28 - 5:31
    talking about, right. So everything is kind
    of stored
  • 5:31 - 5:34
    in this single central repository, and then,
    and then
  • 5:34 - 5:35
    any time you want to make a change, you
  • 5:35 - 5:37
    just update the gem and kind of release it
  • 5:37 - 5:39
    into the wild.
  • 5:39 - 5:41
    One of the great things about putting this
    in
  • 5:41 - 5:43
    an engine or a gem is that you can
  • 5:43 - 5:45
    share more than just the mark up, right. You
  • 5:45 - 5:48
    can share translation files, you can share
    images, JavaScript,
  • 5:48 - 5:52
    stylesheets, et cetera, et cetera. So that's
    great. The
  • 5:52 - 5:54
    problem with it, though, is that any time
    you
  • 5:54 - 5:56
    make an update, you still have to go to
  • 5:56 - 5:58
    every single app and issue a bundle update.
  • 5:58 - 6:01
    So, you know, it might work fine if you
  • 6:01 - 6:02
    have a couple of apps. As soon as you
  • 6:02 - 6:05
    move to five, ten, fifteen apps, it becomes
    a
  • 6:05 - 6:07
    hassle. So this is not quite good enough.
    And
  • 6:07 - 6:10
    at LivingSocial, we, we have a saying, that
    if
  • 6:10 - 6:13
    services aren't solving all of your problems,
    you're probably
  • 6:13 - 6:16
    not using enough services. So, what did we
    do
  • 6:16 - 6:16
    to solve our problem?
  • 6:16 - 6:19
    Of course. We build another service. And the
    service
  • 6:19 - 6:22
    we built is called Stepford. It was designed
    by
  • 6:22 - 6:26
    a guy named Eric Brody. And Stepford is responsible
  • 6:26 - 6:31
    for sharing our views across our service-oriented
    architecture. So,
  • 6:31 - 6:34
    when we were first building Stepford, we went
    through
  • 6:34 - 6:37
    kind of a DDD approach. A desi- a dream-driven
  • 6:37 - 6:40
    development approach. And we asked ourselves,
    what do we
  • 6:40 - 6:42
    really want the interaction with a service
    to look
  • 6:42 - 6:44
    like? And this is kind of what we came
  • 6:44 - 6:45
    up with.
  • 6:45 - 6:47
    So, we have a client app. We wanted the
  • 6:47 - 6:50
    client app to be able to ask Stepford and
  • 6:50 - 6:52
    say, send me the footer, right. Stepford would
    then
  • 6:52 - 6:55
    go off, do some stuff behind the scenes, and
  • 6:55 - 6:57
    then just come back and say, here's your package.
  • 6:57 - 6:59
    So, let's kind of break that down into three
  • 6:59 - 7:00
    separate steps.
  • 7:00 - 7:03
    So the first step, send me the footer. We
  • 7:03 - 7:05
    tried to come up with the simplest possible
    thing
  • 7:05 - 7:08
    that we could think of. And that is just
  • 7:08 - 7:11
    a GET request to some JSON endpoint, right.
    So
  • 7:11 - 7:13
    this is what the request looks like inside
    the
  • 7:13 - 7:16
    Stepford app. It's a GET request to, to the
  • 7:16 - 7:19
    packages controller, and we just put the things
    that
  • 7:19 - 7:23
    we want. So, different elements inside the
    query string.
  • 7:23 - 7:26
    So, here we're requesting the footer. We can
    also
  • 7:26 - 7:30
    pass additional variables. Things like city
    id, if we
  • 7:30 - 7:34
    need that footer to be semi-personalized or
    modified.
  • 7:34 - 7:36
    So now you're probably asking, well, what's
    inside a
  • 7:36 - 7:40
    package, right? So a package is actually made
    up
  • 7:40 - 7:42
    of three separate things, right. It's made
    up of
  • 7:42 - 7:44
    markup, it's made up of styles, and it's made
  • 7:44 - 7:47
    up of scripts. And everything kind of revolves
    around
  • 7:47 - 7:50
    the markup that, that you're requesting. So
    you might
  • 7:50 - 7:53
    imagine that if you're requesting the footer,
    there's an
  • 7:53 - 7:56
    associated set of styles with it, and associated
    set
  • 7:56 - 7:57
    of scripts with it.
  • 7:57 - 8:00
    If the styles don't come through, then your
    footer
  • 8:00 - 8:03
    looks really ugly. And if the scripts don't'
    come
  • 8:03 - 8:05
    through, then your footer probably isn't gonna
    work the
  • 8:05 - 8:08
    way that you want it to work. So, we
  • 8:08 - 8:10
    kind of package all of the three things up,
  • 8:10 - 8:12
    cause they all kind of have to come together.
  • 8:12 - 8:13
    And we put it in this concept of a
  • 8:13 - 8:15
    package.
  • 8:15 - 8:18
    OK, so the next step. So the next step
  • 8:18 - 8:20
    is, Stepford gets that request, and what does
    it
  • 8:20 - 8:23
    do behind the scenes? So, it's a little bit
  • 8:23 - 8:25
    complicated, and this is a very simplified
    high-level version
  • 8:25 - 8:28
    of it, but in the top-left corner, we see
  • 8:28 - 8:31
    that the GET request comes into that package's
    end
  • 8:31 - 8:34
    point. Stepford then tries to make the package.
    So
  • 8:34 - 8:36
    it grabs the mark up, it grabs the styles,
  • 8:36 - 8:39
    it grabs the scripts, it tries to precompile
    the
  • 8:39 - 8:42
    styles, it precompiles the scripts, it throws
    everything into
  • 8:42 - 8:44
    the database, and then it actually tries to
    render
  • 8:44 - 8:47
    the mark up on the server side. So that's
  • 8:47 - 8:49
    super interesting. It takes the erb template
    that is
  • 8:49 - 8:53
    stored inside Stepford, and it actually renders
    it into
  • 8:53 - 8:56
    raw html. It then sends it back via JSON.
  • 8:56 - 8:59
    So that's the last step of the three-step
    process.
  • 8:59 - 9:01
    The here is your package. And I'm about to
  • 9:01 - 9:04
    show you what a package response looks like.
    So,
  • 9:04 - 9:06
    the package response contains the three things
    that we
  • 9:06 - 9:09
    talked about, right. The styles, the scripts,
    and the
  • 9:09 - 9:12
    mark up. And here, you can see that all
  • 9:12 - 9:14
    we requested was the footer, right. But you
    can
  • 9:14 - 9:18
    imagine that in our, in our architecture,
    we're, an
  • 9:18 - 9:20
    app generally requests more than just the
    footer. It
  • 9:20 - 9:23
    probably requests the footer, it might request
    the nav-bar,
  • 9:23 - 9:26
    it might request button styles, et cetera,
    et cetera.
  • 9:26 - 9:27
    And that is kind of all going to show
  • 9:27 - 9:31
    up in that mark up as raw html.
  • 9:31 - 9:33
    And the nice thing is that Stepford will kind
  • 9:33 - 9:36
    of package together all of the styles and
    all
  • 9:36 - 9:38
    of the scripts for every single mark up element
  • 9:38 - 9:41
    that you've requested. So, everything just
    kind of boils
  • 9:41 - 9:46
    down into one precompiled stylesheet and one
    precompiled JavaScript.
  • 9:46 - 9:49
    Cool, so let's spend a little bit of time
  • 9:49 - 9:51
    talking about the pros and cons of spinning
    up
  • 9:51 - 9:55
    a service like Stepford. The obvious, biggest
    pro is
  • 9:55 - 9:58
    that you keep your views DRY, right. I don't
  • 9:58 - 10:00
    need to tell you the benefit of, of having
  • 10:00 - 10:02
    all of your views in a, in a single
  • 10:02 - 10:05
    central repository, right. There's huge benefits.
    It's easy to
  • 10:05 - 10:07
    maintain. Et cetera, et cetera.
  • 10:07 - 10:09
    The second thing is that it's super easy to
  • 10:09 - 10:12
    release changes. So Stepford is all pull-through,
    which means
  • 10:12 - 10:15
    that any time you update a nav-bar or any
  • 10:15 - 10:17
    time you update the footer, you don't have
    to
  • 10:17 - 10:19
    go to every single app and tell them, there's
  • 10:19 - 10:21
    a new nav-bar. There's a new footer.
  • 10:21 - 10:24
    The next request that it makes to Stepford,
    it's
  • 10:24 - 10:26
    actually going to, Stepford is actually going
    to send
  • 10:26 - 10:30
    back the latest version of whatever element
    there is
  • 10:30 - 10:32
    on, on the, in the database.
  • 10:32 - 10:36
    OK. So, there's obviously some cons. The first
    con
  • 10:36 - 10:38
    is that it's another service. So one thing
    that
  • 10:38 - 10:41
    we've realized by spinning up so many services
    at
  • 10:41 - 10:43
    LivingSocial is that, any time you make a
    service,
  • 10:43 - 10:47
    you're trading application complexity for
    network complexity, right.
  • 10:47 - 10:49
    So that means that your tech-ops team has
    to
  • 10:49 - 10:52
    maintain one more application. They have to
    make sure
  • 10:52 - 10:54
    that it's up all the time, otherwise, you
    know,
  • 10:54 - 10:57
    your styles won't come through. The next thing
    is
  • 10:57 - 11:00
    that, because it's another service, it also
    means that
  • 11:00 - 11:03
    there's another network request going on.
    So Stepford does
  • 11:03 - 11:08
    introduce some amount of latency into your
    application, right.
  • 11:08 - 11:10
    There's another HTTP request that goes on
    on the
  • 11:10 - 11:11
    server side.
  • 11:11 - 11:13
    At LivingSocial, the way that we kind of have
  • 11:13 - 11:15
    gotten around that is we put in a lot
  • 11:15 - 11:17
    of, a lot of caching, right. So we have
  • 11:17 - 11:20
    bonus caching around Stepford. We also have
    Memcache around
  • 11:20 - 11:24
    it. The reason is is because, a lot of
  • 11:24 - 11:27
    times, our main UI elements don't change all
    that
  • 11:27 - 11:29
    frequently. And so it's OK to put things like
  • 11:29 - 11:31
    varnish in front of it. It's OK to put
  • 11:31 - 11:32
    Memcache in front of it.
  • 11:32 - 11:34
    And the last thing is that changes have a
  • 11:34 - 11:36
    much larger impact. So when I said it's easy
  • 11:36 - 11:40
    to release changes, sometimes it's too easy
    to release
  • 11:40 - 11:43
    changes. You know, there have been instances
    where we'll
  • 11:43 - 11:45
    make the change in JavaScript, and we quite,
    and
  • 11:45 - 11:48
    we can't quite anticipate what the effects
    downstream will
  • 11:48 - 11:53
    exactly be. And so as such, you really need
  • 11:53 - 11:56
    very close JavaScript monitoring to make sure
    that you
  • 11:56 - 12:00
    understand when errors come through.
  • 12:00 - 12:02
    So that's it. That's my talk on Stepford.
    If
  • 12:02 - 12:04
    you have any questions, please come find me
    after
  • 12:04 - 12:07
    the talk. And we, we'll chat.
  • 12:07 - 12:08
    [applause]
  • 12:08 - 12:14
    ??: Thanks Ed. So, the, these guys get to
  • 12:14 - 12:20
    watch me use a computer. It's great fun. Over
  • 12:20 - 12:25
    my shoulder. This is Tyler. Tyler works, also,
    on
  • 12:25 - 12:28
    our consumer apps team. He's from Southern
    California, which
  • 12:28 - 12:31
    is, his handsome looks, as you can see.
  • 12:31 - 12:31
    TYLER MONTGOMERY: Northern California.
  • 12:31 - 12:36
    ??: Nor- I botched it. Sorry. But still handsome.
  • 12:36 - 12:40
    But he's taken ladies. And I just learned
    from
  • 12:40 - 12:42
    his website that he wants to learn everything,
    so
  • 12:42 - 12:43
    if you see him in the hall, just liter-
  • 12:43 - 12:46
    tell him anything and it will be the best
  • 12:46 - 12:48
    part of his day.
  • 12:48 - 12:53
    T.M.: Howdy. I'm Tyler. I live in Northern
    California.
  • 12:53 - 12:58
    I work remote. So, how do you work a
  • 12:58 - 13:01
    computer? OK. Let's, let's start at the beginning.
    It's
  • 13:01 - 13:04
    a good place to start. All right. Ready and
  • 13:04 - 13:04
    play.
  • 13:04 - 13:09
    All right. So I'm gonna talk about internal
    gem
  • 13:09 - 13:14
    infrastructure. Basically making it easy to
    write gems, release
  • 13:14 - 13:17
    gems. For us, you know, sharing is caring.
    Being
  • 13:17 - 13:20
    able to share code effectively across your
    apps makes
  • 13:20 - 13:22
    things really awesome. It's easy, like we
    said, to
  • 13:22 - 13:24
    extract things into services, break down the
    monolith when
  • 13:24 - 13:26
    you can share code and you can put it
  • 13:26 - 13:29
    into a gem really easily. It's, reduces the
    copy-paste
  • 13:29 - 13:31
    mayhem that we've had, you know, we put up
  • 13:31 - 13:33
    a little service and someone writes a little
    client
  • 13:33 - 13:36
    that gets copy-pasted fifty places, and then
    we make
  • 13:36 - 13:38
    changes. It's really hard to track down who's
    hitting
  • 13:38 - 13:40
    what end points, so we've had to go back,
  • 13:40 - 13:42
    put those things into a gem so we can
  • 13:42 - 13:44
    share and keep things maintainable.
  • 13:44 - 13:46
    Building gems and having this, you know, code
    in
  • 13:46 - 13:51
    gems really helps build this culture of internal
    open
  • 13:51 - 13:53
    source. A gem gets its own repo, gets its
  • 13:53 - 13:55
    own README. It's really easy for anyone to
    contribute
  • 13:55 - 13:58
    to it and people know where things are. You
  • 13:58 - 14:00
    get all the benefits of pull requests.
  • 14:00 - 14:03
    It helps with separating concerns. Like, we're
    told, like,
  • 14:03 - 14:05
    hey, you shouldn't make a mess, you know.
    But
  • 14:05 - 14:07
    where do you put that mess in a Rails
  • 14:07 - 14:08
    app? It's kind of weird, like, where do I
  • 14:08 - 14:10
    put all these little tiny objects with single
    responsibilities?
  • 14:10 - 14:12
    Where do they live? How do I keep track
  • 14:12 - 14:13
    of it?
  • 14:13 - 14:14
    And putting the stuff in a gem is really
  • 14:14 - 14:16
    nice. It helps you draw boundaries around
    your code
  • 14:16 - 14:20
    to find your domain better. Isolating your
    code is,
  • 14:20 - 14:24
    is actually really great for deleting it later.
    It's,
  • 14:24 - 14:25
    you can track it down. You can find where
  • 14:25 - 14:27
    it needs to go and get rid of it.
  • 14:27 - 14:28
    But you don't necessarily have to delete the
    code.
  • 14:28 - 14:30
    You don't have to go, where is that one
  • 14:30 - 14:32
    commit that one time where I did that one
  • 14:32 - 14:33
    thing? And I gotta go look through all these
  • 14:33 - 14:35
    old commits. You just go look at the repo,
  • 14:35 - 14:37
    but you've deleted all that code out of the
  • 14:37 - 14:39
    other code bases you still have some of that
  • 14:39 - 14:40
    history around.
  • 14:40 - 14:42
    Isolating is good too, because it forces you
    into
  • 14:42 - 14:44
    how does your code interact with Rails? How
    do
  • 14:44 - 14:46
    you interact with the database? How do you
    do
  • 14:46 - 14:48
    logging when you're isolated in your own little
    gem?
  • 14:48 - 14:51
    Do you even need Rails for this little business
  • 14:51 - 14:53
    project that you're working on? Does it need
    to
  • 14:53 - 14:55
    be part of a Rails app?
  • 14:55 - 14:56
    This has really helped me, like, try to constrain
  • 14:56 - 14:58
    my code in the simplest form it needs to
  • 14:58 - 15:00
    be to get the job done. This helps me
  • 15:00 - 15:03
    mock and stub boundaries in my tests, cause
    it's
  • 15:03 - 15:05
    clearly defined where it needs to define other,
    other
  • 15:05 - 15:08
    pieces of our architecture.
  • 15:08 - 15:10
    This has really helped me with writing good
    docs,
  • 15:10 - 15:11
    because I have a README for this thing. It's
  • 15:11 - 15:15
    really easy. So, a real example, a few weeks
  • 15:15 - 15:18
    ago I was tasked with automating a daily seatsbe??
  • 15:18 - 15:20
    (00:15:18) report out of the database, and
    uploading it
  • 15:20 - 15:22
    to a third parties FTP site. They then will
  • 15:22 - 15:25
    return us a plain text email telling us the
  • 15:25 - 15:29
    results of processing this data. a coworker
    commented, 1997
  • 15:29 - 15:32
    wants its architecture back.
  • 15:32 - 15:33
    So we've all done this. We say, hey man,
  • 15:33 - 15:35
    I'm just gonna drop this in the model, you
  • 15:35 - 15:37
    know. This FTP goes to CSV, it uploads. Gets
  • 15:37 - 15:41
    the job done. You know, fat models, bro. And
  • 15:41 - 15:43
    a couple weeks later you're like what is,
    what
  • 15:43 - 15:45
    is this code? Who put this here? What does
  • 15:45 - 15:47
    this even do? Or, a year later. Two years
  • 15:47 - 15:48
    later. Who, who did this?
  • 15:48 - 15:50
    And, so, you know I was thinking, this is
  • 15:50 - 15:52
    really gnarly code. It has, just, it has just
  • 15:52 - 15:54
    kind of a single responsibility. It has just
    one
  • 15:54 - 15:57
    thing it needs to do. So, I'll make a
  • 15:57 - 16:00
    gem. So, the rest of my talk, I'm just
  • 16:00 - 16:04
    gonna quickly go through building gems, releasing
    gems, and
  • 16:04 - 16:06
    then hosting your own gems internally.
  • 16:06 - 16:09
    So, building a gem. This is another crash
    course
  • 16:09 - 16:10
    inside a crash course. This might be review
    for
  • 16:10 - 16:13
    some of you, but this is just kind of
  • 16:13 - 16:15
    the easy way that I see how to do
  • 16:15 - 16:18
    it. So, it's a, it's another crash course,
    so.
  • 16:18 - 16:20
    So building a new gem is this easy. You
  • 16:20 - 16:23
    already have this installed. You already have
    bundler installed.
  • 16:23 - 16:27
    You just type bundle gem your gem name. The
  • 16:27 - 16:29
    ls on the front there, that's to help us
  • 16:29 - 16:31
    with namespacing. I'll get into that in a
    second.
  • 16:31 - 16:32
    But bundler will do that for you.
  • 16:32 - 16:34
    This is what it creates. This is your basic
  • 16:34 - 16:37
    fresh gem. It's the gem file, a license which
  • 16:37 - 16:40
    is MIT, you get your README, like I said.
  • 16:40 - 16:41
    You get your Rakefile and then you get your
  • 16:41 - 16:44
    lib directory with all your program code in
    there.
  • 16:44 - 16:46
    The most important file there is the bottom
    and
  • 16:46 - 16:47
    that's the gemspec. Without that, you don't
    have a
  • 16:47 - 16:51
    gem. There's plenty of documentation on, you
    know, what
  • 16:51 - 16:53
    goes in a gemspec. But bundle does a good
  • 16:53 - 16:56
    job of doing defaults for you.
  • 16:56 - 16:59
    Namespacing. If you hadn't seen this before,
    I've done
  • 16:59 - 17:01
    this with a couple different companies and
    it's really
  • 17:01 - 17:03
    helpful. You basically take your company name,
    shorten it
  • 17:03 - 17:04
    down to two letters, and you put it in
  • 17:04 - 17:06
    a module and you put all your classes under
  • 17:06 - 17:09
    this global kind of module. That's how you
    use
  • 17:09 - 17:13
    it there. It's LS for this one, GeminaboxClient,
    and
  • 17:13 - 17:15
    you require it. If you see that, like, ls
  • 17:15 - 17:18
    slash thing, that's how it's, that's how you're
    doing
  • 17:18 - 17:19
    namespacing.
  • 17:19 - 17:21
    This is really helpful. We have some early
    gems
  • 17:21 - 17:24
    that didn't do this, and I wasn't sure when
  • 17:24 - 17:26
    I first started. Is this an open source implementation,
  • 17:26 - 17:27
    or is this internal? Like, where did this
    thing
  • 17:27 - 17:31
    come from? So, maintaining this namespace
    is, it's, it's
  • 17:31 - 17:33
    helpful, and knowing where your code is coming
    from
  • 17:33 - 17:35
    and that it's an internal project.
  • 17:35 - 17:38
    So, basic example. This is just kind of an
  • 17:38 - 17:40
    example that has a few more things in it.
  • 17:40 - 17:42
    We threw a changes file in there so we
  • 17:42 - 17:44
    know what happened when the version changes,
    and then
  • 17:44 - 17:46
    we've got our, you know, some more program
    code,
  • 17:46 - 17:49
    and we have our tests. Like, everything is
    nicely,
  • 17:49 - 17:52
    tightly compacted for, for this little project.
  • 17:52 - 17:54
    A quick review on semantic versioning. You
    can go
  • 17:54 - 17:57
    to SemVer dot org. Yeah. Thanks. Some people
    don't
  • 17:57 - 18:01
    understand it so I wanted to review it. The
  • 18:01 - 18:02
    last number in a version number is the bug
  • 18:02 - 18:05
    fix number. You increment this when things
    change. Like,
  • 18:05 - 18:06
    when you fix bugs, but you haven't broken
    the
  • 18:06 - 18:10
    public API. You haven't changed or broken
    anything.
  • 18:10 - 18:11
    The minor version number is when you added
    a
  • 18:11 - 18:13
    new feature. Yay. We have new stuff. But you
  • 18:13 - 18:16
    haven't removed anything. You haven't broken
    the public API.
  • 18:16 - 18:18
    You haven't forced people into changing things.
  • 18:18 - 18:20
    And then finally, the major version number
    is, you
  • 18:20 - 18:23
    broke something. You have changed significant
    amounts of things
  • 18:23 - 18:26
    and people beware. Like, this might break
    your code.
  • 18:26 - 18:28
    And you can think of this like how hard
  • 18:28 - 18:29
    it is to upgrade from Rails 2 to 3
  • 18:29 - 18:31
    or from Rails 3 to 4. That's a big
  • 18:31 - 18:34
    change so that is a major version number.
  • 18:34 - 18:36
    If it's stable, it should be 1 point 0.
  • 18:36 - 18:38
    If it's not stable, it should not be 1
  • 18:38 - 18:41
    point 0. This is a good signifier that just
  • 18:41 - 18:43
    says hey, this has been used in production.
    It's
  • 18:43 - 18:46
    stable. It's, everyone can use this when you
    go
  • 18:46 - 18:47
    to 1 point 0. If it's before then, you
  • 18:47 - 18:50
    probably see gems that are zero zero twelve-hundred
    and
  • 18:50 - 18:52
    thirty-seven. And it's like, I'm not sure
    if I
  • 18:52 - 18:55
    should use this. That's a lot of version numbers.
  • 18:55 - 18:59
    So, that's just quick refresher on building
    gems and
  • 18:59 - 19:03
    versioning, namespacing. Now, we need to let
    the world
  • 19:03 - 19:06
    behold your awesomeness, or, at least the
    people at
  • 19:06 - 19:09
    your company. Releasing should be easy. We
    say deploying
  • 19:09 - 19:11
    should be easy. Deploying and releasing gems
    should be
  • 19:11 - 19:14
    an easy thing. This is not easy. Remembering
    the
  • 19:14 - 19:18
    version number and tagging it and rake build
    and,
  • 19:18 - 19:20
    like, this is not easy.
  • 19:20 - 19:22
    This is easy. Rake release. This is really
    easy.
  • 19:22 - 19:25
    When you use bundler you get this rake command
  • 19:25 - 19:31
    for free. But, don't accidentally open source
    your code.
  • 19:31 - 19:33
    This happens, and there are bots that mirror
    RubyGems
  • 19:33 - 19:37
    right away. It's very hard to take that back.
  • 19:37 - 19:39
    So how do go from this to this, but
  • 19:39 - 19:41
    keeping everything internal?
  • 19:41 - 19:45
    You can monkey patch, I mean subclass Bundler.
    Geminabox
  • 19:45 - 19:47
    will actually tell you on their Wiki page
    to
  • 19:47 - 19:50
    monkey patch Bundler. Don't do that. So what
    we
  • 19:50 - 19:54
    can, we wrote our own gem that just inherits
  • 19:54 - 19:59
    from Bundler's gem helper. There's tutorials
    on this. But
  • 19:59 - 20:00
    I'm just gonna go through real quick how this
  • 20:00 - 20:01
    works.
  • 20:01 - 20:03
    In your, in your Rake file you see this
  • 20:03 - 20:05
    bundler/gem_tasks at the top. What that actually
    does is
  • 20:05 - 20:08
    that gives you those three default rake tasks.
    The
  • 20:08 - 20:10
    build, the install, and the release. By default,
    it's
  • 20:10 - 20:12
    going to push it to RubyGems, and we don't
  • 20:12 - 20:14
    want that.
  • 20:14 - 20:17
    So, when we subclass it, what we want to
  • 20:17 - 20:19
    do is we want to say, we use geminabox
  • 20:19 - 20:21
    as our gem server at Living Social. We want
  • 20:21 - 20:24
    to say, hey, don't push to RubyGems. Push
    to
  • 20:24 - 20:26
    geminabox. So we've subclassed Bundler and
    said hey, don't
  • 20:26 - 20:28
    push to RubyGems. If you try to, if you
  • 20:28 - 20:30
    even try to call the private, the protected
    method
  • 20:30 - 20:32
    there, you're gonna get an error. So just
    don't
  • 20:32 - 20:33
    do it.
  • 20:33 - 20:35
    And then once we release that gem, it's just
  • 20:35 - 20:38
    a really small gem, we put ls/gem_tasks in
    place
  • 20:38 - 20:41
    of bundler/gem_tasks in all of our other gems.
    So,
  • 20:41 - 20:42
    by default this goes to our gem server when
  • 20:42 - 20:45
    you release. It's really easy.
  • 20:45 - 20:48
    So, gem servers. You, you know how to get
  • 20:48 - 20:49
    it out there and now you need some place
  • 20:49 - 20:53
    to put it. So there's three options. There's
    geminabox,
  • 20:53 - 20:56
    stickler, and then gemfury. So if you're hosting
    your
  • 20:56 - 20:58
    own, it should be behind the firewall. It's
    internal
  • 20:58 - 21:02
    code. You don't want anyone else accessing
    it.
  • 21:02 - 21:04
    Geminabox provides a nice web interface for
    managing your
  • 21:04 - 21:06
    code. It has authentication. You have to build
    your
  • 21:06 - 21:09
    own Rack middleware to do the authentication.
    It does
  • 21:09 - 21:11
    pull through mirroring, which is kind of cool.
    You
  • 21:11 - 21:15
    can tell it to mirror everything from RubyGems
    as
  • 21:15 - 21:17
    you install things, so you don't need to depend
  • 21:17 - 21:20
    on RubyGems being up when you deploy. Geminabox
    will
  • 21:20 - 21:23
    pull down everything for you.
  • 21:23 - 21:25
    And it has a nice command line client. It's
  • 21:25 - 21:28
    pretty simple. Patches gem with this inabox
    command and
  • 21:28 - 21:31
    allows you to push and setup your own machine
  • 21:31 - 21:33
    to talk to your server.
  • 21:33 - 21:36
    The other option for open source thing, gem
    servers
  • 21:36 - 21:40
    is stickler. Provides authentication in the
    same kind of
  • 21:40 - 21:41
    way. It does selective mirroring, so you can
    tell
  • 21:41 - 21:44
    it, you know, mirror ActiveRecord 3 point
    2 and
  • 21:44 - 21:46
    it'll pull it from RubyGems. You can also
    give
  • 21:46 - 21:49
    it a whole gem file, gem file lock, and
  • 21:49 - 21:50
    it'll take everything in there and it'll mirror
    all
  • 21:50 - 21:53
    of it for you. Which is handy.
  • 21:53 - 21:55
    It has a really full-featured command line
    client. You
  • 21:55 - 21:56
    can do everything that you can do from their
  • 21:56 - 21:59
    web interface. And then it's, the author wanted
    me
  • 21:59 - 22:02
    to note that it's going to support the bundler
  • 22:02 - 22:06
    dependency API in the next release coming
    soon.
  • 22:06 - 22:07
    For a hosted server that's not behind the
    firewall,
  • 22:07 - 22:09
    it's on someone else's machine, there's only
    one option
  • 22:09 - 22:13
    I know about. It's gemfury dot com. They provide
  • 22:13 - 22:16
    authentication obviously because it's not
    on your machine. They
  • 22:16 - 22:19
    don't appear to do mirroring, which is, you
    know,
  • 22:19 - 22:21
    if you're still rolling on someone else's
    service you're
  • 22:21 - 22:23
    gonna probably be relying on RubyGems, too.
    So, they
  • 22:23 - 22:24
    don't do mirroring.
  • 22:24 - 22:26
    They have command line client, and they do
    support
  • 22:26 - 22:31
    node.js and Python packages. So that's it.
    My name's
  • 22:31 - 22:37
    Tyler Montgomery, and I'm @ubermajestix on
    Twitter.
  • 22:37 - 22:41
    ??: Thank you, Tyler. Next up we have Dan
  • 22:41 - 22:43
    Mayer. He's also on our consumer app team.
    Not
  • 22:43 - 22:46
    everyone is on the consumer app team. He does
  • 22:46 - 22:49
    a lot of teaching in the D.C. area, teaching
  • 22:49 - 22:51
    people Ruby. And I just learned that he can
  • 22:51 - 22:56
    fix bugs from ski lifts. Over the phone. So
  • 22:56 - 22:59
    that is a useful parlor trick. And take it
  • 22:59 - 23:00
    away Dan.
  • 23:00 - 23:03
    DAN MAYER: All right. Hello. I'm gonna be
    talking
  • 23:03 - 23:06
    to you about production code analysis. Obviously
    as you
  • 23:06 - 23:09
    build up all these services and split out
    all
  • 23:09 - 23:11
    your code, it gets much harder to debug and
  • 23:11 - 23:15
    start finding out things about your code.
    Like a
  • 23:15 - 23:17
    small application is easy to reason about
    in your
  • 23:17 - 23:20
    head, but as your systems grow and the architecture
  • 23:20 - 23:22
    grows it gets more difficult.
  • 23:22 - 23:28
    Oh. Could somebody fix the projector and get
    us
  • 23:28 - 23:32
    all on? Shrink down. Is that one on? Or
  • 23:32 - 23:35
    is that off as well? If somebody could fix
  • 23:35 - 23:38
    that one too, that'd be great.
  • 23:38 - 23:41
    You can't improve if you don't measure. You
    can't
  • 23:41 - 23:44
    improve what you don't know. We often focus
    on
  • 23:44 - 23:48
    performance and exception monitoring. Some
    fixate on test code
  • 23:48 - 23:51
    coverage. There's a lot to learn from what
    your
  • 23:51 - 23:55
    code actually does in production. Ruby tools
    aren't quite
  • 23:55 - 23:57
    as good as, like, the Java tools, so we
  • 23:57 - 23:59
    really are still trying, as a community, to
    improve
  • 23:59 - 24:02
    those tools. So that's some things we're working
    on
  • 24:02 - 24:04
    internally.
  • 24:04 - 24:07
    And then, I wanted to mention Etsy. They have
  • 24:07 - 24:10
    some great posts all about measuring production
    systems. Graphing
  • 24:10 - 24:13
    everything and actually release Statsd, which
    we rely on
  • 24:13 - 24:16
    quite heavily. So I wanted to just say thanks
  • 24:16 - 24:17
    for that.
  • 24:17 - 24:21
    All right. So, I like to focus, as we
  • 24:21 - 24:23
    split things out and kind of forked off code
  • 24:23 - 24:26
    bases on getting rid of unnecessary code,
    because I
  • 24:26 - 24:28
    want to be able to only think about and
  • 24:28 - 24:31
    reason about the code that we actually care
    about
  • 24:31 - 24:35
    and what's actually being used in a system.
  • 24:35 - 24:37
    That code ends up in production for a whole
  • 24:37 - 24:40
    lot of reasons. I'd list up a whole bunch
  • 24:40 - 24:41
    there, but we don't really need to go through
  • 24:41 - 24:43
    every one. If you've ever worked on a team
  • 24:43 - 24:45
    as it grows, you eventually find code that
    you're
  • 24:45 - 24:47
    like, this was written three years ago and
    nobody's
  • 24:47 - 24:50
    using it. Why is it here?
  • 24:50 - 24:51
    I think it's important to try to track that
  • 24:51 - 24:53
    down and get rid of it as soon as
  • 24:53 - 24:56
    possible. Especially as you're adding a lot
    of code
  • 24:56 - 24:59
    very quickly to systems.
  • 24:59 - 25:01
    So there's various ways to find that code.
    Some's
  • 25:01 - 25:04
    as simple as just using New Relic, or formally
  • 25:04 - 25:07
    trace Linux. You can do custom stats instrumentation,
    which
  • 25:07 - 25:10
    I'm gonna go, going to talk about a little
  • 25:10 - 25:13
    bit. There's production code coverage. There's
    the gem I've
  • 25:13 - 25:17
    been working on that does code coverage, but
    not
  • 25:17 - 25:18
    on your test suite. It's actually live code
    running
  • 25:18 - 25:20
    in your system.
  • 25:20 - 25:24
    And after seeing some of the talks by Tilde,
  • 25:24 - 25:26
    I also realized I could make it much more
  • 25:26 - 25:28
    performant in Ruby 2.1.1, so I'll be working
    on
  • 25:28 - 25:30
    doing that, cause right now there's a, a high
  • 25:30 - 25:33
    cost, which I'll talk about a little later.
  • 25:33 - 25:35
    You can use logs. You should definitely have
    your
  • 25:35 - 25:39
    logs all searchable. And we'll go into that.
    Using
  • 25:39 - 25:44
    stats in implementation and production code
    coverage we've deleted
  • 25:44 - 25:46
    twenty plus thousand lines of app code. And
    then
  • 25:46 - 25:49
    hundreds of thousands of lines of code, if
    you
  • 25:49 - 25:54
    start including our assets, our JavaScript,
    test files and
  • 25:54 - 25:56
    that sort of thing. We've really been able
    to
  • 25:56 - 25:59
    shrink down our code bases as we expand out.
  • 25:59 - 26:04
    So, third-party, real quick. If you use New
    Relic,
  • 26:04 - 26:06
    you can go to the transactions. Go look at
  • 26:06 - 26:10
    the last seven days. Sort by count. The things
  • 26:10 - 26:13
    at the bottom, likely, are dead, deprecated,
    or you
  • 26:13 - 26:15
    can start working on killing them. They have,
    like,
  • 26:15 - 26:17
    one request in the last seven days. You might
  • 26:17 - 26:18
    want to go look at what those are.
  • 26:18 - 26:20
    It's really easy but it's still useful. If
    you're
  • 26:20 - 26:23
    ever finding an end point and you wonder,
    wait
  • 26:23 - 26:25
    a minute, what is this? Go check. It might
  • 26:25 - 26:27
    not be hit in the last seven days. You
  • 26:27 - 26:30
    can probably kill it. It's really easy. It's
    actually
  • 26:30 - 26:34
    even easier, because we have a gem, newrelicroutecheck,
    which
  • 26:34 - 26:37
    basically you can download the CSV from New
    Relic.
  • 26:37 - 26:40
    This generates your Rails routes file and
    then compares
  • 26:40 - 26:42
    your routes versus the output of New Relic,
    and
  • 26:42 - 26:45
    then starts telling you, this was in your
    routes
  • 26:45 - 26:47
    file but never actually hit. You can go look
  • 26:47 - 26:51
    at those end points.
  • 26:51 - 26:54
    Stats instrumentation. We're gonna step through
    all of these
  • 26:54 - 26:58
    fairly quickly. But basically there's a lot
    of different
  • 26:58 - 26:59
    things you can do with stats to help you
  • 26:59 - 27:03
    find code and tell what's going on in your
  • 27:03 - 27:06
    systems. So, background events. You want to
    know which
  • 27:06 - 27:08
    jobs are being executed. You want to know
    if
  • 27:08 - 27:11
    they're completing successfully. You might
    want to know how
  • 27:11 - 27:15
    long they take. This is an example for Resq.
  • 27:15 - 27:17
    We actually have our own wrapper around most
    of
  • 27:17 - 27:19
    our background jobs, so we do it at a
  • 27:19 - 27:20
    different layer.
  • 27:20 - 27:24
    Statsd. Before preform. After preform. You
    can throw in
  • 27:24 - 27:26
    whatever else you want there. If you want
    timers.
  • 27:26 - 27:28
    Anything. But it's really easy to instrument
    that. Then
  • 27:28 - 27:31
    you have your nice graphite graphs, where
    you can
  • 27:31 - 27:33
    kind of follow and see the, see the charts
  • 27:33 - 27:35
    and everything. You can also look at graphite
    and
  • 27:35 - 27:38
    see if a job's no longer ever being performed.
  • 27:38 - 27:44
    Emails. Email templates, especially transaction
    emails. Eventually, you have
  • 27:44 - 27:48
    a one-off transactional email for some holiday
    thing. Some
  • 27:48 - 27:53
    special product. Something that's no longer
    being triggered. You
  • 27:53 - 27:56
    can check all your emails. There's no, no
    reason
  • 27:56 - 27:58
    to work on updating them or fixing them, especially
  • 27:58 - 28:00
    when you're doing, say, a Rails update and
    you
  • 28:00 - 28:02
    have to change all your ActionMailer code.
    This will
  • 28:02 - 28:05
    let you know if it's worth your time.
  • 28:05 - 28:11
    Views rendered. Eventually your view layer
    will get very
  • 28:11 - 28:14
    complicated, with layers and layers of partials.
    If you
  • 28:14 - 28:17
    have layers and layers of partials, it's hard
    to
  • 28:17 - 28:19
    reason about which ones are still in use,
    which
  • 28:19 - 28:23
    ones have been refactored away entirely. You
    can actually,
  • 28:23 - 28:28
    really quickly, using ActiveSupport::Notifications,
    find all your layouts and
  • 28:28 - 28:32
    all your partials and templates and track
    them. This
  • 28:32 - 28:34
    is an example showing it to Statsd, or you
  • 28:34 - 28:36
    can just render it into your Rails logger
    and
  • 28:36 - 28:38
    then you can search it in something like Splunk,
  • 28:38 - 28:40
    ElasticSearch, see if it exists.
  • 28:40 - 28:42
    Again, we made a gem for this to make
  • 28:42 - 28:46
    it easier. You can see flatfoot. Basically,
    you set
  • 28:46 - 28:49
    up flatfoot. It does this for you. And then
  • 28:49 - 28:51
    it gives you some helpers to find used views,
  • 28:51 - 28:55
    unused views. You can reset it on each deploy.
  • 28:55 - 28:57
    It makes it really easy to kind of automate
  • 28:57 - 28:59
    this process and generate reports on it.
  • 28:59 - 29:05
    One off trackers. Sometimes you just find
    some code
  • 29:05 - 29:07
    and you're not quite sure what's going on.
    It's
  • 29:07 - 29:10
    very easy, with Statsd, to just throw on one-off
  • 29:10 - 29:12
    trackers. This is an example of a controller.
    We're
  • 29:12 - 29:15
    trying to figure out which of the types, or
  • 29:15 - 29:18
    paths in the controller are still being hit.
    You
  • 29:18 - 29:19
    can go ahead and throw increment on each of
  • 29:19 - 29:23
    the formats. On that request dot XHR. Now
    you're
  • 29:23 - 29:24
    going to be able to say, oh, actually we
  • 29:24 - 29:27
    stopped using the, you know, JSON format months
    ago.
  • 29:27 - 29:32
    Let's get rid of all the related code.
  • 29:32 - 29:36
    Production performance comparisons. This one
    I owe thanks to
  • 29:36 - 29:41
    uberjemef- ubermajestix over here, Tyler.
    He actually just threw
  • 29:41 - 29:43
    this out and didn't really make any fanfare
    of
  • 29:43 - 29:45
    it on one of our applications. Then I saw
  • 29:45 - 29:47
    this and I was like, that's really cool. We
  • 29:47 - 29:51
    had two different options for stripping out
    some html,
  • 29:51 - 29:55
    and we wanted to know what's faster. You could
  • 29:55 - 29:57
    benchmark it locally on some fake data, but
    the
  • 29:57 - 29:59
    production data is very different than what
    you're going
  • 29:59 - 30:02
    to test with. And it, it will vary a
  • 30:02 - 30:04
    whole lot over all our applications.
  • 30:04 - 30:07
    He threw this in there. Splits it fifty percent.
  • 30:07 - 30:11
    Throws the timer around it. Measures both
    one implementation
  • 30:11 - 30:14
    of the algorithm versus the other. Couple
    days later,
  • 30:14 - 30:17
    it's incredibly obvious that nokogiri is much
    faster than
  • 30:17 - 30:19
    just using the regular strip tags from Rails.
  • 30:19 - 30:22
    And that, that I, I just thought was so
  • 30:22 - 30:24
    interesting that I've kind of been carrying
    around to
  • 30:24 - 30:28
    point out to everybody I can find that's interested.
  • 30:28 - 30:34
    Translation usage. This one I owe Chris Morris
    some
  • 30:34 - 30:37
    credit. He is another engineer at Living Social.
    He
  • 30:37 - 30:38
    works a lot on our payment systems. But he
  • 30:38 - 30:40
    used to do a lot of our translation and
  • 30:40 - 30:42
    internationalization work.
  • 30:42 - 30:45
    And eventually, your translation files get
    really
  • 30:45 - 30:46
    large. And they actually take up a lot of
  • 30:46 - 30:49
    memory in your running Ruby processes. So
    if you're
  • 30:49 - 30:50
    trying to shrink down your memory so you can
  • 30:50 - 30:53
    foot, fit more workers on a box, you might
  • 30:53 - 30:55
    want to look at your translation files. They
    tend
  • 30:55 - 30:57
    to be a pain point for a lot of
  • 30:57 - 31:00
    companies that have a lot of languages.
  • 31:00 - 31:02
    This lets us track which keys are actually
    being
  • 31:02 - 31:06
    used. What are we still translating in production?
    Or
  • 31:06 - 31:08
    what is it we no longer use the translations
  • 31:08 - 31:10
    for. As you delete all these views, it's easy
  • 31:10 - 31:12
    to forget about all the translations that
    were in
  • 31:12 - 31:16
    the views. This actually makes it very simple
    to
  • 31:16 - 31:19
    go and find those.
  • 31:19 - 31:21
    Production code coverage. This is a little
    bit more
  • 31:21 - 31:24
    experimental at the moment. We do run it on
  • 31:24 - 31:26
    production. I have it on a lot of systems.
  • 31:26 - 31:30
    I cannot use coverage, which is what, like,
    simple
  • 31:30 - 31:32
    cov and things use in your test suite, because
  • 31:32 - 31:34
    there's a bug in Ruby. If you sample and
  • 31:34 - 31:37
    turn it on and off, it will crash. Which
  • 31:37 - 31:40
    luckily I learned prior to production.
  • 31:40 - 31:43
    So I switched to using set trace func, and
  • 31:43 - 31:45
    this lets us see each line as it's being
  • 31:45 - 31:48
    run live, and then we do sampling to cover
  • 31:48 - 31:51
    the fact that set trace func is extremely
    slow.
  • 31:51 - 31:55
    Sometimes four hundred, eight hundred percent
    slower. So we
  • 31:55 - 31:57
    can sample a very small rate of requests,
    but
  • 31:57 - 31:59
    it still will, over a whole lot of volume,
  • 31:59 - 32:01
    give you a pretty good idea of what's used
  • 32:01 - 32:02
    in production.
  • 32:02 - 32:05
    And, like I said, in 2.1.1, I just learned
  • 32:05 - 32:09
    that you can actually get the CPU profiler,
    is
  • 32:09 - 32:11
    a sampling profiler, and you can get the line-number
  • 32:11 - 32:14
    data out of it with a very small C
  • 32:14 - 32:17
    extension. So I'll probably be updating this,
    and that
  • 32:17 - 32:19
    will only help 2.1.1. It'll still have to
    use
  • 32:19 - 32:22
    set trace func on 1.9.3 and 2.0.0. But you
  • 32:22 - 32:24
    can get some really interesting data and delete
    a
  • 32:24 - 32:26
    lot of code this way.
  • 32:26 - 32:28
    Here's a quick example of the setup, but really,
  • 32:28 - 32:30
    go to the gem's home page. You can see.
  • 32:30 - 32:32
    You can do ignores on things. It'll check
    your
  • 32:32 - 32:36
    app path. It tracks in Redis. I use a
  • 32:36 - 32:39
    startup delay, because Rails is very slow
    on the
  • 32:39 - 32:41
    first few requests, because it actually builds
    a lot
  • 32:41 - 32:43
    of code in memory at that time. And you
  • 32:43 - 32:47
    really don't want to be checking your code
    coverage
  • 32:47 - 32:49
    as it's building new methods. It's just not
    a
  • 32:49 - 32:51
    good use of CPU.
  • 32:51 - 32:54
    Yeah. And this shows how to set it up
  • 32:54 - 33:00
    in your Rakefile. And real quick I'll, I'll
    -
  • 33:00 - 33:01
    I was gonna have a demo. I think I
  • 33:01 - 33:03
    missed the slide. But we're, we've got other
    speakers
  • 33:03 - 33:05
    so I'm gonna skip ahead real quick.
  • 33:05 - 33:07
    On logs, I just want to mention. Make sure
  • 33:07 - 33:09
    to get all your logs from all your applications
  • 33:09 - 33:14
    in one place. ElasticSearch, Splunk, Cabana,
    doesn't really matter.
  • 33:14 - 33:16
    You just want everything in one place so you
  • 33:16 - 33:18
    can actually see how requests are going across
    your
  • 33:18 - 33:19
    system.
  • 33:19 - 33:22
    I've been working on a gem called imprint.
    But
  • 33:22 - 33:25
    also you can look at Zipkin, which is, I
  • 33:25 - 33:28
    guess, some of like Twitter's work. Mostly
    they do
  • 33:28 - 33:30
    Scala, but I guess they have stuff for Ruby
  • 33:30 - 33:32
    as well. I just learned about that at this
  • 33:32 - 33:35
    conference. But basically, if you put a trace
    id
  • 33:35 - 33:36
    on your requests, you can see as they're coming
  • 33:36 - 33:39
    in your system, and then as you make multiple
  • 33:39 - 33:42
    API requests to your backend, you can see
    how
  • 33:42 - 33:43
    that fanned out in your system.
  • 33:43 - 33:45
    You can also drop it to all your events.
  • 33:45 - 33:47
    So any event that fails, you can track it
  • 33:47 - 33:50
    to the incoming request. If you have an exception,
  • 33:50 - 33:52
    it's going to be in the headers. It'll be
  • 33:52 - 33:54
    on your exception. You can actually take the
    exception
  • 33:54 - 33:56
    and go see all the logs for all the,
  • 33:56 - 33:59
    the requests and debug what was coming in
    that
  • 33:59 - 34:01
    was so awkward to cause this exception.
  • 34:01 - 34:03
    And, I think all these tools can help you
  • 34:03 - 34:06
    clean up your code and actually understand
    what's happening
  • 34:06 - 34:12
    in production, much better. And that's all
    I've got.
  • 34:12 - 34:19
    ??: Thanks Dan. Right. Are, are you going
    next?
  • 34:19 - 34:24
    Or is, K. I don't know.
  • 34:24 - 34:27
    I, I'm telling Rodrigo to sit down. Nick.
    Nick
  • 34:27 - 34:33
    is gonna go next. Nick is a, a Minnesotan.
  • 34:33 - 34:36
    He's on our Mail tools team. A JRuby contributor.
  • 34:36 - 34:39
    He, and for one, he's six foot four inches
  • 34:39 - 34:41
    tall and can help you get things off of
  • 34:41 - 34:45
    tall shelves. And he's gonna talk to us a
  • 34:45 - 34:46
    little about meditation.
  • 34:46 - 34:48
    NICK SIGER: [French]
  • 34:48 - 34:51
    Which is French for, I think, therefore I
    am,
  • 34:51 - 34:54
    of course, by the famous philosopher Renee
    Descartes. I'd
  • 34:54 - 34:57
    like us to ponder today a little bit about
  • 34:57 - 35:01
    whether that's really an appropriate frame
    of mind. You
  • 35:01 - 35:04
    can interpret that statement to mean that
    we identify
  • 35:04 - 35:06
    ourselves, our entire existence, by the fact
    that we
  • 35:06 - 35:10
    can think. And I personally think that's a
    really
  • 35:10 - 35:12
    bad idea.
  • 35:12 - 35:16
    Early in my career, I was obsessed with my
  • 35:16 - 35:18
    capacity of work done. I wanted to work all
  • 35:18 - 35:22
    the time. And I was constantly searching for
    that
  • 35:22 - 35:25
    sort of state, that elusive state of flow.
    But,
  • 35:25 - 35:29
    in fact, what I think I really got stuck
  • 35:29 - 35:32
    in, most often, was a, an oft more common
  • 35:32 - 35:35
    state of rat hole.
  • 35:35 - 35:37
    So, when you think of yourself during the
    work
  • 35:37 - 35:41
    day, you know, how often do you find yourself
  • 35:41 - 35:48
    getting distracted? Running down a rat hole,
    and then
  • 35:48 - 35:51
    once you get done with that hole, that hole,
  • 35:51 - 35:53
    once you finally unwind the stack get all
    the
  • 35:53 - 35:55
    way out of that rat hole, how many times
  • 35:55 - 35:57
    do you find you saying, wow. That felt great.
  • 35:57 - 36:00
    Like, no. It probably did not. And I'm arguing
  • 36:00 - 36:02
    that one of the reasons why it doesn't feel
  • 36:02 - 36:04
    great is because we all too often let our
  • 36:04 - 36:07
    minds run wild. We take every thought that
    comes
  • 36:07 - 36:09
    into our head and we believe it's truth or
  • 36:09 - 36:13
    we believe there's some element of truth to
    it.
  • 36:13 - 36:15
    We might even have perceptions about ourselves
    and the
  • 36:15 - 36:18
    way other people perceive ourselves, and we
    think that
  • 36:18 - 36:20
    for some reason those are true.
  • 36:20 - 36:23
    And I'm here to tell you that they're not.
  • 36:23 - 36:28
    I think that we have, all of us, inside
  • 36:28 - 36:30
    of us, we have a sort of a silent
  • 36:30 - 36:35
    watcher-observer of our lives that's behind
    all the thoughts.
  • 36:35 - 36:37
    And if we can all take a little bit
  • 36:37 - 36:40
    of time in our day to access that part
  • 36:40 - 36:43
    of ourselves, we find that we're gonna be
    happier.
  • 36:43 - 36:47
    We're gonna be healthier. And that's kind
    of a
  • 36:47 - 36:48
    little bit of what I'm gonna, what I'm gonna
  • 36:48 - 36:48
    outline today.
  • 36:48 - 36:52
    So, as far as meditation goes, in terms of
  • 36:52 - 36:55
    discussion for today, I'm gonna say that meditation
    is
  • 36:55 - 36:58
    sort of spending some quiet time, you know,
    attempting
  • 36:58 - 37:00
    to find sort of an absence of thought in
  • 37:00 - 37:03
    your head. And if you've ever tried meditation
    you
  • 37:03 - 37:06
    know this is actually extremely hard. People
    have been
  • 37:06 - 37:08
    meditating for thousands of thousands of years,
    and it
  • 37:08 - 37:14
    is most-certainly a life-long practice. And
    when you realize
  • 37:14 - 37:16
    how hard, you think, oh my gosh, how am
  • 37:16 - 37:18
    I gonna actually- will I ever get to a
  • 37:18 - 37:19
    state where I feel comfortable with this?
    Is this
  • 37:19 - 37:22
    something that's really worth while to do?
  • 37:22 - 37:24
    And I would advise up front that meditation,
    like
  • 37:24 - 37:26
    many other things in our lives that we find
  • 37:26 - 37:29
    worth while to do, all it requires is just
  • 37:29 - 37:31
    a little bit of time and making it a
  • 37:31 - 37:34
    habit to get the most out of it. So
  • 37:34 - 37:35
    don't make, don't, don't listen to the voices
    in
  • 37:35 - 37:37
    your head again. Don't listen to your thoughts
    that
  • 37:37 - 37:38
    are saying, oh my gosh, I have no time
  • 37:38 - 37:41
    to do this. I'm, I'm not gonna do this
  • 37:41 - 37:43
    right. I don't know how to do this. It's
  • 37:43 - 37:45
    not gonna be perfect. So therefore I'm not
    gonna
  • 37:45 - 37:47
    try. Just ignore all those and just try to
  • 37:47 - 37:49
    do it.
  • 37:49 - 37:51
    There's a number of studies out there, meditation
    does
  • 37:51 - 37:56
    have actual tangible, scientific health benefits.
    There's one study
  • 37:56 - 37:58
    that had people meditate for thirty minutes
    a day
  • 37:58 - 38:01
    for eight weeks, and they did brain scans
    on
  • 38:01 - 38:03
    the people before and after and found that
    their
  • 38:03 - 38:06
    gray matter in brain regions associated with
    memory and
  • 38:06 - 38:10
    stress and empathy actually increased in just
    eight weeks.
  • 38:10 - 38:12
    So you can actually, you know, even as an
  • 38:12 - 38:15
    adult, you know, we're long passed puberty,
    even as
  • 38:15 - 38:18
    adult you can spend time and change the composition
  • 38:18 - 38:22
    of your mind and the composition of your body.
  • 38:22 - 38:26
    Another study at UC Davis foc- said that focusing
  • 38:26 - 38:30
    on the present, doing activities like meditation,
    rather than
  • 38:30 - 38:34
    letting the mind run away, adrift, actually
    lowered levels
  • 38:34 - 38:37
    of the stress hormone cortisol in your body.
    So,
  • 38:37 - 38:39
    meditation also will allow you to get on top
  • 38:39 - 38:44
    of your, your hormones, and get a better hormonal
  • 38:44 - 38:47
    balance. You'll feel a lot better about yourself.
  • 38:47 - 38:50
    So, unfortunately, a lightning talk is probably
    a bad
  • 38:50 - 38:53
    place to actually try to, try to lead a
  • 38:53 - 38:56
    meditation session, since I think you, to
    do it
  • 38:56 - 38:57
    justice, you'd want to probably have just
    at least
  • 38:57 - 39:00
    a five minutes quiet time to yourself. But
    instead,
  • 39:00 - 39:01
    what I'm gonna do is take just a few
  • 39:01 - 39:04
    moments and actually ask all of you to, you
  • 39:04 - 39:07
    don't have to do this yet, but what I'm
  • 39:07 - 39:08
    gonna ask you to do in a minute here
  • 39:08 - 39:10
    is close your eyes and just try to get
  • 39:10 - 39:13
    comfortable, and try to clear, clear your
    mind of
  • 39:13 - 39:15
    any thoughts.
  • 39:15 - 39:17
    And then what I'm gonna ask you to do
  • 39:17 - 39:20
    is to just spend some time trying to obtain
  • 39:20 - 39:24
    that, that, that clear head, and watch your
    mind
  • 39:24 - 39:26
    for the very next thought that comes out.
    And
  • 39:26 - 39:28
    watch your mind like a cat would watch a
  • 39:28 - 39:30
    mouse hole. So I'm gonna ask you all now
  • 39:30 - 39:32
    to close your eyes, and watch your mind, and
  • 39:32 - 39:33
    just try to watch for the very next thought
  • 39:33 - 39:35
    that comes in. And just try to be focused
  • 39:35 - 39:38
    and attentive. Don't try to follow it, don't
    try
  • 39:38 - 39:40
    to lull yourself to sleep or anything. Just
    be
  • 39:40 - 39:43
    focused and attentive and try to look for
    that
  • 39:43 - 39:44
    very next thought.
  • 39:44 - 39:48
    And I'll just give you a few moments. And
  • 39:48 - 39:50
    when that thought comes in go ahead and open
  • 39:50 - 39:54
    your eyes. OK. Some of you actually lasted
    quite
  • 39:54 - 39:56
    awhile there. That's pretty good. So what
    you may
  • 39:56 - 39:59
    be finding with this little exercise is that
    when
  • 39:59 - 40:02
    you take the time to be really attentive about
  • 40:02 - 40:05
    having a clear mind, it actually takes a little
  • 40:05 - 40:08
    while longer for that thought to come in.
  • 40:08 - 40:10
    So this is, this is actually the very beginning
  • 40:10 - 40:12
    of the meditation practice. You're actually
    trying to, rather
  • 40:12 - 40:18
    than being completely, completely lifeless
    or, or almost like
  • 40:18 - 40:22
    a, well, you, you're actually trying to be
    very,
  • 40:22 - 40:25
    very attentive to the immediate present moment.
  • 40:25 - 40:28
    So, when you're doing this, it's important
    to not
  • 40:28 - 40:31
    be self-critical, right. So maybe a thought
    rushed in
  • 40:31 - 40:33
    right away, again, and you feel like, oh gosh,
  • 40:33 - 40:35
    I have no control of it. Well, don't try
  • 40:35 - 40:38
    to control what's happening. Don't try to
    be on
  • 40:38 - 40:39
    top of it. We, you know, we're all control
  • 40:39 - 40:41
    freaks a lot. We're in technology. We like
    things
  • 40:41 - 40:43
    to work. We like to control computers. Don't
    try
  • 40:43 - 40:46
    to be in control of the situation. Just observe
  • 40:46 - 40:50
    where your thoughts are jumping to. And just,
    just
  • 40:50 - 40:53
    try to be that passive observer of what's
    happening
  • 40:53 - 40:55
    in your mind.
  • 40:55 - 40:57
    And then, so, once you start to get in
  • 40:57 - 41:00
    this habit of taking time to at least check
  • 41:00 - 41:02
    in with yourself, maybe you start a meditation
    practice
  • 41:02 - 41:05
    or maybe you just want to take moments out
  • 41:05 - 41:07
    of your day to just take a break from
  • 41:07 - 41:08
    things and be a little bit more mindful and
  • 41:08 - 41:12
    a little more self-aware. Ask yourself throughout
    the day,
  • 41:12 - 41:14
    am I at ease at this moment? You know,
  • 41:14 - 41:16
    ask yourself, how do I feel at this moment?
  • 41:16 - 41:18
    Am I at ease? Or what's going on inside
  • 41:18 - 41:21
    me. And just, just pay attention to those
    feelings
  • 41:21 - 41:24
    and those, what's going on inside you without
    judging
  • 41:24 - 41:26
    or, or trying to make any changes about it.
  • 41:26 - 41:29
    We're just trying to cultivate self-awareness
    here.
  • 41:29 - 41:32
    I also find that doing meditation has lead
    me
  • 41:32 - 41:35
    to doing other things really mindfully as
    well. I
  • 41:35 - 41:37
    like to, I like to cook. I like to
  • 41:37 - 41:39
    clean. I like to do all these little kind
  • 41:39 - 41:44
    of tasks that don't require a huge amount
    of
  • 41:44 - 41:47
    mental energy. And I like just focusing on
    them
  • 41:47 - 41:49
    intently. And I find that even doing things
    like
  • 41:49 - 41:52
    chopping vegetables or, or clean- or doing
    dishes or
  • 41:52 - 41:56
    any task which you think normally would be
    completely,
  • 41:56 - 41:59
    you know, oh, what a waste of time. I
  • 41:59 - 41:59
    don't want to do this right now, I really
  • 41:59 - 42:01
    don't want to do these chores. You can actually
  • 42:01 - 42:02
    find a little bit of pleasure in just focusing
  • 42:02 - 42:04
    completely on the task.
  • 42:04 - 42:06
    And that's another way to just kind of open
  • 42:06 - 42:11
    yourself up and be, be more at ease. And,
  • 42:11 - 42:14
    you know, of course, we all have screens on
  • 42:14 - 42:16
    us at all, at all times of the days
  • 42:16 - 42:18
    these days, and that's another, you know,
    where it's
  • 42:18 - 42:20
    like, looking at a screen is, you're putting
    your
  • 42:20 - 42:23
    attention out into the ether, out somewhere
    else from
  • 42:23 - 42:25
    where you are right now. So when you're with
  • 42:25 - 42:28
    someone, even when you're by yourself, maybe
    every now
  • 42:28 - 42:30
    and then put the screen down and just focus
  • 42:30 - 42:34
    on, on just what you're doing.
  • 42:34 - 42:39
    And I think, for me, my opinion of, of
  • 42:39 - 42:42
    the, you know, this, this lifelong process
    of trying
  • 42:42 - 42:44
    to be more mindful, trying to meditate, trying
    to
  • 42:44 - 42:48
    make, make ourselves better through meditation,
    is actually a
  • 42:48 - 42:50
    contagious thing and one that we can contribute
    to
  • 42:50 - 42:54
    the well-being of the entire planet. So I
    hope
  • 42:54 - 42:56
    you will consider, you know, reducing the
    crazy noise
  • 42:56 - 42:59
    in your mind and maybe check out what meditation
  • 42:59 - 43:01
    can do for you and kind of follow up
  • 43:01 - 43:03
    on some of those studies I, I mentioned.
  • 43:03 - 43:05
    I will have, I'll Tweet a link later on
  • 43:05 - 43:08
    it. I was planning on posting it before this
  • 43:08 - 43:09
    talk but I forgot to do it. I have
  • 43:09 - 43:10
    to get back to my computer. But I will,
  • 43:10 - 43:13
    I will Tweet a link later. My, my Twitter
  • 43:13 - 43:17
    handle is @nicksiegr, N-I-C-K-S-I-E-G-R, and
    I'll Tweet a link
  • 43:17 - 43:20
    later with some of the, the articles and links
  • 43:20 - 43:22
    to thinks that I, that I look, that I
  • 43:22 - 43:25
    refer to during the course of my talk. So,
  • 43:25 - 43:30
    meditate. Be happy. Make the world better.
    Thanks.
  • 43:30 - 43:36
    RODRIGO FRANCO: Can I go now?
  • 43:36 - 43:42
    ??: Now's your time, Rodrigo. So, Rodrigo
    is a
  • 43:42 - 43:47
    developer on our merchant team. And he's an
    avid
  • 43:47 - 43:49
    game, both board and video, right?
  • 43:49 - 43:50
    R.F.: Yes.
  • 43:50 - 43:52
    ??: And you're from Brazil, right?
  • 43:52 - 43:52
    R.F.: Yes.
  • 43:52 - 43:54
    ??: Definitely south of the Equator.
  • 43:54 - 43:54
    R.F.: Yes.
  • 43:54 - 43:57
    ??: And, if you see him in the hall,
  • 43:57 - 43:58
    ask him about his goat.
  • 43:58 - 44:03
    R.F.: They're gonna, they're gonna see them.
  • 44:03 - 44:04
    ??: All right.
  • 44:04 - 44:06
    R.F.: But yeah.
  • 44:06 - 44:08
    ??: Take it away.
  • 44:08 - 44:15
    R.F.: Thank you. Is this one? You're strong.
    All
  • 44:15 - 44:20
    right. So, hello everyone. My name is Rodrigo.
    And
  • 44:20 - 44:22
    I'm here to give you one trick to boost
  • 44:22 - 44:26
    your productivity when working from home.
    My Twitter handle
  • 44:26 - 44:30
    is @caffo. My wife call me that. So you
  • 44:30 - 44:33
    can call me that, too. Or Rodrigo. Whatever
    you
  • 44:33 - 44:33
    want.
  • 44:33 - 44:36
    I wrote an article for, or tech blog, about
  • 44:36 - 44:41
    how I do work from home, and how I
  • 44:41 - 44:44
    try to focus on things while doing that. The
  • 44:44 - 44:47
    most important thing that people talk about
    was the
  • 44:47 - 44:50
    pet goats, and that they were in the article,
  • 44:50 - 44:52
    like, briefly. I'm gonna show you some.
  • 44:52 - 44:55
    Here's me with my pet goat in a hangout
  • 44:55 - 44:57
    for work. If you want to read the article,
  • 44:57 - 45:00
    it's available here. It's a sign in link.
    And
  • 45:00 - 45:05
    I have been working remotely from home for
    about
  • 45:05 - 45:08
    ten years. So, I had to find my way
  • 45:08 - 45:11
    to focus on stuff. Otherwise I'd just play
    video
  • 45:11 - 45:14
    games all the time. And, that's why we have
  • 45:14 - 45:16
    this unrelated cat picture.
  • 45:16 - 45:21
    And, this article name is One Weird Trick,
    because
  • 45:21 - 45:23
    while I was browsing the internet without
    ad block,
  • 45:23 - 45:26
    I saw a lot of these, these like ads,
  • 45:26 - 45:29
    like. One tip for a flat belly. And, like
  • 45:29 - 45:32
    DHH said, like, there's no way we can have
  • 45:32 - 45:36
    like a quick flat belly. So, what, what would
  • 45:36 - 45:38
    be, like, this one trick that we can get
  • 45:38 - 45:40
    to have focus? And I think it's boundaries.
  • 45:40 - 45:44
    Like, I had a couple things I do that
  • 45:44 - 45:47
    limit my work day and my personal day, because
  • 45:47 - 45:50
    at home they are very together. And I'm just
  • 45:50 - 45:53
    gonna briefly show you some of these things,
    like
  • 45:53 - 45:56
    everyday I start my day with a startup ritual.
  • 45:56 - 45:58
    I get presentable, because we do hangouts
    and I
  • 45:58 - 46:03
    need to be properly dressed. Not undressed.
    Whatever. And
  • 46:03 - 46:06
    then I do what I call a, I open
  • 46:06 - 46:09
    the cafeteria. I get, like, some fizzy water
    done.
  • 46:09 - 46:12
    I put coffee in the press and I grind
  • 46:12 - 46:14
    the beans. And then I have a very good
  • 46:14 - 46:17
    cup of coffee.
  • 46:17 - 46:19
    The other thing that I think it's important,
    after
  • 46:19 - 46:20
    all of that done, I get my cup of
  • 46:20 - 46:23
    coffee. I sit down. I start working. And I
  • 46:23 - 46:27
    think you really, you really need to eliminate
    distractions.
  • 46:27 - 46:29
    You need to find a way to be in
  • 46:29 - 46:33
    your mind office while in your home. And what
  • 46:33 - 46:36
    I found out was very good for me was
  • 46:36 - 46:39
    having a good pair of head phones. The head
  • 46:39 - 46:41
    phones are nice because they allow you to
    focus
  • 46:41 - 46:44
    on stuff, and like people around you, like,
    my
  • 46:44 - 46:47
    wife knows when I'm with the headphones, she
    can't
  • 46:47 - 46:50
    talk to me. The dog don't care about, a
  • 46:50 - 46:53
    lot about it, and pet goats just get sad
  • 46:53 - 46:56
    because he can't get my attention.
  • 46:56 - 46:58
    And I also have all sorts of gizmos. Like,
  • 46:58 - 47:00
    I plug the headphones there, so I can have
  • 47:00 - 47:04
    even more like better sound. And that way
    my
  • 47:04 - 47:06
    wife just, like, needs to throw stuff at me.
  • 47:06 - 47:09
    Like, wake up, get out of here. I need
  • 47:09 - 47:11
    something. And I call that my focus flag.
    It's
  • 47:11 - 47:13
    like a way I can show to the world
  • 47:13 - 47:16
    and to myself that it's time to work. I'm
  • 47:16 - 47:21
    not here. I may be here, in my body,
  • 47:21 - 47:24
    but my mind's doing other things for my company.
  • 47:24 - 47:28
    So, OK. You got there. You had your startup
  • 47:28 - 47:32
    ritual. You got your computer. Your headset.
    Goats away.
  • 47:32 - 47:36
    So, you can really start working. And then
    you're
  • 47:36 - 47:39
    done, because you do a lot of multitasking.
    And
  • 47:39 - 47:43
    you can't do that. Like, why we spend all
  • 47:43 - 47:46
    the time in Hacker News, on Reddit. Because
    it's
  • 47:46 - 47:49
    way more fun than do work. Like, you have
  • 47:49 - 47:51
    that huge list of things to do, but you
  • 47:51 - 47:53
    want to be on Reddit.
  • 47:53 - 47:55
    So we need to cut down multitasking. You need
  • 47:55 - 47:59
    to find ways to not change what you're doing.
  • 47:59 - 48:01
    So if you're coding, you're coding. You don't
    have
  • 48:01 - 48:04
    like, if gmail is loaded, you should not open
  • 48:04 - 48:06
    a new browser tab. Oh, but I'm just gonna
  • 48:06 - 48:09
    browse a second. Your day is gone.
  • 48:09 - 48:13
    So, what I done, for example, I had these,
  • 48:13 - 48:17
    these tiny Arduino plugged into my computer,
    so if
  • 48:17 - 48:20
    someone sends me an IM message and they are
  • 48:20 - 48:22
    in a white list, I would get a light
  • 48:22 - 48:24
    that says you need to answer them because
    it's
  • 48:24 - 48:26
    your boss or someone from your team. If it's
  • 48:26 - 48:30
    not, like, you can answer whenever you have
    time.
  • 48:30 - 48:34
    So you need to find ways to not multitask.
  • 48:34 - 48:37
    Another important thing is, don't work all
    the time.
  • 48:37 - 48:40
    When I started working remotely, I said like,
    yeah.
  • 48:40 - 48:42
    I need to make sure I don't play video
  • 48:42 - 48:44
    games all the time. And I started working
    all
  • 48:44 - 48:47
    the time. And I would never stop. So, you
  • 48:47 - 48:49
    need to find a good balance between one thing
  • 48:49 - 48:52
    and the other. You should also spend time
    with
  • 48:52 - 48:55
    others. Like, don't spend all the time at
    the
  • 48:55 - 48:59
    computer, like just working mindless. Like,
    find time to
  • 48:59 - 49:02
    spend time with other people. And also find
    time
  • 49:02 - 49:06
    to learn new stuff, like challenge yourself
    on Code
  • 49:06 - 49:09
    Wars. Do some Khan Academy stuff. Like, you
    need
  • 49:09 - 49:11
    to have a good balance in your life to
  • 49:11 - 49:15
    make sure your work is, works well, and everything
  • 49:15 - 49:16
    goes fine. Yeah.
  • 49:16 - 49:18
    That's it. Thank you so much.
Title:
RailsConf 2014 - Living Social Lightning Talks
Description:

more » « less
Duration:
49:44

English subtitles

Revisions