Fundamental Theorem of Software Engineering

系統程式下星期考試,基本上就是拿內功出來硬拚 XD。程式寫了幾年,最重要的原則大概就是 principle of abstraction 和 principle of indirection,後者 Andrew Koenig 稱之為 Fundamental Theorem of Software Engineering: "All problems can be solved by introducing an extra level of indirection"。一個重要例子大概就是 OO polymorphism,abstraction 不用說,因為多型延伸自 data "abstraction",而 indirection 出現在 dynamic binding 的實作(一般是 pointer indirection)。然而,principle of abstraction 似乎可由 principle of indirection 證成,所以稱後者為 FTSE 或許十分恰當。

數學處理的 entity,本質其實和 program 很像(相對於自然科學處理的東西),也因此 principle of abstraction 和 principle of indirection 都可以在數學的脈絡中找到,例如定理的運用即 principle of abstraction ─ 召喚 Arzela-Ascoli 定理時,我們可不需要重新把定理證明一次,雖然我們知道怎麼證。然而,數學不像 CS 必須把事情教給機器,CS 無論在哪個抽象層都必須以某種方式把所有細節展開(因為機器永遠在最底層的細節上運算),數學不需要。因此 CS 任脈通往 software engineering,但數學沒有 theorem engineering,也不需要發展此類學問。(當然,數學系學生很重要的工作就是確定「必要時」也能把細節展開。)

我們現在把「計算」定義在 Turing machine 上,即某種形式符號操作(formal symbol manipulation)。接著我們造出實際操作符號的機器,即當代電腦,computer architecture 研究的就是如何造出這部機器,並使這部機器在效能與開銷間取得平衡。接著任脈往軟體工程發展,從組合語言到軟體工程方法論,因為我們需要可靠的方法處理規模急遽增大但不缺失細節的符號操作(到這裡 universal Turing machine 的精神還在:「符號操作」(program)可以用「符號」(data)表示)。而居於軟體工程核心地位的原則,我(目前)相信就是 FTSE。

數位電子學期中考就靠外功硬撐了 Orz。

摘錄一小段 Knuth〈Algorithms in Modern Mathematics and Computer Science〉支持上述論調:

At times when I try to come to grips with this question, I find myself almost convinced that algorithmic thinking is really like mathematical thinking, only it concentrates on more "difficult" things. But at other times I have just the opposite impression, that somehow algorithms hit only the "simpler" kinds of mathematics. Clearly such an approach leads only to confusion and gets me nowhere.

While pondering these things recently, I suddenly remembered the collection of expository works called Mathematics: Its Content, Methods, and Meaning, so I reread what A. D. Aleksandrov had to say in his excellent introductory essay. Interestingly enough, I found that he made prominent mention of al-Khwârizmî. Aleksandrov listed the following characteristic features of mathematics:

  • Abstractness, with many levels of abstraction.
  • Precision and logical rigor.
  • Quantitative relations.
  • Broad range of applications.
Unfortunately, however, all four of these features seem to be characteristic also of computer science. Is there really no difference between computer science and mathematics?

A Plan



<< 回到主頁