Throwaway Programs

To be attractive to hackers, a language must be good for writing the kinds of programs they want to write. And that means, perhaps surprisingly, that it has to be good for writing throwaway programs.

A throwaway program is a program you write quickly for some limited task: a program to automate some system administration task, or generate test data for a simulation, or convert data from one format to another. The surprising thing about throwaway programs is that, like the “temporary” buildings built at so many American universities during World War II, they often don’t get thrown away. Many evolve into real programs, with real features and real users.

I have a hunch that the best big programs begin life this way, rather than being designed big from the start, like the Hoover Dam. It’s terrifying to build something big from scratch. When people take on a project that’s too big, they become overwhelmed. The project either gets bogged down, or the result is sterile and wooden: a shopping mall rather than a real downtown, Brasilia rather than Rome, Ada rather than C.

Another way to get a big program is to start with a throwaway program and keep improving it. This approach is less daunting, and the design of the program benefits from evolution. I think, if one looked, that this would turn out to be the way most big programs were developed. And those that did evolve this way are probably still written in whatever language they were first written in, because it’s rare for a program to be ported, except for political reasons. And so, paradoxically, if you want to make a language that is used for big systems, you have to make it good for writing throwaway programs, because that’s where big systems come from.

— Paul Graham

— Me@2010.08.07

2011.08.02 Tuesday ACHK

魔法筆記 3

這段改編自 2010 年 5 月 12 日的對話。

其實,這些 MC(多項選擇題)是怎樣砌出來的呢?

每一課都有幾個重點。把那幾個重點隨機組合,就可以砌成一大堆 MC 題目。例如,假設,某一課有七個重點。第一題可以考你第一和第二個重點;第二題考你第二和第七;第三題考你第三、第五和第七;等等。每一題都考你貌似不同的知識和技巧。

初學者為什麼會覺得困難呢?

因為他們不知道那一課的背後,主要的重點只有七個。每一題對他們來說,也是全新的學問。

那樣,你怎樣可以做到,看穿每課背後的幾個重點呢?

可以問我,或者其他對這科這課熟悉的人仕。但是,留意,即使我直接講了那些重點給你聽,而你當時又明白,也不代表你可以真切「感受」得到。因為那不是你自己的故事、個人的經歷,印象未必會深刻。

為了加強記憶,一題如果錯了的話,你要問問自己,該題是因為不懂什麼,而不能完成。例如,在這題中,你原本不知道,在思考電壓(Voltage)題目時,應先行設定一點參考點,定義電壓的數值為零。另一個要點是,電流(current)的方向,是由高電壓的位置,指向低電壓的位置。

那樣,這題就可以記下這兩個要點,於「魔法筆記」中。

一般而言,每題大概可以歸納到二至三個要點。不斷用這個方法,歸納到(例如)第十題時,你會發現,那些知識和技巧,有部分已經在「魔法筆記」中重複。重複的東西,就是一課的精髓。

— Me@2011.08.02

2011.08.02 Tuesday (c) All rights reserved by ACHK