On Dec 30, 2004, at 5:53 PM, Matthew Simon Cavalletto wrote:
In addition to the Config::ApacheFormat mechanism that has been discussed, I think there's also an argument for adding a simpler Perl calling API.
For example, I think that the following can be unambiguously converted to the above:
IOC::Registry->add_registration( 'MyApp' => 'DBI' => {
'dsn' => 'dbi:mysql:test',
'username' => 'test',
'password' => '****',
'connection' => [ 'DBI', 'connect', '@dsn', '@username', '@password' ],
} );
That's a lot easier to read, and one could always switch back to the other syntax where needed... Perhaps this convenience interface belongs in a separate "IOC::Easy" facade package, which could provide class methods (or even exportable functions) that obscured the whole underlying network of various kinds of IOC objects.
I like this idea, and is something I have given some consideration to in the past, but never gotten around too. My only worry though is that the perl syntax may eventually get really messy with too many {}[]()s everywhere if the configuration is very large and complex (which some of my IOC configs are).
Hmmmm, this is some serious food for thought though.
Lastly, it's worth noting that lightweight versions of this kind of system have been in the Perl toolkit for years, whether in home-rolled form or using a module like Tie::Discovery:
I was not aware of Tie::Discovery, it is interesting, it is like a IOC::SuperSuperLite (written a few years before).
IOC and its ideas are not anything new though, I agree. I have a number of home-rolled solutions, all of which eventually fell apart after hitting some sort of complexity/size barrier and turned into spaghetti configurations. At this point IOC is holding up pretty well, and I am keeping my fingers crossed.
I can see that the IOC framework is much more powerful and extensible, but it would be nice if the simple cases could also be as simple.
I agree, simple things should be simple, although to be honest, while IOC is made to be as lightweight as possible, it is really only lightweight within the context of large applications. For small stuff, it tends to dwarf the actual code, and is not worth using. So I guess what I am getting at is that really simple stuff shouldn't use IOC, and therefore I am assuming my base level will have a non-trivial amount of complexity to it.
I suppose (at least for my purposes) I am looking for something which helps reduce the complexity of larger IOC configurations, rather than makes simpler ones even simpler.
But its getting late, and I am rambling, and I don't want to seem like I am dismissing your idea/point because that is not my intention, I just need to get some sleep.
Thanks Simon, interesting food for thought always :)
- Steve
_______________________________________________ sw-design mailing list [email protected] http://metaperl.com/cgi-bin/mailman/listinfo/sw-design
