aspose file tools*
The moose likes OO, Patterns, UML and Refactoring and the fly likes Did I make the Strategy pattern unnecessarily complicated? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "Did I make the Strategy pattern unnecessarily complicated?" Watch "Did I make the Strategy pattern unnecessarily complicated?" New topic
Author

Did I make the Strategy pattern unnecessarily complicated?

Matt Pavlovich
Ranch Hand

Joined: Aug 14, 2010
Posts: 98
Hello all.

I am getting ready to start my Developer exam here in a few weeks, but first I wanted to read a couple books. The first, Effective Java, and the second Head Fist Design patterns (I already read SCJD Exam with J2SE5). I am trying to apply some principles that I found in Effective Java - namely static factory methods, immutable classes, and forwarding methods. I am studying the Strategy Pattern, and applying the above Effective Java principles to it. I was hoping someone might want to take a look at the simple bit of code I pasted, to tell me what they think the people grading the exam might think. I don't know if I just made the Strategy pattern unnecessarily complicated, or if I actually accomplished something worthwhile by removing inheritance from the pattern (as is a strong suggestion found in Effective Java). Don't get me wrong...I'm not trying to reinvent the wheel. I just want to better understand and apply these things (without creating problems for myself) before I get my exam.

Thanks to everyone here and congrats to all the people who have passed.

Matt


Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5610
    
  15

The only thing I can say: don't just use design patterns for the sake of using design patterns in the OCMJD. It is not the purpose to add all 25 design patterns you know (or you have learnt) in this assignment. Just use the one which have an added value and leave the others out. I used (as far as I can remember): singleton, dao factory, mvc and value (transfer) object. Other people also use the facade design pattern, but I don't believe I have heard mentioning the strategy design pattern.

Because you just want something to know about your view/implementation on the Strategy design pattern, I'm moving this thread to a more appropriate forum.


SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
http://www.javaroe.be/
Matt Pavlovich
Ranch Hand

Joined: Aug 14, 2010
Posts: 98
Thanks very much for your input. I will keep that in mind when I start.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Did I make the Strategy pattern unnecessarily complicated?