0

I am writing an application that will post a message to an internal wiki page and an internal message service. I anticipate that I will need to post this message to additional interfaces down the road. Because of this, it seemed like a good opportunity to learn to use design-patterns. I'm a bit new to design patterns.

I've been reviewing them here. My question is, for my scenario, what do you think is the best option? They seem to overlap in some cases. Thank you for your input!

user208662
  • 10,869
  • 26
  • 73
  • 86

3 Answers3

0

If the various "destination" services each have a different API, an Adapter pattern will likely make your life a little easier. See my response to this stackoverflow question for greater detail.

Community
  • 1
  • 1
mikemanne
  • 3,535
  • 1
  • 22
  • 30
0

Certainly Observer Pattern is there to rescue you ;)

For an elaborated example

You can do something like this

public void postMessage(Message message) { // you can 
    // save message

    // now notify :))
    notifyObservers();
}
Kowser
  • 8,123
  • 7
  • 40
  • 63
0

If you're looking to deal with messages and routing them to services, I would recommend taking a look at the Enterprise Integration Patterns. They were specifically designed to handle the case where you are taking a message in and needing to transform it and send it elsewhere.

Ryan Gross
  • 6,423
  • 2
  • 32
  • 44