![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
OOD
Nick_kn
这个作者很懒,什么都没留下…
展开
-
OOD-iterator Design
for example:for (Toy t: inventory) {}**每个foreach loop实际上是在运行以下代码**Iterator<Toy> ti = inventory.iterator();while (ti.hasNext()) { Toy t = ti.next();}(重点)但是,在每个for each loop里面,我们都不可以modifie the List or Set.比如,这个method里面,这是一个非常好的反面例子..原创 2020-11-30 22:45:59 · 77 阅读 · 0 评论 -
OOD-Observer Pattern
1.Make classes for abstract Subject (not necessarily abstract), and abstract Observer (typically abstract or interface). Observer通常是abstract 或者 interface。2.Put the abstract update() method into the abstract/interface Observer.3.Give the Subject a list o.原创 2020-11-23 20:34:01 · 60 阅读 · 0 评论 -
Object Oriented Design-coupling and cohesion
Firstly and most importantly, Designs that exhibit low coupling and high cohesion are preferred.What is coupling?Figure 1b provides an alternate design involving the same modules. In this case, module A depends upon module B which in turn depends on mod原创 2020-11-15 20:28:12 · 175 阅读 · 0 评论