Greenspun rule

News Back to basics Recommended Books Recommended Links The Second System Effect Parkinson Law Unix Component Model
Conceptual Integrity Brooks law Conway Law Featuritis Premature Optimization is the root of all evil The Second System Effect  
Cargo cult programming Real Insights into Architecture Come Only From Actual Programming Program Understanding Software Prototyping Programming as a Profession Project Management  
Pipes Scripting Open Source and Bloatware History Humor Software engineering quotes Etc

Greenspun's tenth rule of programming is an aphorism in computer programming and especially programming language circles that states:[1][2]

Any sufficiently complicated C or Fortran program contains an ad hoc, informally-specified, bug-ridden, slow implementation of half of Common Lisp.

This expresses the opinion that the perceived flexibility and extensibility designed into the Lisp programming language includes all functionality that is theoretically necessary to write a complex computer program, and that the core implementations of other programming languages often do not supply critical functionality necessary to develop complex programs.

The rule was written sometime around 1993 by Philip Greenspun. Although it is known as his tenth rule, there are in fact no preceding rules, only the tenth. The reason for this according to Greenspun:

Sorry, Han-Wen, but there aren't 9 preceding laws. I was just trying to give the rule a memorable name.[3] [edit] MeaningLisp syntax is barely abstract; Lisp programs are constructed as trees of S-expressions, which are equivalent to the abstract syntax trees that compilers of other languages create internally. As a homoiconic language, Lisp also makes no distinction between code and data; Lisp programs are themselves just Lisp data structures. Lisp programs can thus generate additional Lisp programs themselves via macros. As a result, the programmer can construct complex domain specific languages with relative ease. Lisp advocates such as Paul Graham claim that this allows faster construction of more robust software compared to other languages.[4] Common Lisp, specifically, has quite large standard library with large number of functions with flexible interfaces, that capture many programming paradigms (like remove, reduce, map, etc.).

Greenspun's Rule expresses the opinion that these capabilities are necessary for any complex software package, and so will be redesigned from scratch in an ad hoc manner in any large project, duplicating effort already exerted in Common Lisp.

Morris's corollary

Well-known hacker Robert Morris later enounced a corollary which clarifies the set of "sufficiently complicated" programs to which the rule applies:

…including Common Lisp.[5]

This can be viewed as a commentary on the difficulty of creating an efficient implementation of the large and complex Common Lisp language, or simply a joke about Lisp's eval function. Both Greenspun's rule and Morris's corollary are examples of a characteristic style of hacker humor known as "ha ha only serious".[6]

Talk:Greenspun's tenth rule

From Wikipedia, the free encyclopedia

Jump to: navigation, search



I cut this:

"This refers to complex software that is made scriptable, and then gradually evolves a more comprehensive scripting language. Examples can be user-defined functions in Microsoft Excel, HTML and ECMAScript, XSLT, and even MediaWiki through template substitution (as beta reduction)"

This is incorrect. It is based on a misinterpretation of Philip's Rule. Philip's Rule neither requires a scripting language, nor are most scripting language functional. I'll give an analogy: In much the same way as GTK implements object oriented programming on top of C, most complex system eventually implement some subset of functional programming language on top of C. This isn't necessarily externally visible. It might be some dude hacking on a calculator program, and finds he wants the user to be able to compose expresions: f(x)=g(h(x)), so implements a data structure of a linked list of function pointers, emulating closures, poorly. Another guy implements reference counting by overriding operators in C++, to make memory management easier for some type of object. As systems get more complex, these hacks get more complex, and eventually you end up with half of Lisp/Scheme/... in the program, only implemented badly. 22:00, 21 October 2007 (UTC)

That's a good point - that's much more about software bloat or featuritis. I've merged those removed sentences to those articles. --Gwern (contribs) 00:41 23 October 2007 (GMT)

[edit] Misssing

"That doesn't change the fact that, to many users, those things are all completely irrelevant if they can't easily open a socket, connect to a database, spawn a process, stat a file, open a pipe, send a datagram, throw a window on the screen, match a string against a regular expression, encrypt a string, use the syslog facility, parse CGI environment variable values, parse urls, send mail, read mail, send a file via ftp, read a file via ftp, start an nntp session, parse an xml file, manipulate image files, manipulate sound files, ..." - Gabe Garza

FFI and MOP are missing from the standard, too.

I think the article needs a complete overhaul. It should take into account that a lot has happened since the Common Lisp language standard came out. It should explain, too, that big ("diagonal") languages are also needed and that you need experience implementing them - the niche (once) filled by Common Lisp. --Anon.

That sounds like anti-Lisp bias to me. At the very least, that account doesn't represent a gaping hole, so I'm going to take the cleanup off at this point and I suggest Anon tag this as unbalanced if they feel their view is neutral. Vagary 20:20, 11 August 2006 (UTC)

[edit] Greenspun's motivation

"You can certainly edit the wikipedia if you like, though I'm not sure it is that interesting. I just thought it sounded better to have a 10th rule, as though it were part of a comprehensive system."

Is an email I recieved from Greenspun, how would I put that up for citation? I have the full email in my GMail account.

Post it to some website. TOTSE is one possibility, but I'm sure you can think of others. --maru (talk) contribs 00:14, 25 July 2006 (UTC)

[edit] Possible example

I recently added to Common Lisp a quote by Paul Graham in which he says that Yahoo's rewrite of Yahoo Store is a perfect example of this rule. Should this be added to the article? --maru (talk) contribs 20:54, 21 August 2006 (UTC)

Absolutely; he mentions the Tenth Rule in the quote, so he obviously thinks it's an example. (I'm not so sure; it was after all in Lisp to start with). EdC 21:35, 21 August 2006 (UTC)
Well, perhaps it originally being in Lisp makes it even better as an example, along the lines of "This application was so awesome we had to write it in Lisp, and when fools tried to rewrite it in a lesser language, they had no choice but to include a Lisp interpreter, that's just how pathetic their chosen languages were."? --maru (talk) contribs 21:57, 21 August 2006 (UTC)

[edit] Leonard part 6?

Why is that See also link there? —Preceding unsigned comment added by (talk) 17:05, 4 December 2007 (UTC)

No idea. Removed. Thanks. EdC (talk) 02:37, 5 December 2007 (UTC)

[edit] Preventing the perception of original research

I've requested cites on a few things to ensure the article doesn't start looking like original research here... Greenspun's quote (which someone said they had a source for), the "ha ha only serious" statement, and the generalization. If I Google for the text of the claimed generalization, I don't see any obvious reliable sources to source it to, so it's in question... --Ds13 (talk) 20:41, 18 April 2008 (UTC)

'ha ha only serious' is in the jargon file I believe, if that is what the query is on, the link is I would reference it myself, but i'm a lurker, and know hardly any wiki script, including how to do this ^_^ if someone else wants to, feel free. SirEelBiscuits (talk) 21:20, 14 May 2008 (UTC)
I don't think the {{fact}} is there questioning the existence of the 'ha ha only serious' concept, but that the rule is an example of such humor, if you follow. --Gwern (contribs) 00:51 15 May 2008 (GMT)
Well, given that the page i linked is a description of the meaning of haha only serious, and describes what it means, it should be adequate amirite? And it's from the definitive list of computer scientists slang, so it's about as reliable as it gets. (even now references the jargon file) SirEelBiscuits (talk) 10:55, 16 May 2008 (UTC)
Again, the fact isn't there doubting what ha only serious means, it isn't doubting that it exists. It doubts that Greenspun's Rule is humor; that it is in particular an example of 'ha ha only serious' humor; and that the Rule is not a serious and cogent analysis of programming techniques, much like the Design Patterns by the Gang of Four (which as risible as many of them seem to users of 'better' languages, can't be classified as 'ha ha only serious').
I don't know how much clearer I can explain why the cite is not useful. --Gwern (contribs) 01:50 17 May 2008 (GMT)

[edit] ha ha only serious

I have the opposite question myself. The only place I've ever seen the phrase "ha ha only serious" is in the jargon file. I wonder if that phrase is actually in common use, and I also wonder if there's really anything unique about "hackers" in this respect -- programmer's are hardly the inventors of "truth in jest". -- Doom (talk) 04:31, 22 November 2008 (UTC)

Well, keep in mind the origins of the Jargon File - there's stuff in it that go back to the MIT Model Railroad Club in the '50s (or '40s?). Plenty of the entries are no longer in live usage, just as there are many contemporary hacker terms which are not in it. --Gwern (contribs) 21:00 23 November 2008 (GMT)

[edit] Prolog Follow-up

I am tempted to add to the Prolog follow-up section the example of Paradigms of Artificial Intelligence Programming, where all the code examples in the book are in Lisp, until such time that the author, Peter Norvig, describes a Prolog interpreter, after which time all code examples are in Prolog. Atannir (talk) 17:29, 28 January 2009 (UTC)

Well, since I am not that familiar with the history of Lisp, I have also discovered that Paul Graham does a very similar thing in On Lisp... Norvig is mentioned in the reference provided for the functional language quote as well. Atannir (talk) 20:12, 23 February 2009 (UTC)

[edit] So where is lisp+prolog+erlang?

Honestly, I understand the aphorism well, as I code in scheme, layered on top of a C++ structure that is prolog-like. And would like to have erlang or scala (programming language)-like features. What language *should* I code in? Does this language exist? linas (talk) 17:08, 1 September 2009 (UTC)

[edit] NoSQL

Any sufficiently complicated NoSQL program contains an ad hoc, informally-specified, bug-ridden,slow implementation of half of SQL

I don't think it's worthy of including in the article (yet?), but let it remain here for posterity Dmitriid (talk) 07:12, 3 December 2010 (UTC)

[edit] Erlang quote

The referenced email for the quote regarding erlang doesn't seem related to the article, and doesn't contain the quote in question. This [1] message contains the quote, with attribution to Robert Virdig, although a follow-up indicates a prior usage (with broken link). There are a couple of quotes of this: [2] and [3] attributing it to Virdig. (talk) 19:53, 25 March 2011 (UTC)

[edit] generalization to functional language?

Common Lisp is not a functional language (given the examples, the intent was clearly to talk about purely functional languages) and also Greenspun's Tenth Rule is not limited to functional language features of Lisp, so the pretended Generalization makes no sense, which matches with the fact that nobody seems to ever had heard it before. Instead of merely suggesting to remove it, I'm doing it right now because i fear mere suggestion will lead nowhere in any reasonable timeframe. If somebody thinks i'm wrong in my analysis, restore it and explain why here. -- (talk) 23:50, 6 August 2011 (UTC)

[edit] Backwards interpretation

The "Meaning" section is completly off the mark; it for some reason starts off talking about Lisp syntax and macros... whereas any recovering C++/Fortran vetran can tell you that the beef is in the features common with today's popular dynamic languages including automatic memory management, high level data structures and strong typing.


Greenspun 10th law of programming

c - Greenspun's Tenth Rule, does every large project include a Lisp interpreter - Programmers

c++ - Does every large project include a Lisp …

Greenspun's Tenth Rule- 9786201337916- Books

Philip Greenspun's Research

Obtaining GSview 5.0