1 Dec 2005 04:42
Re: Spring DI Code Reuse was Am I doing too much refactoring?
Jim Cakalic <james.cakalic <at> charter.net>
2005-12-01 03:42:21 GMT
2005-12-01 03:42:21 GMT
Ian D. Stewart wrote: >Slightly off-topic, I've recently started working with the Spring >Framework and the concept of dependency injection, and one of the >pleasant surpirses I've encountered, in addition to a much cleaner >codebase, is a significant increase in code re-use. Because each of the >layers (Model, DAO, Service, Application Context) is able to exist >independant of the layer above it, I'm finding that code that I have >written for this one project is also being leveraged in other projects, >one of which I am not even involved in! > >On the down side, this does play havoc with tracking >accomplishments/progress on a per-project basis... :) > > Hi, Ian. Can you talk more about your experiences in this area? I'm particularly interested as I am consulting at a company that practices TDD. The architects are quite keen on the application of Robert Martin's principles of OO design. Yet they regularly subvert dependency inverting designs (IMO) arrived at by TDD and application of design principles by instantiating concrete classes in convenience constructors. Or indiscriminately using what I think Jeff Langr calls deferred factory mocking by having protected methods that instantiate specific concrete instances of dependencies that they then override in test subclasses so that they can inject a different object. Anyway, I and some others have been trying to get the architects to(Continue reading)
> Also, I do
> appreciate your advice about avoiding unnecessary injections. So far,
> our practice has been to inject a) objects for which we found a reason
> to use interfaces during TDD, and b) objects that would otherwise have
> to be passed through multiple layers to get to the right place -- say,
.rob.
>
>If anyone else has experiences related to use of Spring or another
RSS Feed