- 博客(19)
- 收藏
- 关注
原创 Mediator Pattern
Mediator pattern is to help package a serious of objects inside of mediator class when they have complicated connection relationships, rather than we give logic control under each object itself.When we extend more objects in the project, we only make ame
2021-11-24 17:47:07 109
原创 Observer Pattern
Observer pattern can be applied when there's data source and multiple data receivers, it fulfills OCP and it's easy to extend/maintain data receiver list.Data source will mainly implement 3 methods, regisiter data receiver,remove data receiver and updat.
2021-11-23 14:59:08 77
原创 Iterator Pattern
Iterator pattern can ignore set objectcombination method, always use hasNext method to see if there's continues object and use next method to get the following object, it gives a more standard way to list all the objects.Each object container we create .
2021-11-22 15:52:55 66
原创 Chain of responsibility
When there are multiple processors to handle one request based on different request, and if current processor is not able to handle it will pass the request to next processor, in this case, we can apply chain of responsibility pattern to decouple requestor
2021-11-21 11:04:45 70
原创 Visitor Pattern
Visitor pattern is a better design when we have extendable visitor list but operate on pretty stable element list, we can easily extend the visitor and give specific implementation methods without touching exisitng code.There are several roles in visitor
2021-11-14 15:04:08 217
原创 Command Pattern
Command pattern is to de-couple action invoker and action receiver, action invoker just simplely asks one command to execute and don't need to know who will be the action receiveror how to execute, this pattern can seperate developments apart and easy to m
2021-11-10 00:15:47 75
原创 Template Pattern
Template pattern is to provide a constructure on complicated process completion steps, leave detail implementation of each step on concrete class, so the application will base on different operator to complete the function differently but in same sequence
2021-11-08 18:03:53 63
原创 Facade Pattern
Facade pattern is to merge several methods into one method so that client only talks to this new function but don't need to know all the details implementations, that is the advantage of this pattern, but disadvantage is it doesn't meet open and close prin
2021-11-07 22:31:29 77
原创 Composite Pattern
Composite pattern helps when objects have root and leaf relationships, if root and all levels of leaf all implement same method, we can only talk to the root to get the final result which we want, and leave the handling between root and all levels of leaf.
2021-11-07 14:01:24 80
原创 Flyweight Pattern
Flyweight pattern is to help re-use created object if the object is fine-grained and the key parameter is not changed, in this case we can avoid to waste memory.The parameters can be sperate to 2 parts, first part is internal parameters, like key paramet
2021-11-07 11:16:55 64
原创 Decorator Pattern
Decorator pattern is to enhance existing function, decorator and original class implement same interface, from implementation it's close to proxy pattern.The difference between decorator and proxy is, decorator is to enhance existing function, after that
2021-11-07 00:15:19 93
原创 Proxy Pattern
Proxy pattern is the principle of Spring AOP, we can provide a proxy class toa type of classes which implement same interface, in proxy class, the original method we still ask proxied class to complete the function, but additionally we can provide extra ..
2021-11-06 17:53:05 76
原创 Bridge Pattern
Bridge pattern is to seperate2 concepts so that list maintainance will only happen in their own area, in the end use a bridge to link them together. This way can avoid class explode when we use "extend" to include more on either or both concepts.Like we.
2021-11-03 20:20:17 60
原创 Adapter Pattern
When we use one existing function and it doesn't fulfill new request, we can ask for another function to help implement it. It's like one computer only has USB port, but it can use one adapter in between to revert it tocable port to connect website.Adap.
2021-11-02 22:44:27 58
原创 Prototype Pattern
Prototype Pattern can help create multiple objects when creation process is complicated, 2 ways to implement it.Way1 (recommended):Implement interface Serializable, serializate current object then deserializate it to return new object, all parameters a
2021-10-31 17:36:54 71
原创 Builder Pattern
Builder Pattern can help create a series of objects which creation process is complicated and the step under creation process is similar but just needs to specific the details.There are several roles in builder pattern, director, builders, abstract build
2021-10-30 20:23:15 115
原创 Singleton Pattern
Singleton pattern is to make sure only 1 instance is created through entire project, it's applicable when object creation is complicated but 1 instance is enough, like tool class, property object or session, it can help avoid space waste.In total there a
2021-10-30 19:44:31 85
原创 Factory Pattern
Factory pattern has 2 types, simple factory and general factory patterns.Simple factory pattern:Factory class helps create new objects, whenever needs to create a new object, ask factory class to return.Advantages: Simple, easy to apply, only facto
2021-10-30 19:26:19 63
原创 聚合与组合的意义和区别
聚合与组合的意义和区别 (Java)继承是面向对象编程三大特性之一,通过继承,子类可以继承父类非private的属性和方法,大大提高代码复用性和开发效率。但继承也有众多缺点,比如使得子类与父类过度耦合,当父类发生调整会影响所有子类都进行检查,必要时也要同时进行调整 子类对父类同时也具有了侵入性,需要重载所有父类的属性和方法,这和迪米特法则是违背的 同时子类由于需要继承父类所有属性和方法,这时候子类就会显得笨拙,例如圆形三角形和矩形都可以继承父类图形类,但如果给图形类增加了长和宽或者半径的属性
2021-10-30 18:30:13 242
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人