摘要:
You need to interface with a record structure in a traditional programming environment. Make a dumb data object for the record. 阅读全文
posted @ 2007-05-15 17:08
南守拥
阅读(199)
评论(0)
推荐(0)
摘要:
A method returns a collection. Make it return a read-only view and provide add/remove methods. 阅读全文
posted @ 2007-05-15 17:06
南守拥
阅读(307)
评论(2)
推荐(0)
摘要:
There is a public field. Make it private and provide accessors. 阅读全文
posted @ 2007-05-15 16:55
南守拥
阅读(197)
评论(0)
推荐(0)
摘要:
You have a literal number with a particular meaning. Create a constant, name it after the meaning, and replace the number with it. 阅读全文
posted @ 2007-05-15 16:48
南守拥
阅读(228)
评论(0)
推荐(0)
摘要:
You have a two-way association but on class no longer needs features from the other. Drop the unneeded end of the association. 阅读全文
posted @ 2007-05-15 16:47
南守拥
阅读(238)
评论(0)
推荐(0)
摘要:
You have two classes that need to use each other’s features, but there is only a one-way link. Add back pointers, and change modifiers to update both sets. 阅读全文
posted @ 2007-05-15 16:45
南守拥
阅读(278)
评论(0)
推荐(0)
摘要:
You have domain available only in a GUI control, and domain methods need access. Copy the data to a domain object. Set up an observer to synchronize the two pieces of data. 阅读全文
posted @ 2007-05-15 16:44
南守拥
阅读(285)
评论(0)
推荐(0)
摘要:
You have an array in which certain elements mean different things. Replace the array with an object that has a field for each element. 阅读全文
posted @ 2007-05-15 16:42
南守拥
阅读(214)
评论(0)
推荐(0)
摘要:
You have a reference object that is small, immutable, and awkward to manage. Turn it into a value object. To convert this to a value object, the key thing to do is verify that the object is immutabl... 阅读全文
posted @ 2007-05-15 16:42
南守拥
阅读(270)
评论(0)
推荐(0)
摘要:
You have a class with many equal instances that you want to replace with a single object. Turn the object into a reference object. 阅读全文
posted @ 2007-05-15 16:41
南守拥
阅读(194)
评论(0)
推荐(0)
摘要:
You have a data item that needs additional data or behavior. Turn the data item into an object. 阅读全文
posted @ 2007-05-15 16:40
南守拥
阅读(199)
评论(0)
推荐(0)

浙公网安备 33010602011771号