2010年11月25日 星期四

TDD Test-driven development

TDD forces you to think through the testing process before you write the code.
TDD 強迫你要寫 code 前先把流程想過一遍。

Every developer has the experience of writing a class in one big bunch, making assumptions along the way. Then when it comes time to actually use the class, you realize that some of your assumptions were wrong, and you have to refactor the original code.

寫了一大堆才發現寫錯,這時候要重構就痛苦了。

2010年11月24日 星期三

如果寫文件是麻煩的,花時間的...

那麼,你就不會想去維護它。會儘可能的迴避它。

low-ritual artifacts are best, and my favorite is the lowly drawing on a whiteboard.
you really need it only until you embody it in code, and then the code can speak for itself.

在白板上畫好圖後,把它照相下來,就再也不必寫文件了,唯一要做的就是把 code 實作出來,然後程式自己會說明它自已(用 generate doc 工具)。

SVN2Wiki, SVN 2 Wiki plug in

同一件事,做一次就好。
...we realized that we were actually violating the canonicality principle because we were asking the developers to document stuff they had already documented - in their comments where posting to version control.

原來之前用過的 Trac 整合 SVN 的功能,類似 SVN 2 Wiki 。
這本書中有討論為何會設計這個 plug-in.

SVN2Wiki is a great example of living documentation
把 SVN 的 cechk in 註解整合進 wiki 軟體後,程式碼與文件,變得更緊密相依,文件才有活著的感覺,不然通常都會發生文件無法被用來參考的冏境。
Most documentation for projects is lame because it no longer has relevance.
(大部分文件都是跛腳的,因為它們不會被維護)

2010年11月23日 星期二

DRY Document

Out-of-date documentation is worse than none because it is actively misleading.
錯的(過時的)文件比不寫文件還糟,因為它會誤導你!!

只趕進度,不更新文件的人要注意了,這是個很嚴重的缺失...

2010年11月22日 星期一

Continuous intergration

is a process where you build the entire project, run tests, generate documents, and do all the other activities that make software on a regular basis, the more often the better, generally you should build every time you check in code to version control.

The continuous integration server runs on a separate machine, monitoring your check-in to version control.

CI machine should not include the development tool you use to create the project, only the libraries and other frameworks needed to build the application.

If you can build application with a single command on a standalone machine, you obviously have the configuration correct.

Cruise Control 是 Thought Work 的 CI 軟體,其他的還有:
Bamboo, Hudson, TeamCity, LuntBuild.

DRY Version Control

Checking your files into version control early and often encourages you to make small changes.

You'll face a merge conflict if you make long-tern changes to the file encourages you to check in more often.

原來 mick 每次做一點小修改就 commit 的道理是出自這裡啊。

DRT

It's hard to even notice the problems in lost of situation, especially if non-DRYness (moistness?) is the status quo.