[thelist] OOD question

Marcus Andersson marcus at bristav.se
Fri Oct 8 08:27:20 CDT 2004


Scott Dexter wrote:
> I've been (re)reading through the GoF patterns at
> http://www.dofactory.com/Patterns/Patterns.aspx and find them just
> barely accessible. The real world samples help, but I'm going to
> apply them to a project (or two) to really get a feel for them. Any
> other references I might look into?

Yep, "Design Patterns" is a *little* abstract (and the site you mentioned is a bit short on descriptions). 
I've read it over and over the last 3-4 years and I have come to some sort of understanding (with 
complimentary reading from other sources and real life practice) but it has taken a lot of work. It's good 
knowledge though.

If you're into java then there is a book named "Applied Java Patterns". It mostly is a re-hash of the original 
GoF but with more examples/explanations and it's all written in Java (instead of C++).

Another great book is Fowlers "Patterns of Enterprise Application Architecture". Examples in both C# and Java. 
There is also short (really short) descriptions of these patterns on his site.

theserverside.com keeps a long list of discussions/articles about patterns. Might be worth to check out 
(http://www.theserverside.com/patterns/index.tss)

> 
> 
> 
>>implementations called Spring Framework and PicoContainer. I think
> 
> 
> These both use Inversion of Control, which is something else I've
> been reading about (also Martin Fowler --
> http://www.martinfowler.com/articles/injection.html) and trying to
> shift my thinking to apply these in my design tasks. Still working on
> it, need to read less, code more ;)

Start using IoC. It's really really worth the initial extra work to understand it (and it's much easier than 
the whole patterns package). I started to use it a while back and I cannot live without it anymore.

Btw, I used Constructor based injection in the example when wiring up the BusinessClass with the DAO. There is 
some discussion going on whether to use constructor or setter dependency injection (ie Pico favor constructor 
based injection and Spring favors setter based (there is also a new kid on the block, HiveMind, that is also 
leaning towards constructor based injection)). I normally use setter injection (as a Spring user) but 
constructor is more convenient in simple cases.

> 
>>Well, these were my thoughts of the problem at hand. I hope they
>>helped you with your thinking.
> 
> 
> It's the direction I'm trying to head down, and I'm attempting to
> apply these principles to existing code that I'm reviewing. Fun
> exercise, no?

Heh, yeah, right...

/Marcus


More information about the thelist mailing list