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.

New to LessWrong?

New Comment
16 comments, sorted by Click to highlight new comments since: Today at 10:20 AM

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.

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

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

I chipped in $50.

Hooray! Thank you!

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

Indeed! Thanks!

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.

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

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?

Yes, I think so.

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

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)

[+][anonymous]12y-50