C + + Design Pattern -- Bridge pattern

Single responsibility mode:  in the design of software components, if the division of responsibilities is not clear, the result of using inheritance is often that the subclass expands sharply with the change of requirements and is full of repeated code. At this time, the key is to clarify the responsibilities. Typical mode • Decorator • Bridge ...

Added by tweek on Sun, 20 Feb 2022 01:55:24 +0200

Use Kotlin and CameraX to take photos without feeling on the desktop and screen (with source code)

Android uses Kotlin and CameraX to take photos without feeling on the desktop and screen (with source code) Requirements: realize a silent photographing without displaying the interface, and can also switch the front and rear cameras and take photos through the volume keys in the rest screen state. After the photos are successfully saved, ther ...

Added by parms on Sat, 19 Feb 2022 16:17:13 +0200

The growth path of Architects - Design Patterns - 07 Prototype mode, clone mode, java attribute replication

Prototype mode Prototype pattern solves the problem of copying a large number of attributes. This paper will introduce several depth attribute replication methods and several shallow attribute replication methods. The source code address of this paper will be given at the end of the text. Code before prototype pattern is not used public stat ...

Added by dragin33 on Sat, 19 Feb 2022 13:15:26 +0200

Six ways to write single case mode

preface Singleton mode is a creation mode. This class is responsible for creating its own objects and ensuring that only a single object is created. This class provides a way to access its unique object, which can be accessed directly without instantiating the object of this class.  1. Lazy style public class SluggardSingleton { ...

Added by FadeOut79 on Sat, 19 Feb 2022 05:09:08 +0200

Deep understanding of Promise, the core of JS asynchronous programming

In fact, before the emergence of ES6 standard, the community first put forward the Promise scheme. Later, with the addition of ES6, its usage was unified and native Promise objects were provided. Promise basic information If you have to explain what Promise is, it is simply a container that holds the results of an event (usually asynchronou ...

Added by storyboo on Sat, 19 Feb 2022 00:41:09 +0200

A simple main function free main program framework class based on C + +

When teaching children to learn C + + language, in order to explain the encapsulation, inheritance and polymorphism of C + +, I wrote a simple main program framework class. The application only needs to derive subclasses from the main program framework class and implement its run(...) Method, and then define a subclass instance. The abstract c ...

Added by sysgenmedia on Fri, 18 Feb 2022 06:49:04 +0200

Some common patterns in design patterns

Design Mode The role of design patterns Reuse design and codeIncrease scalabilityIncrease flexibilityImproving development efficiency Classification of design patterns Creative mode Patterns for object instantiation, Creative Patterns for decoupling instantiated objects of objects Structural pattern Combining classes or objects together t ...

Added by DSGameMaker on Fri, 18 Feb 2022 06:47:07 +0200

Creator mode

1, Introduction to builder mode 1. Introduction to builder mode The builder pattern separates the construction and representation of a complex object, so that the same construction process can create different representations. Builder mode and abstract factory mode are similar in function. They are used to create large and complex objects. T ...

Added by warptwist on Fri, 18 Feb 2022 05:32:56 +0200

Pattern state

I. Introduction of models 1.1 definition Allows an object to change its behavior when its internal state changes, and the object appears to have modified its class. State mode packages the behavior of the object changed by the environment in different state objects. Its intention is to make an object change its behavior when its internal sta ...

Added by grglaz on Thu, 17 Feb 2022 23:32:39 +0200

Design Mode - Factory Mode

Factory Mode Simple Factory Mode Case study: Chefs cook dishes as an example. Chefs can cook meat and fish and have customers order them public interface Chef { public void cook(); } public class Meet implements Chef{ @Override public void cook() { System.out.println("Cook pot meat~"); } } public class Fish impleme ...

Added by xplosiongames on Thu, 17 Feb 2022 21:22:42 +0200