Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Pettern Advice needed

 
Maalti Iyer
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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?.

Thanks
Maalti
 
Amit G Piplani
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think so any pattern will solve that flexibility, you have to design your framework for this.
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Maalti Iyer
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I understand Command. For each message type I issue one command.What will be the role of Strategy?. How to implement it here?

Again Thanks
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic