Home  >  Article  >  Backend Development  >  Detailed introduction to decoupling

Detailed introduction to decoupling

零下一度
零下一度Original
2017-06-12 15:35:144859browse

1. Implicit coupling between tasks and execution strategies Executor can decouple task submission and task execution strategies. Only tasks of the same type and little difference in execution time can achieve maximum performance. Otherwise, if Some long-consuming tasks and short-consuming tasks are placed in a thread pool. Unless the thread pool is very large, it will cause problems such as deadlock. 1. Thread starvation deadlock is similar to: submitting two tasks to a single-thread pool, And the two tasks are interdependent. If one task waits for another task, a deadlock will occur; the pool is not well defined: a task must wait for the running results of other tasks in the pool, and starvation deadlock may occur. 2. Threads Note on pool size: The size of the thread pool is also subject to other restrictions, such as other resource pools: database connection pool. If each task is a connection, then the size of the thread pool is subject to the size of the database connection pool. 3. Configure the ThreadPoolExecutor thread pool Example: 1. Return some default implementations through the factory method of Executors 2. Customize the thread pool team by instantiating ThreadPoolExecutor (.....)

1. java thread The use of pool

Detailed introduction to decoupling

Introduction: The implicit coupling between tasks and execution strategies Executor can Submission and task execution strategies are decoupled. Only tasks of the same type with little difference in execution time can achieve maximum performance. Otherwise, if some long-consuming tasks and short-consuming tasks are placed in a thread pool, unless the thread pool Very big

2. Detailed explanation of the observer pattern in Django

Detailed introduction to decoupling

##Introduction: Django provides "signal dispatch" for decoupling when the framework performs operations. In layman's terms, a signal allows a specific sender to alert some recipients when some action occurs.

3. Deep into the three realms of PHP decoupling (a brief discussion of service containers)

Detailed introduction to decoupling

Introduction: In the process of completing the development of the entire software project, sometimes it requires the cooperation of multiple people, and sometimes it can be completed independently. No matter which one it is, as the amount of code increases, writing and writing Then it got "out of control" and gradually became "ugly interfaces and dirty implementations". The cost and difficulty of project maintenance increased to the point where it was unsustainable, and the only option was reconstruction or redevelopment.

4. Detailed introduction to the summary and thinking about Java concurrent programming

Detailed introduction to decoupling

Introduction: Writing high-quality concurrent code is an extremely difficult task. The Java language has built-in support for multi-threading since the first version, which was very remarkable at the time. However, as we have a deeper understanding and more practice of concurrent programming, the implementation of concurrent programming has become more complicated. More options and better choices. This article is a summary and reflection on concurrent programming. It also shares some experience on how to write concurrent code in Java 5 and later versions. Why concurrency is needed Concurrency is actually a decoupling strategy that helps us separate what to do (goal) and when to do it (timing). Doing so can significantly improve the throughput of the application..

5. Sample code of the triple realm of PHP decoupling (a brief talk about service containers)

Detailed introduction to decoupling

Introduction: This article mainly introduces the relevant knowledge of the three realms of PHP decoupling (a brief discussion of service containers). Has very good reference value. Let’s take a look with the editor below

6. Analysis of the three realms of PHP decoupling (a brief discussion of service containers)

Detailed introduction to decoupling

Introduction: Analysis of the three realms of PHP decoupling (a brief discussion of service containers)

7. Sample code for Java implementation of command mode

Detailed introduction to decoupling

Introduction: In software systems, "behavior requester" and "behavior implementer" usually present a kind of "Tight coupling". But in some situations, such as "recording, undo/redo, transaction" and other processing of behaviors, this kind of tight coupling that cannot resist changes is inappropriate. In this case, how to decouple the "behavior requester" from the "behavior implementer"? Abstract a set of behaviors into objects to achieve loose coupling between them. This is the Command Pattern

##8. Detailed introduction to Java implementation of the Composite pattern

Detailed introduction to decoupling

##Introduction: Composite mode is also called part-whole mode * It blurs the concepts of simple elements and complex elements in our hierarchical and tree structure problems , the client program can process complex elements just like simple elements, thus decoupling the client program from the internal structure of the complex elements

9.

What are the advantages of spring? What is the DI mechanism? What is AOP?

Detailed introduction to decoupling

Introduction: What are the advantages of spring? 1. Reduces the coupling between components and achieves decoupling between software layers 2. Can use many easily provided services, such as transaction management, message services, etc. 3. The container provides singleton mode support 4. The container provides With AOP technology, it is easy to implement functions such as permission interception and runtime monitoring. 5. The container provides numerous auxiliary classes to speed up application development. 6. Spring provides integrated support for mainstream application frameworks, such as hibernate and JPA. , Struts, etc. 7.spr

##10.

C# Decouple EntityFramework for unit testing

Detailed introduction to decouplingIntroduction: C# decoupling EntityFramework for unit testing

[Related Q&A recommendations]:

javascript - How to decouple data returned by ajax?

java - What are annotation injection and dependency injection?

java - What does coupling and decoupling mean in software engineering?

javascript - How should reasonable componentization be decoupled?

Event Listening - What are the advantages and disadvantages of PHP event-driven

The above is the detailed content of Detailed introduction to decoupling. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn