Development (ASP.NET program) writes code to the most object-oriented flavor

A few days ago, when moving the house, I picked up the book refactoring -- improving the design of existing code. Refactoring is often and often used in development.She did teach us how to write programs concise, clear, easy to understand, easy to maintainWrite something about refactoring for the blog today. Take the actual example of netizens ...

Posted by cx3op on Tue, 09 Nov 2021 16:55:44 -0800

Visitor mode

In real life, some collection objects have many different elements, and each element also has many different visitors and processing methods. For example, there are multiple scenic spots and multiple tourists in the park. Different tourists may have different comments on the same scenic spot; The prescription list issued by the hospital doctor ...

Posted by mantona on Tue, 09 Nov 2021 14:59:16 -0800

[design mode] yuan sharing mode, the guiding ideology of pool technology.

What is Flyweight concept Flyweight Pattern is a structural pattern, which is mainly used to reduce the performance consumption of object creation and destruction, so as to reduce the occupation of memory. Object oriented language can bring some flexibility and expansibility to our development, and it is more in line with people's way of thin ...

Posted by AndyEarley on Mon, 08 Nov 2021 23:51:45 -0800

Design pattern [3.3] - Interpretation of CGLIB dynamic agent source code

cglib dynamic proxy Introduction to cglib CGLIB is an open source project, a powerful high-performance and high-quality code generation library, which can expand Java classes and implement Java interfaces at run time. The bottom layer is to use a small and fast bytecode processing framework ASM to convert bytecode and generate new classes. The ...

Posted by vfwood on Mon, 08 Nov 2021 11:25:49 -0800

c + + factory mode

Before you get familiar with factory mode, you should first understand the six guidelines before writing c + + programs Opening and closing principle: do not modify existing codes, only add codes.Dependency Inversion Principle: use abstract classes instead of concrete classes to solve problems. (isolation change, package change)Richter substit ...

Posted by dessolator on Mon, 08 Nov 2021 08:15:28 -0800

Detailed explanation of prototype mode

In some systems, there is a problem of creating a large number of identical or similar objects. If you use the traditional constructor to create objects, it will be more complex, time-consuming and resource-consuming. It is very efficient to generate objects with the prototype mode, just as it is as simple as the monkey king pulling out the mon ...

Posted by jfeather on Sun, 07 Nov 2021 23:18:45 -0800

Design pattern - (16) iterator pattern

1. Definition Provides a way to access an aggregate object without exposing the internal representation of the object, alias cursor. The iterator pattern is an object behavior pattern. 2. UML class diagram Abstract container role (Aggregate): it is responsible for providing an interface for creating a specific iterator role, generally an ...

Posted by kazer on Sat, 06 Nov 2021 23:11:06 -0700

Design pattern - (12) agent pattern

1. Definition For some reason, an object needs to be provided with a proxy to control access to the object. At this time, the access object is not suitable or can not directly reference the target object. The proxy object acts as an intermediary between the access object and the target object. 2. UML class diagram Abstract Subject: declar ...

Posted by Zilvermeeuw on Sat, 06 Nov 2021 21:47:20 -0700

Design pattern [3.2] - how fragrant is JDK dynamic agent source code analysis?

The previous article mentioned the agent mode: http://aphysia.cn/archives/dy...So in retrospect, how did the agent model come from? Suppose you have a requirement:Print the log before and after all controller classes in the system call methods.Suppose the original code:public class Person{ public void method(){ // Represent your bus ...

Posted by shadysaiyan on Sat, 06 Nov 2021 11:29:09 -0700

GoLang design pattern 12 - empty object pattern

Empty object design pattern is a behavioral design pattern, which is mainly used to deal with the inspection of empty objects. Using this design pattern avoids checking empty objects. That is, in this mode, using empty objects does not cause exceptions. The components of the empty object pattern include: Entity: interface, which defines the me ...

Posted by gsaldutti on Sat, 06 Nov 2021 08:18:51 -0700