This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I'm new to the pattern world. My problem at hand is : My JMS client receives three types of messages (JMS) and based on the type of content (several thousand messages) it will update or insert several tables (which are also used by an online system). The system has to be flexible enough to accomdate more tables in the future. Wondering what pattern suits this problem?.
I find myself using Command / Strategy a lot. I have a goal of a stable core that is closed for modification but open for extension for new products and user groups.
Create a command based on some field in the inbound message and delegate to the command. You can build a core message receiver & dispatcher that never changes and add dozens of new commands through configuration.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Joined: Jul 11, 2001
I understand Command. For each message type I issue one command.What will be the role of Strategy?. How to implement it here?
Joined: Jan 29, 2003
Command, Strategy and State all look a lot alike in the static object models. You obtain a concrete object based on some criteria and delegate to it. The motivation, benefits and timing are subtly different. If you have GoF review just the problem descriptions and reasons you might use the pattern. See if I used command terminology in a place where strategy might be a better fit. The code will work either way