What is the inversion of control?

Inversion of inspection (IOC) is a programming technique in which the general structure of the code is used to control a number of unique and specific subprogres. This changes traditional programming methods where a specific code controls a number of repeatedly usable and general subroutines upside down. Inspection inversion is usually used in situations where the programmer knows that it will not need to use a specific code more than once, allowing a flexible design where the program subroutines can be switched and out without significant changes in the overall program.

Traditional versus ioc programming

In traditional programming, the main body of the code will repeatedly require general subroutines that perform individual functions. For example, in the accounting program, subroutities will be designed to allow the end user to search for a specific order number, probably in different parts of the program several times, allowing the user to perform a very general search algorithm from a number of different areasAMU. Reuse of code simplifies the programming process, but creates complexity if the programmer wants to tune the search algorithm for one part of the program without affecting the other parts in which the code is used.

Using the same example within the control scenario inversion, subroutines with a single search would not be called several times across a number of program areas. Instead, each part of the program would contain its own completely separate search subroutine. This increases the amount of time required for the originally coding of the program, but simplifies any specific improvements that would have to be made to individual subroutines later in the design process. The change in one subroutine in one particular area will leave the rest of the program completely unaffected.

Advantages ioC

One of the main advantage of this technique is that it makes it easier to design a program when working in a bigH teams. Given that communication between team members will necessarily show how the number of workers increases, the inspection inversion allows each team to program their own individual routines, allowing them to function independently of the second. It also simplifies the impact of errors in the system, as any persistent errors in each team subroutine will only affect their specific parts of the program. For this reason, when problems are discovered in one part of the system, the rest of the program should remain fully functional.

Disadvantages of IOC

In the inversion of control, it can simplify the design of the program, requires previous knowledge of how to design objects. Although each routine can be programmed individually, the IOC creator must know how to program each item if you need to make changes, so for starters is not always easy to program the IOC programmer. Also because each routine works independently, they are all visible to the outside world that some companies can frighten.

IN OTHER LANGUAGES

Was this article helpful? Thanks for the feedback Thanks for the feedback

How can we help? How can we help?