使用全域資料,例如:Singleton 或靜態類別變數。
藥物跟毒藥其實只有一線之隔,若全域資料不會被變動,產生的風險其實不大。但若全域資料開始會被更動,問題就會慢慢浮現,而且難以除錯。
Encapsulate Variable
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up