Shortest Wiki Contest

Ward's Wiki code (WikiBase) is amazingly elegant and short. But it was just a bit of Perl-4. What's the shortest piece of source you can write that will implement a fully-featured wiki? Use any language you like. See WikiPrinciples for a list of the (minimum) requirements for a wiki.

The contenders under 50 lines (WikiPrinciples obeyed):

The contenders under 50 lines (WikiPrinciples not obeyed):

The contenders under 2 lines (dubious):


Of course, the shortest source implementing a fully-featured Wiki is written in the WikiPlusPlus? language (implementation of which is left as an exercise to the reader). It looks something like this:

	wiki^standard: run
I got a "Cross-Search Time-out Error on Line 1". Can you help me fix it? :-)
Does storing the HTML as templates in separate files, rather than in the source code count as SLOC? Could be a loophole there.

Since mixing HTML and code is generally discouraged, I would have to say templates are fair. Templates will also be small and not interesting to optimize anyway.
Tough talk

My money's on WardCunningham. Language: Perl. -- TimVoght

Thanks for your confidence Tim. My wiki/4 was 220 lines of perl in its first working version, though it has grown since. I got rid of dispatching by writing it as cooperating cgi scripts: wiki.cgi, edit.cgi, post.cgi, search.cgi and changes.cgi. I bet it could be done in 100 lines. -- WardCunningham

Perl is definitely the language. I'm not sure Ward is twisted enough to win. -- CliffordAdams

That's mighty big talk round these here parts, Clifford. Me, I'd back python/zope to beat out perl in shortness on account of there seems like a lot in zope to leverage. But I also wonder whether some Interdev magic might put the freeware to shame... -- PeterMerel

I'd bet that the proprietary KayLanguage from http://www.kx.com will surpass any 0known experience with concise programming. When programming in K, one refers to characters of code, not lines. And there are usually no loops. -- EricNewhuis that sounds a lot like APL, which was much more widespread. The KayLanguage is a descendant of APL, among others, so that isn't surprising. APL is very concise but not 'optimized' for web/text processing, so I doubt it would be *the* shortest.

Come on! You Python people can't let these two go unchallenged!

Can't? Why not? "What is the shortest time a third party reader needs to understand another person's WikiSource?" That would be a more useful measurement.

I concur. I looked at a short perl wiki, and it left me aghast. Then I looked at wypy with all the lambda and RE, and was again floored. When I look at my VERBOSE procedural programming, it reads like Dick and Jane at the compsci lab. Which means any reasonably literate wannabe geek can comprehend it. I propose a competition for the EASIEST TO COMPREHEND WIKI. -- KirkBailey

The 23 line Python contender WyPy currently (2003-08) wipes the floor with all the other submissions, but I wouldn't call it exactly readable, unfortunately. Still, ObfuscatedPython is possible then...

I thought Dinki was rather easy to understand, and it's in Perl. Unfortunately, the source appears to have gone missing.


I see WyRiki was just added - at 20 lines of Ruby. But I'm sure that a bunch of useless new lines could be removed, to make it "shorter."

How long is a "line?" 80 characters

Next up: The ObfuscatedWikiContest?. ;->

I'm sure that something like "#!/bin/sh\nGET http://wiki.tld/ | perl" would make for a much shorter wiki, but that'd be cheating now, wouldn't it? Perhaps it's as best to limit this competition to some major languages (Python, Perl, Ruby, PHP seem the best contenders)? I hope that everyone enjoys the new WyPy: WyRiki's introduction was quite a challenge! -- SeanPalmer

Anybody up for the challenge of SmallestXhtmlWikiContest??

It appears to me that it would be quite different as simple regular expressions no longer work. When you see \n\n, a simple implementation will put in <p>, an xhtml wiki has to analyze all the appropriate closing tags before continuing. I'm also curious about how implementations deal with such things as between <strong><em></em></strong> and <em><strong></strong></em>. I'd also expect as much semantic correctness as possible. For example consecutive list items should be contained within <ul></ul>.

Well since XhtmlIsDead, I see this as rather pointless.

How about a MostReadableShortestWiki?, what good is code that can't be read in any decent timeframe?

Define readable, and write a computer program to measure it for a given piece of code.

It would seem that the challenge has come to the point of counting in characters instead of lines.

In which case, common standards are needed - "cols=9" is somewhat extreme!

I've learned that Perl is better than PHP for short programming, yet! :o) -- Jaramir (see: MuWiki)
 In general, yes. But see my implementation (WiPhiki - PHP + Bash) which is shorter than 5 other Perl implementations. -- Smasty


See also: EasiestInstallableWikiContest, SlowestWikiContest, WikiLympics


CategoryWikiImplementation

EditText of this page (last edited September 30, 2012) or FindPage with title or text search