avg.txt 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375
  1. Want to start a startup? Get funded by
  2. Y Combinator.
  3. April 2001, rev. April 2003(This article is derived from a talk given at the 2001 Franz
  4. Developer Symposium.)
  5. In the summer of 1995, my friend Robert Morris and I
  6. started a startup called
  7. Viaweb.
  8. Our plan was to write
  9. software that would let end users build online stores.
  10. What was novel about this software, at the time, was
  11. that it ran on our server, using ordinary Web pages
  12. as the interface.A lot of people could have been having this idea at the
  13. same time, of course, but as far as I know, Viaweb was
  14. the first Web-based application. It seemed such
  15. a novel idea to us that we named the company after it:
  16. Viaweb, because our software worked via the Web,
  17. instead of running on your desktop computer.Another unusual thing about this software was that it
  18. was written primarily in a programming language called
  19. Lisp. It was one of the first big end-user
  20. applications to be written in Lisp, which up till then
  21. had been used mostly in universities and research labs. [1]The Secret WeaponEric Raymond has written an essay called "How to Become a Hacker,"
  22. and in it, among other things, he tells would-be hackers what
  23. languages they should learn. He suggests starting with Python and
  24. Java, because they are easy to learn. The serious hacker will also
  25. want to learn C, in order to hack Unix, and Perl for system
  26. administration and cgi scripts. Finally, the truly serious hacker
  27. should consider learning Lisp:
  28. Lisp is worth learning for the profound enlightenment experience
  29. you will have when you finally get it; that experience will make
  30. you a better programmer for the rest of your days, even if you
  31. never actually use Lisp itself a lot.
  32. This is the same argument you tend to hear for learning Latin. It
  33. won't get you a job, except perhaps as a classics professor, but
  34. it will improve your mind, and make you a better writer in languages
  35. you do want to use, like English.But wait a minute. This metaphor doesn't stretch that far. The
  36. reason Latin won't get you a job is that no one speaks it. If you
  37. write in Latin, no one can understand you. But Lisp is a computer
  38. language, and computers speak whatever language you, the programmer,
  39. tell them to.So if Lisp makes you a better programmer, like he says, why wouldn't
  40. you want to use it? If a painter were offered a brush that would
  41. make him a better painter, it seems to me that he would want to
  42. use it in all his paintings, wouldn't he? I'm not trying to make
  43. fun of Eric Raymond here. On the whole, his advice is good. What
  44. he says about Lisp is pretty much the conventional wisdom. But
  45. there is a contradiction in the conventional wisdom: Lisp will
  46. make you a better programmer, and yet you won't use it.Why not? Programming languages are just tools, after all. If Lisp
  47. really does yield better programs, you should use it. And if it
  48. doesn't, then who needs it?This is not just a theoretical question. Software is a very
  49. competitive business, prone to natural monopolies. A company that
  50. gets software written faster and better will, all other things
  51. being equal, put its competitors out of business. And when you're
  52. starting a startup, you feel this very keenly. Startups tend to
  53. be an all or nothing proposition. You either get rich, or you get
  54. nothing. In a startup, if you bet on the wrong technology, your
  55. competitors will crush you.Robert and I both knew Lisp well, and we couldn't see any reason
  56. not to trust our instincts and go with Lisp. We knew that everyone
  57. else was writing their software in C++ or Perl. But we also knew
  58. that that didn't mean anything. If you chose technology that way,
  59. you'd be running Windows. When you choose technology, you have to
  60. ignore what other people are doing, and consider only what will
  61. work the best.This is especially true in a startup. In a big company, you can
  62. do what all the other big companies are doing. But a startup can't
  63. do what all the other startups do. I don't think a lot of people
  64. realize this, even in startups.The average big company grows at about ten percent a year. So if
  65. you're running a big company and you do everything the way the
  66. average big company does it, you can expect to do as well as the
  67. average big company-- that is, to grow about ten percent a year.The same thing will happen if you're running a startup, of course.
  68. If you do everything the way the average startup does it, you should
  69. expect average performance. The problem here is, average performance
  70. means that you'll go out of business. The survival rate for startups
  71. is way less than fifty percent. So if you're running a startup,
  72. you had better be doing something odd. If not, you're in trouble.Back in 1995, we knew something that I don't think our competitors
  73. understood, and few understand even now: when you're writing
  74. software that only has to run on your own servers, you can use
  75. any language you want. When you're writing desktop software,
  76. there's a strong bias toward writing applications in the same
  77. language as the operating system. Ten years ago, writing applications
  78. meant writing applications in C. But with Web-based software,
  79. especially when you have the source code of both the language and
  80. the operating system, you can use whatever language you want.This new freedom is a double-edged sword, however. Now that you
  81. can use any language, you have to think about which one to use.
  82. Companies that try to pretend nothing has changed risk finding that
  83. their competitors do not.If you can use any language, which do you use? We chose Lisp.
  84. For one thing, it was obvious that rapid development would be
  85. important in this market. We were all starting from scratch, so
  86. a company that could get new features done before its competitors
  87. would have a big advantage. We knew Lisp was a really good language
  88. for writing software quickly, and server-based applications magnify
  89. the effect of rapid development, because you can release software
  90. the minute it's done.If other companies didn't want to use Lisp, so much the better.
  91. It might give us a technological edge, and we needed all the help
  92. we could get. When we started Viaweb, we had no experience in
  93. business. We didn't know anything about marketing, or hiring
  94. people, or raising money, or getting customers. Neither of us had
  95. ever even had what you would call a real job. The only thing we
  96. were good at was writing software. We hoped that would save us.
  97. Any advantage we could get in the software department, we would
  98. take.So you could say that using Lisp was an experiment. Our hypothesis
  99. was that if we wrote our software in Lisp, we'd be able to get
  100. features done faster than our competitors, and also to do things
  101. in our software that they couldn't do. And because Lisp was so
  102. high-level, we wouldn't need a big development team, so our costs
  103. would be lower. If this were so, we could offer a better product
  104. for less money, and still make a profit. We would end up getting
  105. all the users, and our competitors would get none, and eventually
  106. go out of business. That was what we hoped would happen, anyway.What were the results of this experiment? Somewhat surprisingly,
  107. it worked. We eventually had many competitors, on the order of
  108. twenty to thirty of them, but none of their software could compete
  109. with ours. We had a wysiwyg online store builder that ran on the
  110. server and yet felt like a desktop application. Our competitors
  111. had cgi scripts. And we were always far ahead of them in features.
  112. Sometimes, in desperation, competitors would try to introduce
  113. features that we didn't have. But with Lisp our development cycle
  114. was so fast that we could sometimes duplicate a new feature within
  115. a day or two of a competitor announcing it in a press release. By
  116. the time journalists covering the press release got round to calling
  117. us, we would have the new feature too.It must have seemed to our competitors that we had some kind of
  118. secret weapon-- that we were decoding their Enigma traffic or
  119. something. In fact we did have a secret weapon, but it was simpler
  120. than they realized. No one was leaking news of their features to
  121. us. We were just able to develop software faster than anyone
  122. thought possible.When I was about nine I happened to get hold of a copy of The Day
  123. of the Jackal, by Frederick Forsyth. The main character is an
  124. assassin who is hired to kill the president of France. The assassin
  125. has to get past the police to get up to an apartment that overlooks
  126. the president's route. He walks right by them, dressed up as an
  127. old man on crutches, and they never suspect him.Our secret weapon was similar. We wrote our software in a weird
  128. AI language, with a bizarre syntax full of parentheses. For years
  129. it had annoyed me to hear Lisp described that way. But now it
  130. worked to our advantage. In business, there is nothing more valuable
  131. than a technical advantage your competitors don't understand. In
  132. business, as in war, surprise is worth as much as force.And so, I'm a little embarrassed to say, I never said anything
  133. publicly about Lisp while we were working on Viaweb. We never
  134. mentioned it to the press, and if you searched for Lisp on our Web
  135. site, all you'd find were the titles of two books in my bio. This
  136. was no accident. A startup should give its competitors as little
  137. information as possible. If they didn't know what language our
  138. software was written in, or didn't care, I wanted to keep it that
  139. way.[2]The people who understood our technology best were the customers.
  140. They didn't care what language Viaweb was written in either, but
  141. they noticed that it worked really well. It let them build great
  142. looking online stores literally in minutes. And so, by word of
  143. mouth mostly, we got more and more users. By the end of 1996 we
  144. had about 70 stores online. At the end of 1997 we had 500. Six
  145. months later, when Yahoo bought us, we had 1070 users. Today, as
  146. Yahoo Store, this software continues to dominate its market. It's
  147. one of the more profitable pieces of Yahoo, and the stores built
  148. with it are the foundation of Yahoo Shopping. I left Yahoo in
  149. 1999, so I don't know exactly how many users they have now, but
  150. the last I heard there were about 20,000.
  151. The Blub ParadoxWhat's so great about Lisp? And if Lisp is so great, why doesn't
  152. everyone use it? These sound like rhetorical questions, but actually
  153. they have straightforward answers. Lisp is so great not because
  154. of some magic quality visible only to devotees, but because it is
  155. simply the most powerful language available. And the reason everyone
  156. doesn't use it is that programming languages are not merely
  157. technologies, but habits of mind as well, and nothing changes
  158. slower. Of course, both these answers need explaining.I'll begin with a shockingly controversial statement: programming
  159. languages vary in power.Few would dispute, at least, that high level languages are more
  160. powerful than machine language. Most programmers today would agree
  161. that you do not, ordinarily, want to program in machine language.
  162. Instead, you should program in a high-level language, and have a
  163. compiler translate it into machine language for you. This idea is
  164. even built into the hardware now: since the 1980s, instruction sets
  165. have been designed for compilers rather than human programmers.Everyone knows it's a mistake to write your whole program by hand
  166. in machine language. What's less often understood is that there
  167. is a more general principle here: that if you have a choice of
  168. several languages, it is, all other things being equal, a mistake
  169. to program in anything but the most powerful one. [3]There are many exceptions to this rule. If you're writing a program
  170. that has to work very closely with a program written in a certain
  171. language, it might be a good idea to write the new program in the
  172. same language. If you're writing a program that only has to do
  173. something very simple, like number crunching or bit manipulation,
  174. you may as well use a less abstract language, especially since it
  175. may be slightly faster. And if you're writing a short, throwaway
  176. program, you may be better off just using whatever language has
  177. the best library functions for the task. But in general, for
  178. application software, you want to be using the most powerful
  179. (reasonably efficient) language you can get, and using anything
  180. else is a mistake, of exactly the same kind, though possibly in a
  181. lesser degree, as programming in machine language.You can see that machine language is very low level. But, at least
  182. as a kind of social convention, high-level languages are often all
  183. treated as equivalent. They're not. Technically the term "high-level
  184. language" doesn't mean anything very definite. There's no dividing
  185. line with machine languages on one side and all the high-level
  186. languages on the other. Languages fall along a continuum [4] of
  187. abstractness, from the most powerful all the way down to machine
  188. languages, which themselves vary in power.Consider Cobol. Cobol is a high-level language, in the sense that
  189. it gets compiled into machine language. Would anyone seriously
  190. argue that Cobol is equivalent in power to, say, Python? It's
  191. probably closer to machine language than Python.Or how about Perl 4? Between Perl 4 and Perl 5, lexical closures
  192. got added to the language. Most Perl hackers would agree that Perl
  193. 5 is more powerful than Perl 4. But once you've admitted that,
  194. you've admitted that one high level language can be more powerful
  195. than another. And it follows inexorably that, except in special
  196. cases, you ought to use the most powerful you can get.This idea is rarely followed to its conclusion, though. After a
  197. certain age, programmers rarely switch languages voluntarily.
  198. Whatever language people happen to be used to, they tend to consider
  199. just good enough.Programmers get very attached to their favorite languages, and I
  200. don't want to hurt anyone's feelings, so to explain this point I'm
  201. going to use a hypothetical language called Blub. Blub falls right
  202. in the middle of the abstractness continuum. It is not the most
  203. powerful language, but it is more powerful than Cobol or machine
  204. language.And in fact, our hypothetical Blub programmer wouldn't use either
  205. of them. Of course he wouldn't program in machine language. That's
  206. what compilers are for. And as for Cobol, he doesn't know how
  207. anyone can get anything done with it. It doesn't even have x (Blub
  208. feature of your choice).As long as our hypothetical Blub programmer is looking down the
  209. power continuum, he knows he's looking down. Languages less powerful
  210. than Blub are obviously less powerful, because they're missing some
  211. feature he's used to. But when our hypothetical Blub programmer
  212. looks in the other direction, up the power continuum, he doesn't
  213. realize he's looking up. What he sees are merely weird languages.
  214. He probably considers them about equivalent in power to Blub, but
  215. with all this other hairy stuff thrown in as well. Blub is good
  216. enough for him, because he thinks in Blub.When we switch to the point of view of a programmer using any of
  217. the languages higher up the power continuum, however, we find that
  218. he in turn looks down upon Blub. How can you get anything done in
  219. Blub? It doesn't even have y.By induction, the only programmers in a position to see all the
  220. differences in power between the various languages are those who
  221. understand the most powerful one. (This is probably what Eric
  222. Raymond meant about Lisp making you a better programmer.) You can't
  223. trust the opinions of the others, because of the Blub paradox:
  224. they're satisfied with whatever language they happen to use, because
  225. it dictates the way they think about programs.I know this from my own experience, as a high school kid writing
  226. programs in Basic. That language didn't even support recursion.
  227. It's hard to imagine writing programs without using recursion, but
  228. I didn't miss it at the time. I thought in Basic. And I was a
  229. whiz at it. Master of all I surveyed.The five languages that Eric Raymond recommends to hackers fall at
  230. various points on the power continuum. Where they fall relative
  231. to one another is a sensitive topic. What I will say is that I
  232. think Lisp is at the top. And to support this claim I'll tell you
  233. about one of the things I find missing when I look at the other
  234. four languages. How can you get anything done in them, I think,
  235. without macros? [5]Many languages have something called a macro. But Lisp macros are
  236. unique. And believe it or not, what they do is related to the
  237. parentheses. The designers of Lisp didn't put all those parentheses
  238. in the language just to be different. To the Blub programmer, Lisp
  239. code looks weird. But those parentheses are there for a reason.
  240. They are the outward evidence of a fundamental difference between
  241. Lisp and other languages.Lisp code is made out of Lisp data objects. And not in the trivial
  242. sense that the source files contain characters, and strings are
  243. one of the data types supported by the language. Lisp code, after
  244. it's read by the parser, is made of data structures that you can
  245. traverse.If you understand how compilers work, what's really going on is
  246. not so much that Lisp has a strange syntax as that Lisp has no
  247. syntax. You write programs in the parse trees that get generated
  248. within the compiler when other languages are parsed. But these
  249. parse trees are fully accessible to your programs. You can write
  250. programs that manipulate them. In Lisp, these programs are called
  251. macros. They are programs that write programs.Programs that write programs? When would you ever want to do that?
  252. Not very often, if you think in Cobol. All the time, if you think
  253. in Lisp. It would be convenient here if I could give an example
  254. of a powerful macro, and say there! how about that? But if I did,
  255. it would just look like gibberish to someone who didn't know Lisp;
  256. there isn't room here to explain everything you'd need to know to
  257. understand what it meant. In
  258. Ansi Common Lisp I tried to move
  259. things along as fast as I could, and even so I didn't get to macros
  260. until page 160.But I think I can give a kind of argument that might be convincing.
  261. The source code of the Viaweb editor was probably about 20-25%
  262. macros. Macros are harder to write than ordinary Lisp functions,
  263. and it's considered to be bad style to use them when they're not
  264. necessary. So every macro in that code is there because it has to
  265. be. What that means is that at least 20-25% of the code in this
  266. program is doing things that you can't easily do in any other
  267. language. However skeptical the Blub programmer might be about my
  268. claims for the mysterious powers of Lisp, this ought to make him
  269. curious. We weren't writing this code for our own amusement. We
  270. were a tiny startup, programming as hard as we could in order to
  271. put technical barriers between us and our competitors.A suspicious person might begin to wonder if there was some
  272. correlation here. A big chunk of our code was doing things that
  273. are very hard to do in other languages. The resulting software
  274. did things our competitors' software couldn't do. Maybe there was
  275. some kind of connection. I encourage you to follow that thread.
  276. There may be more to that old man hobbling along on his crutches
  277. than meets the eye.Aikido for StartupsBut I don't expect to convince anyone
  278. (over 25)
  279. to go out and learn
  280. Lisp. The purpose of this article is not to change anyone's mind,
  281. but to reassure people already interested in using Lisp-- people
  282. who know that Lisp is a powerful language, but worry because it
  283. isn't widely used. In a competitive situation, that's an advantage.
  284. Lisp's power is multiplied by the fact that your competitors don't
  285. get it.If you think of using Lisp in a startup, you shouldn't worry that
  286. it isn't widely understood. You should hope that it stays that
  287. way. And it's likely to. It's the nature of programming languages
  288. to make most people satisfied with whatever they currently use.
  289. Computer hardware changes so much faster than personal habits that
  290. programming practice is usually ten to twenty years behind the
  291. processor. At places like MIT they were writing programs in
  292. high-level languages in the early 1960s, but many companies continued
  293. to write code in machine language well into the 1980s. I bet a
  294. lot of people continued to write machine language until the processor,
  295. like a bartender eager to close up and go home, finally kicked them
  296. out by switching to a risc instruction set.Ordinarily technology changes fast. But programming languages are
  297. different: programming languages are not just technology, but what
  298. programmers think in. They're half technology and half religion.[6]
  299. And so the median language, meaning whatever language the median
  300. programmer uses, moves as slow as an iceberg. Garbage collection,
  301. introduced by Lisp in about 1960, is now widely considered to be
  302. a good thing. Runtime typing, ditto, is growing in popularity.
  303. Lexical closures, introduced by Lisp in the early 1970s, are now,
  304. just barely, on the radar screen. Macros, introduced by Lisp in the
  305. mid 1960s, are still terra incognita.Obviously, the median language has enormous momentum. I'm not
  306. proposing that you can fight this powerful force. What I'm proposing
  307. is exactly the opposite: that, like a practitioner of Aikido, you
  308. can use it against your opponents.If you work for a big company, this may not be easy. You will have
  309. a hard time convincing the pointy-haired boss to let you build
  310. things in Lisp, when he has just read in the paper that some other
  311. language is poised, like Ada was twenty years ago, to take over
  312. the world. But if you work for a startup that doesn't have
  313. pointy-haired bosses yet, you can, like we did, turn the Blub
  314. paradox to your advantage: you can use technology that your
  315. competitors, glued immovably to the median language, will never be
  316. able to match.If you ever do find yourself working for a startup, here's a handy
  317. tip for evaluating competitors. Read their job listings. Everything
  318. else on their site may be stock photos or the prose equivalent,
  319. but the job listings have to be specific about what they want, or
  320. they'll get the wrong candidates.During the years we worked on Viaweb I read a lot of job descriptions.
  321. A new competitor seemed to emerge out of the woodwork every month
  322. or so. The first thing I would do, after checking to see if they
  323. had a live online demo, was look at their job listings. After a
  324. couple years of this I could tell which companies to worry about
  325. and which not to. The more of an IT flavor the job descriptions
  326. had, the less dangerous the company was. The safest kind were the
  327. ones that wanted Oracle experience. You never had to worry about
  328. those. You were also safe if they said they wanted C++ or Java
  329. developers. If they wanted Perl or Python programmers, that would
  330. be a bit frightening-- that's starting to sound like a company
  331. where the technical side, at least, is run by real hackers. If I
  332. had ever seen a job posting looking for Lisp hackers, I would have
  333. been really worried.
  334. Notes[1] Viaweb at first had two parts: the editor, written in Lisp,
  335. which people used to build their sites, and the ordering system,
  336. written in C, which handled orders. The first version was mostly
  337. Lisp, because the ordering system was small. Later we added two
  338. more modules, an image generator written in C, and a back-office
  339. manager written mostly in Perl.In January 2003, Yahoo released a new version of the editor
  340. written in C++ and Perl. It's hard to say whether the program is no
  341. longer written in Lisp, though, because to translate this program
  342. into C++ they literally had to write a Lisp interpreter: the source
  343. files of all the page-generating templates are still, as far as I
  344. know, Lisp code. (See Greenspun's Tenth Rule.)[2] Robert Morris says that I didn't need to be secretive, because
  345. even if our competitors had known we were using Lisp, they wouldn't
  346. have understood why: "If they were that smart they'd already be
  347. programming in Lisp."[3] All languages are equally powerful in the sense of being Turing
  348. equivalent, but that's not the sense of the word programmers care
  349. about. (No one wants to program a Turing machine.) The kind of
  350. power programmers care about may not be formally definable, but
  351. one way to explain it would be to say that it refers to features
  352. you could only get in the less powerful language by writing an
  353. interpreter for the more powerful language in it. If language A
  354. has an operator for removing spaces from strings and language B
  355. doesn't, that probably doesn't make A more powerful, because you
  356. can probably write a subroutine to do it in B. But if A supports,
  357. say, recursion, and B doesn't, that's not likely to be something
  358. you can fix by writing library functions.[4] Note to nerds: or possibly a lattice, narrowing toward the top;
  359. it's not the shape that matters here but the idea that there is at
  360. least a partial order.[5] It is a bit misleading to treat macros as a separate feature.
  361. In practice their usefulness is greatly enhanced by other Lisp
  362. features like lexical closures and rest parameters.[6] As a result, comparisons of programming languages either take
  363. the form of religious wars or undergraduate textbooks so determinedly
  364. neutral that they're really works of anthropology. People who
  365. value their peace, or want tenure, avoid the topic. But the question
  366. is only half a religious one; there is something there worth
  367. studying, especially if you want to design new languages.