Brian's Waste of Time

Wed, 08 Sep 2004

VimContainer

After playing with PicoContainer and NanoContainer for a while and finding it very useful for the basics, I started running into lots of common things which could be optimized for the knowledgeable user instead of the novice. VimContainer was born.

Using VimContainer is easy -- in fact you can use it in most places you use PicoContainer or NanoContainer simply by setting your $CONTAINER environment variable. VimContainer eschews xml based configuration and uses a powerful modal config file:

:set vb t_vb=".         # stop it from beeping
:rci Wombat.class
:rci Kangaroo.class
:groovy components.each { |comp| comp.stageOneInit() }
:rci Fruitbat.class
:groovy components.each { |comp| comp.stageTwoInit() }
:%s/\.class//g          # oops, forgot, don't need the ".class"
i                       # enter interactive mode so end user can customize
:wq

VimContainer has a straightforward plugin interface, in the example above you can see the groovy plugin. Perl, and ruby are other popular ones, but they don't integrate quite as well as Groovy with Java container building. As specific machines and users tend to have their own container preferences (some people like aspected containers, some like constructors, some setters, etc), VimContainer supports per-user options configured in ~/.vimcontainerrc.

No more arguing for hours on end about whether to use setters or constructors, just allow each developer to specific how it should work. (Note that making this work requires the perl plugin and calling the :perl make_ioc_work_like_i_want() function at the end of the config file, and will involve a compilation step...)

=)

9 writebacks [/src/java] permanent link