powered by Jive Software

Picocontainer

Any particular reason to use picocontainer instead of a simple Hashtable with key, value pair.

All packets will be available to the transport components.

Picocontainer was added there by the Jive people, and I was told “I would like it”. =) As you can probably see, I haven’‘t really used it. I don’'t understand it enough yet to use it for anything. Why, do you have something against it?

HashTables or HashMaps, are deficient in the fact that I need to know how to retrieve a service. PicoContainer is a dependency injection framework, which means essentially whatever my class needs to run is provided for it by the framework. So, instead of my class Foo knowing how it can retrieve a reference for the Bar class, the Bar class instead is given to the Foo class when it is instantiated.

This allows for cleaner code, and IMHO generally better OO design, which in turn leads to improved testability.

That is a rather simplistic view and barely scratches the surface of what a DI framework can provide but it should give you a good idea as to why we use PicoContainer.

Cheers,

Alex

Thank you Alex.

Yah, I know about the injection pattern.