The key to understanding the IOC is to be clear: who controls who, what controls, why it is reversed

Source: Internet
Author: User

IoC is not a technology, but an idea, an important object-oriented programming law that can guide us in designing loosely coupled, better programs. Traditional applications are created by us to create dependent objects within the class, which causes the class to be highly coupled to the class and difficult to test; with the IOC container, the control of creating and finding dependent objects is given to the container, which is injected by the container, so that the object is loosely coupled with the object, so it is also easy to test. Facilitates functional reuse and, more importantly, makes the entire architecture of the program very flexible.

Interview, chatting with the feelings of the problem are asked in their own "point", the answer is very smooth, and then slowly expanded. When it comes to modularity, my mind smokes, with the feeling that I have said the approximate steps of requirejs implementation, filled with the desire to express, a heap of nonsense. Lucky can not be on the spot let me write it over, after an attempt, here to share with you my implementation.

We should show it in the whole after the internal assembly is finished. (Similar to builder mode, but different, the biggest difference is that the construction process in the builder's pattern is stable, and the process of wearing various costumes in our case is unstable.) I'll talk about the builder pattern later in the blog post. )

Profile allows us to define a series of http://www.cnblogs.com/nwqrtj/configuration information and then specify its activation criteria. This allows us to define multiple profiles, and then each profile corresponds to different activation conditions and configuration information to achieve the effect of using different configuration information in different environments.

OAuth2 early in the outbreak of a lot of related security loopholes, in fact, after careful analysis will find that most are not strictly follow the safety-related guidance of OAuth2, the related vulnerability event Baidu below has.

If a function calls itself internally, the function is a recursive function. Recursive function calls are similar to loops, and in theory, all recursive functions can be written as loops, but the advantage of recursive functions is that they are simple in definition and clear in logic. Recursion and looping are a repetitive process, and these repetitive operations must be of a regular nature. In addition, it is obvious that the recursive function also requires an end condition, otherwise it will be recursive like a dead loop until it is terminated due to a stack overflow (described below).

This becomes the use of "lazy", in the need to use the class, and then instantiate, solve the above mentioned shortcomings, called "lazy-type". However, there is a thread-safety problem that can cause duplicate objects to be created, contrary to the idea of Singleton mode.

Cache data: Its expiration time http://www.cnblogs.com/eamert/is 1 time times longer than the cache tag, for example: Tag cache time 30 minutes, data cache set to 60 minutes. This way, when the cache tag key expires, the actual cache can also return the old data to the caller until another thread returns to the new cache after the background update is complete.

What is a delegate? Delegates are type-safe in C # and can subscribe to one or more function pointers with the same signature method. A delegate can pass a function as a parameter, and its practical meaning is to let someone else act on your behalf. A delegate can be seen as a pointer to a function, an integer can point to it with an integer variable, and an object can point to it with an object variable.
A function can also point to it with a delegate variable. We can choose to consider a delegate type as an interface that defines only one method, while an instance of a delegate can be seen as an object that implements that interface.

Small steps to optimize the product through iteration, but if each iteration of http://www.cnblogs.com/yvadrq/has overturned the previous design, that is, the same time, every iteration to know where this iteration is a problem, and then to optimize for the problem, rather than frequent revision, Continuous optimization, this must be based on better data monitoring and data analysis, people are biased but the data will not,.

We will need to define the operations that are injected with the AOP method into one interceptor and apply them to a type or method in some way (I use the most direct notation attribute). At run time we create a proxy for the target object, and our call to the proxy object is automatically passed to the target object. However, when the target object is finally called, the registered interceptor will be executed sequentially.

This is what I have been following the http://www.6tyu.com/practice-driven learning, the process is very exercise, very useful, but I am a mechanical design drawing what ability is poor, there is a picture of the course design of gearbox, I put the interior wall and outside the mural in a line, also looks quite like, the teacher looked for a long time, Said you this picture is not right ah, but 1:30 will not say, haha, a bunch of people around where, finally said you this outer wall and the inner wall is how to draw together .... I do not understand, I myself, then the embarrassment, the roommate also helped me to check several times, the results of re-painting, can be bitter.

The key to understanding the IOC is to be clear: who controls who, what controls, why it is reversed

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.