Nyimi Jose wrote:
>
> More and more my fellow Java's friends tell me about IoC.
> What is IoC in Perl world ?
> Examples ?
>
> Here are some links about IoC a friend gave to me :
> http://picocontainer.org/ioc.html
> http://jakarta.apache-korea.org/avalon/framework/guide-patterns-ioc.html
> http://www.springframework.org/docs/lightweight_container.html
> http://javangelist.snipsnap.org/space/IoC

Hi Jos�.

This pairs nicely with Kevin's question about callbacks, because
that's essentially what IoC is. In the classic model the code
know all about the structure of the program as a whole and where
to find the functions it needs. You will code your Perl program
to call a particular member function from a specific package.

In IoC your code only needs to declare what it's able to do
and the lower-level software will decide when to call it.

In Joseph's 'sort' example in the 'What is a callback' thread
the compare function just sets itself up, saying 'I can tell
you which order a pair of values should be in'. It then sits
back and waits to be summoned.

Another obvious IoC situation is in Windows programming, where
the program is effectively just a fixed set of subroutines that
Windows needs to call at the appropriate time.

But don't go trying to write code using IoC just because somebody's
recently thought of a name for it. The idea's been around a long
time and it isn't often a good way to write stuff.

HTH,

Rob



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to