# If Hemingway (and Shakespeare, and co) were coders

Fat XXX's "If Hemingway wrote JavaScript" is a great piece of imaginative writing, speculating about the coding styles that various literary titans (Shakespeare, Hemingway, Dickens, Breton and more) would have employed:

function theSeriesOfFIBONACCI(theSize) {

//a CALCKULATION in two acts.
//employ'ng the humourous logick of JAVA-SCRIPTE

//Dramatis Personae   var theResult; //an ARRAY to contain THE NUMBERS
var theCounter; //a NUMBER, serv'nt to the FOR LOOP

//ACT I: in which a ZERO is added for INITIATION

//[ENTER: theResult]

//Upon the noble list bestow a zero   var theResult = [0];

//ACT II: a LOOP in which the final TWO NUMBERS are QUEREED and SUMM'D

//[ENTER: theCounter]

//Commence at one and venture o'er the numbers
for (theCounter = 1; theCounter < theSize; theCounter++) {
theResult[theCounter] = (theResult[theCounter-1]||1) + theResult[Math.max(0, theCounter-2)];   }

//'Tis done, and here's the answer.
return theResult;

//[Exuent] }

### 14

1. reglisse says:

Ouch!> Theq
> uo ti
> ngis don> ein them o
> stun for tuna
> te man> ner.

2. If Shakespeare wrote code, we’d still be using it today, & building new languages to support it.  If Hemingway wrote code, it would be taught in school, have the virtue of brevity but be one of those highly over-rated programing languages that people go on about but no one actually uses.  Except that great 10 IF  sale = “baby shoes” 20 THEN ? never used piece of coding, that is admittedly pretty great.

1. fuzzyfuzzyfungus says:

Isn’t Hemingway the one who wrote The Old Man and the C, and cemented the status of big beards and minimalist interfaces in UNIX-user culture? I’m pretty sure I’ve heard of him…

3. It shows that the author doesn’t like Dickens. I do. However, I don’t know Javascript and shan’t learn it for this purpose.
Had I written this piece in “Dickens’ Javascript”, it should have depicted Mr Fibbowick collecting the number 0 and 1, then repairing towards his chamber where he would, with much ado, have forced poor little David to add them in an uncomfortable way to make a third, taken it, left the chamber again and proclaimed the result in a fashion such as to make sure every person in hearing range knew about the ingenious discovery he, Mr. Fibbowick, had just made regarding the n+1’th number in the sequence, then waited for whether another number is required, whereupon the whole spectacle would start over.

Dickens was not an author concerned with deep psychological studies, he was a caricaturist, and he had an agenda. One, I might add, that was well worth pursuing in his time, in his country.

1. fuzzyfuzzyfungus says:

Conveniently, Progress and The Shining Future have made available a system for farming out grindingly menial tasks to the underpaid underclass within the convenient framework of javascript!

http://groups.csail.mit.edu/uid/turkit/

(It lacks all stylistic relation to Dickens; but ‘Mechanical Turk’ is arguably one of the more eloquent middle-finger-in-the-eye-of-the-idea-of-technology-as-human-empowerment systems presently available to customers who aren’t intelligence agencies.)

4. Yeesh. This is simply “code comments written in the style of [your favorite author of yore].” Surmising why Javascript is more appropriate for any given author is an exercise in futile speculation; it could just as easily be done in any other language, and wouldn’t be any more or less amusing.

You want something funnier? Try writing examples of code (not comments) whose whose syntax mimics that of a given author. I’ll leave it as an exercise to the reader.

1. If you read the linked article you will find, perhaps to your great amusement, that there -are- examples of  code (not comments) written in the style of the artists mentioned. As the author explains, the Bard makes a lot of comments.

1. I did read the article. Apparently I’m not well versed enough in the subtleties of the authors mentioned to find the code samples amusing. If you strip away the comments, they’re basically ordinary code, liberally sprinkled with comments and the occasional string that is related to the “author”.

5. toyg says:

I am now craving for Javascript snippets by F.S.Fitzgerald. It would give you the wrong results, but with such beauty and grace that you wouldn’t really care.

6. Beanolini says:

ACT I: in which a ZERO is added for INITIATION

I’m pretty sure that is actually valid COBOL.

7. Sebastian Liem says:

This reminds me of the Shakespeare programming language [1]. I remember it fondly, we had a drunken programming contest to compute the first five primes. Many great works of literature was composed.

[1]: http://shakespearelang.sourceforge.net/report/shakespeare/shakespeare.html

1. Chentzilla says:

A good one, this.

Have you got any code left?

8. Jorpho says:

And there it is – the first time I’ve been directed to an .xxx site, and of course it has nothing whatsoever to do with pornography.