Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do people talk about DI frameworks "instantiating an object graph" rather than "instantiating objects"?

I'm reading a book about DI that always talks about DI frameworks "instantiating an object graph". Why say it this way rather than "instantiating objects"?

like image 655
Chuck Avatar asked Mar 28 '10 17:03

Chuck


1 Answers

A graph of objects consists of objects that hold references to each other. Another name for a graph in this context is a network.

An IOC system wouldn't be much use if it forgot to set up the references between the objects! It's the way the objects automatically get references to other objects they need that is the whole value of an IOC system.

like image 73
Daniel Earwicker Avatar answered Sep 22 '22 01:09

Daniel Earwicker