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.
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.
Prize for the best introduction to the LessWrong source ($250)
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:
Python
Pylons
SQLAlchmey
PostgreSQL
Prototype (although jQuery is now also present)
Memcached
Mako Templates
Ajax
TinyMCE
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.