撰寫單元測試能確保程式裡的每個角落都會如同預期般地運作,然而一股腦將測試加入程式碼內,而忽略了測試的可讀、可維護性,將會阻礙後續測試新增、修改,久而久之這些阻礙將使得測試變得愈來愈混亂,也漸漸的失去測試…
你是否曾幾何時遇到一個情境,在一個應用程式中,希望有一個始終如一的物件,它扮演著單一入口,你可以很容易地呼叫他、創建它與使用它,它自始自終只有一個,沒有第二個它。