0% found this document useful (0 votes)
7 views

SoftEng-Lab-IoC-DI

Uploaded by

somi somi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

SoftEng-Lab-IoC-DI

Uploaded by

somi somi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

28/2/2022

Inversion of Control (IoC) and


Dependency Injection (DI)
www.cs.uoi.gr/~zarras/http://www.cs.uoi.gr/~zarras/se.htm

martinfowler.com/articles/injection.html#ComponentsAndServices
www.baeldung.com/inversion-control-and-dependency-injection-in-spring
crosp.net/blog/software-architecture/clean-architecture-part-2-the-clean-architecture/

What is Inversion of Control


(IoC)?

1
28/2/2022

What is IoC?

Inversion of Control (IoC) in software engineering is the act of transferring


the control of application objects (components, services, …) to a software
engineering framework.

The framework will be responsible for creating objects, assembling/associating


complex objects and managing the objects lifecycle.

Typically, the part of the framework that does this is called a container.

What is IoC?
Frequent terms that are used for the application objects that are managed by
the framework is beans or components.

NOT ALL application objects worth being managed by the


framework !!!

Typically, this is useful for important objects that constitute the backbone of
the application e.g.,
controllers that accept web requests,

service objects that realize the core operations of the application,

data mapper objects that interact with the database management system,

other objects that should be easily configured when the application starts
and/or reconfigured while the application is running ….

2
28/2/2022

What is Dependency Injection


(DI)?

What is DI?

Dependency Injection (DI) in software engineering is the act of


assembling/associating composite/aggregate objects.

The basic idea is to have an assembler object that is responsible for setting
the object fields of a composite/aggregate object to refer to other constituent
objects.

Typically, in frameworks the role of the assembler is played by the container


and the injection is transparent to the application.

Often, the application guides the assembler with guidelines provided in


configuration files or more recently with inline annotations.

You might also like