Prize for the best introduction to the LessWrong source ($250)
post by jsalvatier · 2011-10-05T00:08:33.404Z · LW · GW · Legacy · 16 commentsContents
16 comments
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.
16 comments
Comments sorted by top scores.
comment by SilasBarta · 2011-10-04T17:32:59.781Z · LW(p) · GW(p)
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.
Replies from: lukeprog↑ comment by lukeprog · 2011-10-06T02:34:01.630Z · LW(p) · GW(p)
I wish I had a karmic wave like Eliezer so I could cause 15 more people to upvote this.
Replies from: SilasBarta↑ comment by SilasBarta · 2011-10-06T14:46:55.969Z · LW(p) · GW(p)
I appreciate that, but remember, this is just a statement of intent. Pre-natal chicken counting and all...
comment by Kaj_Sotala · 2011-10-06T08:41:44.696Z · LW(p) · GW(p)
I chipped in $50.
Replies from: jsalvatier↑ comment by jsalvatier · 2011-10-06T15:26:29.769Z · LW(p) · GW(p)
Hooray! Thank you!
comment by Dr_Manhattan · 2011-10-04T15:34:11.601Z · LW(p) · GW(p)
"ChipIn page" link should probably go to Chipin rather than Paypal redirect, that link can be put under "contributions welcome"
Replies from: jsalvatier↑ comment by jsalvatier · 2011-10-04T15:40:16.753Z · LW(p) · GW(p)
Indeed! Thanks!
comment by John_Maxwell (John_Maxwell_IV) · 2011-10-06T07:46:07.704Z · LW(p) · GW(p)
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.
Replies from: jsalvatier↑ comment by jsalvatier · 2011-10-06T14:58:06.138Z · LW(p) · GW(p)
That hadn't occurred to me, but it is a good idea!
comment by SilasBarta · 2011-10-08T00:00:55.455Z · LW(p) · GW(p)
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?
Replies from: jsalvatier↑ comment by jsalvatier · 2011-10-08T19:59:59.413Z · LW(p) · GW(p)
Yes, I think so.
comment by VincentYu · 2012-06-10T22:22:36.834Z · LW(p) · GW(p)
What happened to the prize? Did you get any submissions?
Replies from: jsalvatier↑ comment by jsalvatier · 2012-06-14T07:10:14.904Z · LW(p) · GW(p)
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 by [deleted] · 2011-10-04T15:02:56.735Z · LW(p) · GW(p)
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.
Replies from: SilasBarta, Dr_Manhattan↑ comment by SilasBarta · 2011-10-06T14:49:00.036Z · LW(p) · GW(p)
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 by Dr_Manhattan · 2011-10-04T15:09:58.950Z · LW(p) · GW(p)
There are costs to looking around. We're trying the make these costs smaller.