Meet Wikipedia, the Encyclopedia Anyone Can Code

It began as the encyclopedia anyone can edit. And now it's also the encyclopedia anyone can program.
Image may contain Clothing Apparel and TShirt
Image:Flickr/mikeedesign

It began as the encyclopedia anyone can edit. And now it's also the encyclopedia anyone can program.

As of this weekend, anyone on Earth can use Lua -- a 20-year-old programming language already championed by the likes of Angry Birds and World of Warcraft -- to build material on Wikipedia and its many sister sites, such as Wikiquote and Wiktionary. Wikipedia has long offered simple tools that let tens of thousands of volunteer editors reuse little bits of text across its encyclopedia pages, but this is something different.

"We wanted to provide editors with a real programming language," says Rob Lanphier, the director of platform engineering at the Wikimedia Foundation, the not-for-profit that oversees the online encyclopedia. "This will make things easier for editors, but it will also be significantly faster."

It's yet another way that the art of programming is slowly trickling down from the elite technicians of the world to the Average Joe. Companies such as Codecademy are actively looking to teach all sorts of programming skills to everyone and their brother. Google, MIT, and others are building new languages that significantly simplify how software code is built. And the web makes it so easy to put the appropriate tools in your hand. Wikipedia -- the most successful crowd-sourced site on the net -- is the extreme example.

According to the Wikimedia Foundation, over 84,000 people edit Wikipedia or its sister sites at least five times a month. Not all of them are coders, and certainly, not all of them know Lua. But the new tools will turn them into Lua coders -- or at least some of them.

"We're not evangelical about turning everyone into a coder," says Lanphier. "But it certainly would make our lives easier if they were."

Indeed, Lanphier and Wikipedia embraced Lua because their old tools were slowing things down. Previously, editors used things called templates to reuse material on multiple pages across the site. The information box that shows up on the right-hand side of George Peppard's biography? That's based on a template. So too are the little "citation needed" tags that annotate so many Wikipedia articles. These did the job, but as they piled up -- and editors used them to do things they weren't designed to do -- they put a serious drag on the editing process.

If you were editing a page like the one on Hawaii congressional representative Tulsi Gabbard, Wikimedia says, you would need a good 30 seconds to redraw it and reload it. "Templates became more and more complicated over the years," Lanphier explains. "The template language evolved into something like a programming language, but it was never designed to a be a programming language."

So, the Foundation moved to Lua, a language created in 1993 by a group of computer science professors in Brazil. Lua is a scripting language, meaning it's relatively easy to use and it's specifically designed to automate the execution of oft-repeated tasks. It's widely use in the online gaming community. The massively multiplayer game World of Warcraft, for instance, lets you customize its interface with Lua.

Wikimedia chose Lua because it's specifically designed for embedding code amidst other things and because it lets site administrators carefully control how that code is executed. The code runs in a sandbox -- meaning it's designed not to interfere with the stuff around it -- and it provides detailed controls for limiting how much computing power it can use. "We're able to constrain things such that we don't have to worry about an author accidentally -- or on purpose -- changing an article in such a way that it brings down our servers. We can limit how much CPU time any one given script can use."

Why not use JavaScript, the web's standard scripting language? Lanphier says that Lua's CPU and memory controls will do a better job at keeping Wikipedia's servers from becoming overloaded. "That's Lua's bread and butter," he says. Certainly, Lua isn't nearly as popular as JavaScript, but many of the same concepts apply. And as Lanphier explains, anyone can teach themselves to program in Lua simply by looking at sample code embedded in an existing article.

Wikipedia doesn't just provide the programming tools. In a way, it also shows you how to use them.