I have a program which generates events. They are ordered with a Lamport clock and sent over the network. They may arrive in a different order. On the receiving end I have an object which re-orders the events. This object can be popped like a queue and either returns the next event according to the Lamport clock or fails. It can filter the duplicate events out if any. It is thread-safe so that events can be pushed and popped in parallel.

This sounds like a well-known pattern. Is it the case, and if so is there a standard name for this object?

  • 2
    There are a two questions here, the "name that $thing" one seems off-topic meta.programmers.stackexchange.com/questions/6582/…, and heavily depends on the naming conventions of your project. The second question is addressed here programmers.stackexchange.com/questions/152094/… – Caleth May 24 '16 at 11:14
  • Thanks for the pointers. I edited so that the question is on-topic for this site. I have removed the other part of the question as you are right that there were 2 questions. – marcv81 May 24 '16 at 11:24
  • Guys, I don't mind the downvotes but do yourselves a favour and explain why you have a problem with the question. Otherwise the quality is not likely to improve. – marcv81 May 24 '16 at 13:39
  • 1
    Caleth's comment doesn't count as an explanation? (not that I downvoted) – Ixrec May 25 '16 at 11:10
  • I edited the question after Caleth's explained that it might not be on topic. I believe the new version of the question is on topic. Some downvotes happened after that. – marcv81 May 25 '16 at 15:57

The well-known pattern may be the Observer pattern, in which case the object is called the "subject".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.