Skip to content

Instantly share code, notes, and snippets.

@ahoward
Last active January 2, 2016 09:49
Show Gist options
  • Select an option

  • Save ahoward/8285714 to your computer and use it in GitHub Desktop.

Select an option

Save ahoward/8285714 to your computer and use it in GitHub Desktop.

Revisions

  1. ahoward revised this gist Jan 6, 2014. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions a.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    recently our team had an exchange about lazy evaluation of ORM queries in ruby ( https://gist.github.com/ahoward/8285529 ) - this prompted me to think about how deep rails has really become and just how hard good MVC organization for the web really is. back in the data it took a special kind of developer to understand how to not kill a db when it was used in a web app - now it's pretty easy and, while this seems good on the outside, in the inside i think today's developers understand less and less about why web programming is really the hardest there is.
    recently our team had an exchange about lazy evaluation of ORM queries in ruby ( https://gist.github.com/ahoward/8285529 ) - this prompted me to think about how deep rails has really become and just how hard good MVC organization for the web really is. back in the day it took a special kind of developer to understand how to not kill a db when it was used in a web app - now it's pretty easy and, while this seems good on the outside, in the inside i think today's developers understand less and less about why web programming is really the hardest kind there is.

    that's the motivation for today's quiz. to take it *fork* and keep your answer under 100 LOC *total*
    that's the motivation for today's quiz. to take it *fork* and keep your answer under 142 LOC *total*


    given a model, *Post*, write code which will
  2. ahoward renamed this gist Jan 6, 2014. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  3. ahoward renamed this gist Jan 6, 2014. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  4. ahoward revised this gist Jan 6, 2014. 2 changed files with 20 additions and 1 deletion.
    20 changes: 20 additions & 0 deletions quiz.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    recently our team had an exchange about lazy evaluation of ORM queries in ruby ( https://gist.github.com/ahoward/8285529 ) - this prompted me to think about how deep rails has really become and just how hard good MVC organization for the web really is. back in the data it took a special kind of developer to understand how to not kill a db when it was used in a web app - now it's pretty easy and, while this seems good on the outside, in the inside i think today's developers understand less and less about why web programming is really the hardest there is.

    that's the motivation for today's quiz. to take it *fork* and keep your answer under 100 LOC *total*


    given a model, *Post*, write code which will

    - load the 2nd set of 5 results (page 2 of 5 each)
    - access them in the view

    sounds easy right? now here are the requirements:

    - do NOT load any more objects from the db than required - not a single one.
    - no database activity must occur if the view doesn't require it, none.
    - you may not rely on cache helpers, rails, imaginary, or otherwise
    - you many not rely on magic ORB behavior such as lazy evaluation

    this is obviously a web developer 101 task - so think about the difficulty in
    the context of your next framework evaluation (aka when you think writing an
    api for backboone seems 'easy')
    1 change: 0 additions & 1 deletion view.html.erb
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,3 @@

    <!-- go -->

    <%= @posts %>
  5. ahoward revised this gist Jan 6, 2014. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions view.html.erb
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,6 @@

    <!-- go -->

    <%= @posts %>

    <ul>
  6. ahoward created this gist Jan 6, 2014.
    5 changes: 5 additions & 0 deletions controller.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    class PostsController

    # go

    end
    6 changes: 6 additions & 0 deletions model.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    class Post

    # go

    end

    6 changes: 6 additions & 0 deletions view.html.erb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@

    <%= @posts %>

    <ul>
    <li> ... </li>
    </ul>