老書考古 - Writing Solid Code
資訊業界技術更迭之速,使得許多技術書籍在閱讀前就已經過時了。
但我認為仍有一些作品值得重讀,例如 Writing Solid Code 。這本書從軟體開發的日常中提煉許多實用的技巧以及心法,幫助程式設計師避免以及減少 bugs。
Chapter 3 — Candy-Machine Interfaces
I can’t emphasize enough how important it is to examine your interfaces from the point of view of the caller— p102- 寫 unit tests 的一個好處之一:強迫你從使用者的角度檢視自己的 interface。我經常在寫 unit tests 時發現可以 interface 可以改進的地方。
被發現我沒有嚴格遵守 Test-driven development 了 - 2016 年開始,從 library user 變成 library author 的過程,讓我對第三章的內容頗有共鳴。身為一個 library author,要盡量預防使用者犯錯。