[23 Java design modes] Command (14)

command Encapsulate a request as an object, so that you can parameterize customers with different requests, queue or log requests, and support revocable operations. Command mode refers to encapsulating a request into a command and then executing the command. The commander sends the order to the soldiers, and the soldiers do it. The good ...

Posted by asgerhallas on Wed, 30 Mar 2022 02:09:59 +0300

Using the BeanCopier of cglib, copy the object with prototype mode and shared meta mode

In fact, there are many tools for object copying, such as Apache beautils, apache PropertyUtils and spring beautils. In some business code, spring bean utils is often used to copy objects. In most cases, it's enough, but in terms of performance, the above tools are completed by using the principle of reflection. The performance is slightly wors ...

Posted by Toggles on Wed, 30 Mar 2022 01:35:40 +0300

Prototype mode of 23 design modes

Today, we will continue to explore the prototype mode of GOF's 23 design modes, which is also a kind of creative mode Generally speaking, prototype mode is the process of object replication, that is, through a prototype object, I can get a clone of the object. Let's look at the first way to write the prototype pattern -- JDK native public in ...

Posted by bubblocity on Mon, 28 Mar 2022 00:52:06 +0300

Object oriented programming internal mental skill series 14 (talk about template mode)

1. Introduction In the previous article, we shared the observer pattern in the behavioral design pattern. In this article, we will talk about the template design pattern. The full name of the template design pattern is called the template method design pattern. Template design pattern is a widely used design pattern in practical application. ...

Posted by deansatch on Sun, 27 Mar 2022 19:37:58 +0300

Design mode - decorator mode

WX search: personal cultivation of programmers see moreDecorator modeRuntime extensions are far more powerful than compile time inheritance. We will discuss how to use object composition to decorate classes at run time.The behavior of subclasses designed by inheritance is statically determined at compile time, and all subclasses will inherit th ...

Posted by ryza_ on Sat, 26 Mar 2022 12:24:46 +0300