LightWire or ColdSpring?
Below is my response. Any clarifications or refinements appreciated. Flames tolerated, but it'd be nice if we could have a logical, balanced, framework comparison between grown ups - just this once.
In particular, any additional benefits of ColdSpring that I've missed, I'd appreciate if you could add in the comments.
Well, I just posted a couple of entries:
http://www.pbell.com/index.cfm/2007/4/5/LightWire-Why-I-Love-Mixin-Injections
Here are some thoughts: ColdSpring is much more widely used. It has been out there longer. It has better documentation. It is solid, works well and there are a good community of users. It is also the only game in town (at the moment) if you want AOP or automagic remote bean proxies.
Two minor LW considerations:
LightWire is smaller (two files) so if you happen to want to drop it into a project, you don’t need to add a mapping and a whole other dependency – you just add two files plus your config.
LightWire is simpler – if you want to know HOW a DI engine works, the core code in LightWire is under 400 lines so it is a great way to look under the hood and really get the pattern.
Three bigger ones:
1. DI Into Transients: LightWire is OPTIMIZED for DI into transients as well as singletons. You CAN DI into transients using ColdSpring, but every time I asked, I was told it was not recommended. So if you want to do a lot of User.save() where you put UserDAO within the User object, at least look at LightWire as that is what it was build for.
2. Programmatic Config: LightWire uses a programmatic config. Programmatic configs vs. XML is pretty much a religious war. All I will say is that there are clearly benefits to both approaches depending on your use cases (there are seldom wars between a smart approach and a consistently useless and stupid one) so if you want a programmatic config file, feel free to check out LightWire.
3. Mixin injection: See the second link above, but basically this is a third type of DI in addition to constructor and setter injection (which LightWire also supports). In my opinion it allows for the benefit of setter injection (handling circular dependencies) without having to add a bunch of setter methods to your classes just to make your DI work. I love the approach, but it is not a widespread solution (I haven’t noticed it in any other DI frameworks in any languages, although I may have missed it).
Please also note that unlike ColdSpring, LightWire does not support auto-wiring. I’d rather have a single definitive config file and use mixin injection to cut down on all of the spurious setter methods, but if you like auto-wiring, you won’t see it in LightWire – now or in the future.
I would recommend if you are interested in DI into transients, programmatic config or mixin injection you should check out LightWire. Otherwise, unless the small size or the learning benefits are of interest, I’d say ColdSpring is still the default choice.
Best Wishes, Peter



You are the eternal optomist!
Now, a lot of people ask what is the use when you can just as easily write the config in CF (or any other language) since it isn't compiled. The main point of using an XML file in any framework is not so that *YOU* the developer can change it (or for it to be a pain in the A** because it is a bulky format) but so that any other tool can edit it.
You can parse all the XML's of various apps and know what you are talking about (I am looking at you Struts, and Spring too!) by having a standard way to parse any configuration file.
Just my 2 british pence
Good point. There are MANY benefits of XML files - just search my blog for XML and you'll find a bunch of posts praising the benefits of the technology. I still find programmatic config files to better meet my use cases and I just like them more, but there are loads of good reasons to use XML and it is worth learning about all of them before you decide to go off and do something else.
You can put LightWire anywhere and you can put your LightBeanConfig file anywhere also (and they can be two different anywheres). You'll have to fix the "extends" path in your config file, and you'll have to know and use the right paths to instantiate your config bean and the framework, but it is designed to be easy to place anywhere. I personally don't put LightWire under a LightWire mapping but have it as a subdirectory under my main framework mapping, so I know it works.
George.
I know this sounds crazy, but ask on the coldbox list. Luis has added a *lot* of features to the version of lightwire there (it also now supports XML, autowiring, etc) so this is something someone on the coldbox list could probably answer best. FYI, I'll be reviewing their edits and putting them into the main LW project, but it may be a couple of weeks.