[Java] what is ioc?

Source: Internet
Author: User

I often hear about IOC and spring. What is IOC?

IOC can be understood as an implementation method of 'interface-Oriented Programming ide'. IOC implements mandatory 'interface-Oriented Programming '.

Spring forcesProgramImplement the class according to the architect's idea.

For example, the architect designs three business objects: users, data pools, and data elements. Architects want these three objects to provide their own interfaces so that users can call the data pool, and the data pool can contain data elements.

How can an architect enable a programmer to understand what he wants to do and force the programmer to write according to his design?CodeWhat about it?

Spring is like this. It defines classes according to interfaces and defines the relationships between classes. If a programmer's class is not correctly written, its class will be 'assemb' and will not come in. Because the interface is defined prior to the implementation, once the implementation of the programmer is incorrect, it is easy to find out who is implementing the problem.

This is why Java programmers are cheap and must have an architect. Whether spring can work effectively depends on the architect's design. The main job of programmers is to fill in the blanks.

This is why we say that Java is heavy. to do something, you must design an interface. If you are agile and want to change the interface, it will be hard for IOC. The problem encountered by 'interface-Oriented Programming 'is the problem encountered by IOC.

Therefore, do you want to use spring and IOC? You just need to ask yourself the question "I want to adopt interface-oriented programming in this product? This question is easier to answer.

In comparison, how can I solve this problem without IOC in C ++? Generally, there are several methods: 1. Cut the program into multiple small programs, and each program provides simple external services; 2. Write the design documents and define the functions and interfaces of each class in the design documents; 3. Make a summary design and then perform Agile programming in the group. Each of these three methods has its own advantages and disadvantages. You must select one based on your project and team.

In contrast, we can find that Java is indeed more suitable for writing large segments with complicated logic than C ++. A framework like spring introduces rigid constraints and reduces communication costs. (In addition, C ++ has a memory out-of-bounds problem)

Then we can also find that ultra-large-scale systems still need to adopt the cutting method, so Java is good at the big block header and thus has no advantage. Because the bulk header also increases the maintenance difficulty of ultra-large scale systems.

The same is true in the real world. Java is suitable for developing enterprise applications with a large chunk of data. Ultra-large-scale systems are available in a variety of technologies.

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.