how long will the code continue to be built, executed, and maintained? How long will this software provide value?
Software engineering” differs from “programming” in dimensionality: programming is about producing code. Software engineering extends that to include the maintenance of that code for its useful life span
Hyrum’s Law 海勒姆定律
With a sufficient number of users of an API, it does not matter what you promise in the contract: all observable behaviors of your system will be depended on by somebody
如何融入團隊
你不是天才,就算你是天才,你也必須懂得如何團隊合作,切勿閉門造車
Fail early, fail fast, fail often. 儘早測試,不斷迭代
如何領導團隊
組織架構
大型且成熟的團隊通常會有:The Engineer Manager(has technical background) + The Tech Lead
小型和新生的團隊通常會有:The Tech Lead Manager(等於 EM + TL),一人幹兩人份的活
Software Engineering is some sense, is a pain allocation task, so as a manager, your job is to make sure the pain is allocated equally among your team.
keep it short by first writing a long version and then trim it down, 刪掉冗詞贅字以及重複的內容,要記住:less is more,理查.費曼 Richard Feynman 說過:如果你無法用簡單的語言解釋一件事,那就代表你並未真正理解它
WHO, WHAT, WHEN, WHERE, and WHY
Single Responsibility
one file for one single responsiblity
Tutorial
新手教學,就是 example,而寫 tutorial 最好的時機點就是你剛加入團隊的時候,透過 try and error,然後記錄下最後讓事情 work 的方法和過程
A little bit of duplication is OK in tests so long as that duplication makes the test simpler and clearer
Test Doubles
Why Test Doubles? 因為可能會依賴第三方套件(物件),其回傳結果耗時、不 deterministic,或是第三方套件(物件)非常龐大,實現很複雜,但測試其實只用到了其中某些核心功能
Seam:A seam is a way to make code testable by allowing for the use of test doubles—it makes it possible to use different dependencies for the system under test rather than the dependencies used in a production environment.
Fake
lightweight implementation of an API that behaves similar to the real implementation but isn’t suitable for production; for example, an in-memory database
過度使用 Mock 導致失真,進而導致 real production 時會遇到的 bug 沒有在測試時被檢測出來
When to Mock and When Not to Mock
it’s a tradeoff between productivity and fidelity
大型測試(end-to-end)
The rate of distinct scenarios to test in an end-to-end way can grow exponentially or combinatorially depending on the structure of the system under test, and that growth does not scale.