Brian's Waste of Time

Tue, 28 Aug 2007

Components vs Objects

One of the nasty questions when using lightweight component-oriented stuff (Spring, Guice, Pico, #{LightweightContainerOfTheMoment}) is what to make a component and what to make somethng that you just instantiate. At one end of the spectrum are folks that say "new is evil, inject everything." I equate that to people who say "mutable state is evil, never change anything" -- cute in principle, but one of the reasons you don't know of a single piece of software written in Clean.

Thinking about it just a moment ago I had the thought "if it maintains internal state it should be an injected component." I certainly don't work this way in practice, but something about the statement rings... as potentially worth investigating.

In the abstract, lie this, the question is absurd and pointless -- "angels on pin" stuff. I definitely have the practices I follow, but I am not sure I can explain them. Weird.

0 writebacks [/src] permanent link