Friday, June 5, 2009

Coding for Kim Jong-il

You are on the plane from Seattle to Beijing when your 747 makes an emergency landing at a military landing strip in North Korea. Korean security forces quickly dispose of the crew and the passengers (the "Dear Leader" ( likes the plane and wants to keep it for himself by faking a crash), but you are spared because they learn that you are a software developer working one of the best software companies in the world.

As you learn shortly from a personal audience with the "Dear Leader" himself, Kim Jong-il - protected by a nuclear shield - is now ready to branch into software development. His goal is to build North Korea into a technology powerhouse - with a market share as strong that of Microsoft and Google, and with employees as tightly controlled as Apple's.

So you are given a choice of potential technologies one of which you will need to build in the span of one year. At the end of the year, your work will be evaluated solely on a technical success (i.e. you are not expected to win a competition with existing products, but you are expected to build something that is competitive purely from the technical point of view).

If your code passes this evaluation, you live and potentially even reap some undisclosed benefits (the "Dear Leader" is vague on this point). If it does not, a standard process for "people who know too much" is applied to you. If you decline to cooperate, the aforementioned process is applied to you right now.

If you do agree to work on the project, you are given all possible technical means to achieve your task - an unlimited number of computers (clients and server), special dedicated fiber to the Internet, etc. You are allowed to read research papers, but not source code - including, but not limited to, any open source project. Your code must be 100% clean room implementation!

No pre-existing software infrastructure is available, other than a C++/Java/C# compiler, a text editor of your choice, and your choice of a version of Windows or Linux as an operating system.

As a first step, you get to chose the project you will be working on. The options are:
(1) C++ compiler
(2) A general-purpose database engine
(3) A general-purpose Internet search engine
(4) An operating system

Which project would you choose, and why?


DzembuGaijin said...

Can I pick OS X and Obj C ? Say I may be masochistic mfkr :-)

Also, what I will have to build? This is very vague.

Talking seriously, why no course code and why pick proprietary OS? Also C# that is not very valuable without all .NET and Frameworks crap. :-)

While it can be a nice idea for a book :-) we know what Chinese picked for "Kilin" :-) ( 95% BSD ) for similar purpose. They probably used C/C++ to change it I would assume plus some scripts.

But bottom line: Last choice for dictator will be ANY of Microsoft s/w :-) Do you want your heads removed when Microsoft will kick some software update, virus strike or DRM will change screen picture of "Dear Chairman" to Black ( your dirty Korean pirates - happened to Chinese - true story)?

So, obviously some kind of Linux: Google use it. Apple build OS X on top of it ( Debian? ). It make be hard to work with but probably no surprises.

OS X will make a nice choice I think as well, if we do not need all the src code.

But wait, you said no src code, right? So, how we suppose to code? How we suppose to learn a correct "chain" of commands and correct parameters to use? This shit is still mainly undocumented and if it is, it probably a src code snippets.

So, great start for a story, but goal is not defined and artificial limitations: say, no clean room. That is a BS that dictator will not care. Microsoft will :-)

Илья Казначеев said...

C++ is one of the worst programming languages imaginable; and it's also damn big; and it's unparseable. It's ruled out.
General-purpose databases aren't fun: SQL sucks (no trees, no indexed lists, a lot of expectations), Oracle and DB2 are very advanced but PostgreSQL and even SQLite is actually enough for 95% things, so there's no point.
Operating systems take ten years; Joel is adamant on it, and I'm pretty convinced. You've got one. And also you need to work with hardware, which is kind of not fun.
This kind of leaves us with *search engine*.
It can be prototyped in a year (sites go live from scratch in that time), there are a lot of interesting ideas there (image search that doesn't sucks, fact extraction, wikipedia integration, social features), it's damn fun!
Plus, North Korean google will be like ten bings, 90% search hits for a few days.
And what if it sticks?

Илья Казначеев said...

Can't keep myself from.

Sergey Solyanik said...

To Ilya:

Don't forget that no infrastructure is available :-). For search, you're building massively parallel crawler, the distributed file system (a la GFS), a distributed indexer, etc. etc. etc.

Also, don't forget that modern search engines are near-real time on some subset of the data. :-)

Anonymous said...

(1) Takes years to implement. Impossible task for a programmer who has one year.
(2) Feasible task. There are examples (some of them are widely known) of a DB management systems implemented by just one programmer in short period of time.
(3) More complex, but also feasible task.
(4) Impossible to implement in one year (if we are talking about general purpose (desktop) OS)

Илья Казначеев said...

Sergey Solyanik:
Well, it doesn't make sence.

For example, you couldn't use Xalan for XSLT and Rhino for JS when they weren't part of JDK, but you can now since they are?

I'd recommend you to stick to "you can use any open source libraries while they decrease yak shaving, not in your primary area."
For example, when making a database, you can use lucene, but no hsql; when making a search engine, you can use hsql, but no nutch.
In Java-Land, 90% of open-source are libraries anyway.

Also. Does "general-purpose" DB mean SQL and stuff?
If not, I think I might make a Document DB like CouchDB, but with blackjack and whores.
Less fun, more real.

Илья Казначеев said...

On the second thought:
Compiler and Database are
Hard problems, but search engine and OS are Very Hard.

Therefore, you can get fully cleanroom on former, but you need to harness all the libraries' richness for the latter.

NS said...

You mean Ballmer has progressed from throwing chairs to shooting people?


Like you pointed out a while ago, you can't create competitive stuff without interacting with other people in the field, which presumably you don't get to. In that sense, the choice of the product does not matter: if it's North Korea, you've already failed. The correct choice would be to gently extend your middle finger in the general direction of Dear Leader and smile politely.

Sergey Solyanik said...

Actually, I said that it's much harder to do R&D in isolation, but not impossible :-). Nuclear weapons is one such problems - always very secretive, not much interaction with other development teams, but it does get done.

Especially if the alternative is to get a bullet between one's eyes :-).