Inversion of Control pattern

Today I’ve finally found a very tangible example of what inversion of control actually is.Here is where i found my example, thank you Martin Fowler!
The example is rather simple actually: inversion of control is used in the graphical user interfaces, as opposed to command line prompts.

In command line prompts (classic control), the application sends prompt messages to the user, and reads the response.
In graphical user interfaces (inversion of control), the user interface framework itself generates events raised by text entered, buttons pressed, which triggers application code. Thus, control is inverted from the application logic itself in classic control schemes to the UI framework in the inversion of control scheme.

It’s actually quite simple, but this example helped me to understand IoC a lot more.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s