This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Did I make the Strategy pattern unnecessarily complicated?

 
Matt Pavlovich
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 9835
103
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Matt Pavlovich
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks very much for your input. I will keep that in mind when I start.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic