Configuration pattern: Configuration Mode

Source: Internet
Author: User

IOC? Dependency injection? No, configuration pattern!

IOC, a name that is too tricky, is naturally confusing. Martin takes the self-proclaimed "dependency injection", which is a mere bit of cake. In fact, in a wider range, they are all an implementation of "configuration pattern. (configuration pattern, configuration mode, my name, and self-entertainment. If there are similarities, they are slightly the same)

Engine + configuration.

Search for your project or common open-source projects. If you can search for Classes ending with "engine" and classes ending with "configuration, this project may use "configuration pattern"

In open-source projects I have used, Apache axis uses the engine + configuration mode.

A workflow project I have done also uses the engine + configuration mode.

Of course, the traditional read configuration and dependency injection are still not the same; the former usually has some methods such as getabc (), such as GetObject (objectid) and getbean (beanid) in IOC) but the more flexible method of dependency injection is to directly inject data through setter or ctor, and you do not need to call the getter Method on your own. the former mainly configures some simple attributes, and the latter usually extends the configuration to the object.

Algorithm + functor

In fact, in a larger scope, the engine + configuration mode is also an application of the algorithm + functor mode; Bubble SortingAlgorithmThe result depends only on the comparison function provided by you. If you provide two different functor for comparing age and name, the function is applied to the same algorithm for Bubble sorting, you can get two results.

Parameterization

In fact, is it a parameter in the maximum range? IOC, dependency injection, configuration, functor, isn't it an application of the Idea of "parameter"? (this is unnecessary and boring)

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.