Less Wrong is a community blog devoted to refining the art of human rationality. Please visit our About page for more information.

Prize for the best introduction to the LessWrong source ($250)

16 Post author: jsalvatier 05 October 2011 12:08AM

Now that it's easy to host lesswrong and hack on the code, you may have gotten excited about adding a feature (facebook likes for articles! or expanded user pages!). So, you take a look at the code and …  oh, it's kind of complicated ... You don’t know how the site works and don’t know how to learn. LessWrong lacks a good introduction to its source code. 

The LW Public Goods Team and Dr_Manhattan would like the process of getting to know the code to be easier. Therefore, we’re sponsoring a prize for the best introduction to the code. The prize fund is currently $250 (ChipIn page; contributions welcome!). Submissions are due by October 25th. The prize will be judged by jsalvatier, Dr_Manhattan, and Morendil

The submissions will be judged according to how effective the judges expect them to be at lowering the barriers to working productively on lesswrong.

One strategy we expect to use for making this judgment is to think of specific change we might want to make and then see how much the tutorial would help us understand the relevant issues. For example, we might think about trying to allow comments to be declared karma-neutral for the purposes of implementing polls or rank ordering of suggestions. We might ask ourselves:

  • Does this tutorial help me form an accurate mental model of what happens as a result of clicking the upvote button, in terms of how LW is implemented? 
  • Does it help me think effectively about bringing about the desired effects? 
  • Does it help me anticipate potentially detrimental unintended effects? 
  • Does it help me map that (dynamic) execution model to specific bits of the (static) source code? 
  • Does the tutorial cover enough of the major relevant aspects of LW besides the example (picked at random) of votes and karma?

We might think about linking wiki pages to users pages so that users can give more background about themselves. We might ask ourselves:

  • Does the tutorial give me a clear idea of where user information is stored and accessed?
  • Does it help me understand how wikipages are rendered on the main site?
  • Does it help me learn how the individual parts of existing user pages are rendered?
  • Does it help me know where to go answer this questions that it doesn’t answer directly? 

The winner of the prize will be asked to incorporate the work of other submissions (with help of course). The prize money will be split up according to how much each submission contributed to the final product. The Introduction's final location will be the LessWrong Github wiki.

At the bottom of this article is some general information about the code graciously provided by Wes from TrikeApps and Morendil. If you have questions/comments/concerns about the prize please speak up!

1. How different is LW from its parent Reddit code? 

Reddit has obviously changed a bit since it forked the code almost 3 years ago, but the changes to the version we forked are mostly around the appearance of the site and addition of Less Wrong specific features such as the concept of an Article, addition of Meetups, etc. So in general it isn't hugely different from Reddit. You can get more specific information by looking at the commit history.

2. What knowledge is useful for hacking on LW assuming generic programming experience?

Along with programming experience you should have a knowledge of web applications and web technologies in general (HTML, CSS, JS, HTTP). To a lesser degree some database knowledge (SQL). More specific things to know are Python (or another comparable scripting language such as Perl or Ruby, maybe PHP if the experience was with a modern object oriented PHP web framework) and Pylons (although Less Wrong/Reddit doesn't use Pylons model layer). Whilst the code uses PostgreSQL as the database it is not used as a typical relational database so familiarity with the concept of a key-value store(so called "NoSQL") is useful.

One key question is "how are the objects perceived at user level (articles, comments, karma, etc) represented at the implementation level". For instance, karma is tricky because there isn't a "total karma" field in the DB, it's computed by summing comment and article karma scores each time you query it.

3. What frameworks, tools is LW/Reddit based on?

Noteworthy things the code uses are:

4. Is LW organized the same way as lots of other websites or some particular framework or is it idiosyncratic?

The code follows a loose MVC (Model View Controller) paradigm and the code is organised to reflect that. MVC is certainly something to be familiar with. The r2/r2/ path (poorly named by the Reddit people representing their "release 2", to original Reddit was written in Lisp) contains the meat of the app. You will note 'models' and 'controllers' directories for those things and a 'templates' directory for the views plus other support code in 'lib'. This structure is typical of other MVC web apps such as Ruby on Rails.

5. How long would it take to be able to start hacking on LW effectively?

With Python and web experience you could be effective in a 1 - 3 days. Without web experience you're likely to feel quite lost for a bit as there's a bunch of conventions and technologies to learn. It would be more like 3 - 7 days. Keep in mind programmers are notorious for underestimating though.

Comments (16)

Comment author: Kaj_Sotala 06 October 2011 08:41:44AM 7 points [-]

I chipped in $50.

Comment author: jsalvatier 06 October 2011 03:26:29PM 1 point [-]

Hooray! Thank you!

Comment author: SilasBarta 04 October 2011 05:32:59PM 9 points [-]

I've been working through the process myself as a newbie (got VM for site set up), and I think I'll be able to bridge the inferential gap on this one, or at least seriously test my explanatory prowess. Count me in as a candidate.

Comment author: lukeprog 06 October 2011 02:34:01AM *  3 points [-]

I wish I had a karmic wave like Eliezer so I could cause 15 more people to upvote this.

Comment author: SilasBarta 06 October 2011 02:46:55PM 5 points [-]

I appreciate that, but remember, this is just a statement of intent. Pre-natal chicken counting and all...

Comment author: John_Maxwell_IV 06 October 2011 07:46:07AM 3 points [-]

I'm assuming that the public goods team will have a prize for best new Less Wrong feature once this contest finishes. (If not I'll be happy to chip in to fund one.) Awesome work guys; great idea to gradually ramp things up like this.

Comment author: jsalvatier 06 October 2011 02:58:06PM 0 points [-]

That hadn't occurred to me, but it is a good idea!

Comment author: Dr_Manhattan 04 October 2011 03:34:11PM 3 points [-]

"ChipIn page" link should probably go to Chipin rather than Paypal redirect, that link can be put under "contributions welcome"

Comment author: jsalvatier 04 October 2011 03:40:16PM 0 points [-]

Indeed! Thanks!

Comment author: SilasBarta 08 October 2011 12:00:55AM *  1 point [-]

I figured I might as well mention this here. I ran into a problem following these steps (which is how it looked at the time), which was that the selenium tests not working because it didn't understand the term "bundle". I found a workaround, and I was just in the middle of writing up a nice bug report when I realized I could just edit the page so it includes my workaround.

In any case, once I got the selenium tests to work, I got a failure:

 1) Lesswrong should allow browsing should have ajaxy article navigation fields
Failure/Error: find('#article_nav_controls li')
Capybara::ElementNotFound:
Unable to find '#article_nav_controls li'
# ./spec/main_spec.rb:195
Finished in 86.15 seconds
12 examples, 1 failure, 1 pending
rake aborted!
ruby -S bundle exec rspec --options "/home/lesswrong/lesswrong/spec/spec.opts" spec/main_spec.rb failed
/home/lesswrong/lesswrong/Rakefile:340
(See full trace by running task with --trace)

Should I submit that as a bug?

Comment author: jsalvatier 08 October 2011 07:59:59PM 0 points [-]

Yes, I think so.

Comment author: VincentYu 10 June 2012 10:22:36PM 0 points [-]

What happened to the prize? Did you get any submissions?

Comment author: jsalvatier 14 June 2012 07:10:14AM *  1 point [-]

We unfortunately, and somewhat surprisingly, did not get any submissions. One person even said they would submit one beforehand and didn't submit anything. :( (response delayed because of vacation)

Comment author: [deleted] 04 October 2011 03:02:56PM *  -3 points [-]

Are you sure that isn't a waste of money? I'm sure anyone with the programming skill, and enough luck for the thing to install correctly, would have no trouble adding features.. just like any other free software you have to look around a bit before editing it.

Comment author: SilasBarta 06 October 2011 02:49:00PM 9 points [-]

No, no, no, no, no. This is the exact mentality that keeps good practical programming guides from being written. There is a lot that the guides don't cover, even in the processes that they try to cover, and contests like these help to reduce the "activation energy" and allow more people to easily get involved.

Comment author: Dr_Manhattan 04 October 2011 03:09:58PM 8 points [-]

There are costs to looking around. We're trying the make these costs smaller.