? 從www.infoq.com上看到一篇文章,講的是一個高效程序員五個好習(xí)慣,特摘錄如下:
1.Constructor Performs Minimal Work(不要讓構(gòu)造函數(shù)太累著)
2.Methods Clearly Convey Their Intent(人如其名)
3.An Object Performs a Focused Set of Services(不要狗拿耗子多管閑事)
?? how to categorize these object is worthy of considering.(entity object,service object,facade object)
4.State-Changing Methods Contain Minimal Behavior Logic(是非分明,不要糾纏不清)
?? determine the boundary is a litttle difficult.
5.Behavior Methods Can Be Called in Any Order(讓依賴離我們遠(yuǎn)點)
?? 個人覺得3,4,5體現(xiàn)的是如何劃分領(lǐng)域模型和領(lǐng)域?qū)ο舐氊?zé)劃分的問題.我想Martin flower的SRP應(yīng)該是我們應(yīng)該遵守的原則之一.其它的暫時沒有想到啊,大家有建議么?