Design pattern 01 - seven design principles

Design pattern 01 - seven design principles Opening and closing principle - Open Close A software entity such as class, module and function should be open to extension and closed to modification. Build the framework with abstraction and extend the details with implementation. Improve the reusability and maintainability of the program. Ca ...

Posted by ashishag67 on Wed, 26 Jan 2022 02:06:55 +0100

[detailed explanation of Java design pattern] [dark horse programmer] notes

Design pattern related content Design pattern classification Create pattern It is used to describe "how to create objects". Its main feature is to separate the creation and use of objects. GOF book provides five creation modes: singleton, prototype, factory method, abstract factory and builder Structural model Used to describe ho ...

Posted by tycragg on Tue, 25 Jan 2022 21:06:07 +0100

Android development technology -- migrating from LiveData to Kotlin data stream

Recommended by Haowen: Author: Android_ developer The history of LiveData dates back to 2017. At that time, the observer pattern effectively simplified development, but libraries such as RxJava were too complex for novices. To this end, the architecture component team created LiveData: an observable data storage class with autonomous life cy ...

Posted by embsupafly on Tue, 25 Jan 2022 20:43:21 +0100

The object mind is too changeable, and the factory model can not be satisfied? Use the builder mode!

preface As we know, common design patterns are usually divided into three categories: creative patterns, behavioral patterns and structural patterns. Today, let's talk about the builder mode in the creation mode, about its use scenarios, advantages and disadvantages, components, practical examples and its application in JDK. We are already ...

Posted by byronwells on Tue, 25 Jan 2022 13:20:47 +0100

Seven principles of design pattern -- Demeter's law

Basic introduction: One object should have minimal knowledge of other objectsThe closer the relationship between classes, the greater the degree of couplingDimitri's law is also called the least known principle, that is, the less a class knows about the class it depends on, the better. In other words, no matter how complex the dependent cla ...

Posted by anler on Tue, 25 Jan 2022 12:19:52 +0100

03_ Single case design mode

1 Introduction to single example design mode Class singleton design pattern is to take certain methods to ensure that there can only be one object instance for a class in the whole software system, and the class only provides a method to obtain the object instance (static method). 2. There are eight ways of single case design mode 2.1 hungry ...

Posted by pod2oo5 on Tue, 25 Jan 2022 10:31:09 +0100

Design pattern, it's enough to read this article

What is a design pattern Design pattern is a general solution to the problems faced in the process of software development. It is the best practice summarized by many developers in their experiments and mistakes for a long time. Rational use of design patterns can enhance the reliability and reusability of code, and make the code easier to ...

Posted by socratesone on Tue, 25 Jan 2022 05:29:49 +0100

Behavioral model - observer model

Observer mode 1 Definition Also known as publish subscribe mode, it defines a one to many dependency, allowing multiple observer objects to listen to a topic object at the same time. When the state of the subject object changes, it will notify all observer objects so that they can update themselves automatically. 2 Structure There are the f ...

Posted by neave on Mon, 24 Jan 2022 12:08:01 +0100

Design mode [12] - the strategy mode to solve the recent fire

It's still the beginning. The strategy mode seems to be very popular recently. Please look down What is the strategic model? In fact, we have explained the structural mode before, and the rest are all behavioral modes. The distinction between the three modes is as follows: Creative mode: how to create an object Structural pattern: how is the ...

Posted by jeny on Sun, 23 Jan 2022 22:48:33 +0100

Design pattern - structural pattern combination pattern

See the display needs of a school department Write a program to display the department structure of a school: the demand is that the Department composition of the school should be displayed on one page. A school has multiple colleges and a college has multiple departments. As shown in the figure: Traditional solution school department dis ...

Posted by GESmithPhoto on Sun, 23 Jan 2022 17:38:14 +0100