Results 1 to 5 of 5

Thread: Command-Query responsability segregation and change notification

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Jul 2002
    Location
    Dublin, Ireland
    Posts
    2,148

    Command-Query responsability segregation and change notification

    Hi

    I am build a large application and have based it around the Comand-Query responsability segregation pattern for a number of reasons (allowing me to segregate the work between developers with lower model-contention and also because the command side triggers some complex actions) but am wondering on the best approach to data-impacting commands.

    Currently thinking that the command library should expose a pub-sub notification library that a UI can hook into and listen for messages that tell it "a data impacting thing has occured - you shoud refresh your data". However this violates the "make your UI as dumb as possible" rule.

    Any other ideas on how I should do this?
    Last edited by Merrion; Mar 24th, 2013 at 02:53 PM. Reason: better info link

  2. #2

    Thread Starter
    PowerPoster
    Join Date
    Jul 2002
    Location
    Dublin, Ireland
    Posts
    2,148

    Re: Command-Query responsability segregation and change notification

    To add a bit of colour - this is a financial applicatio and the "commands" would do things like placing trades on the market as well as saving data so that makes the segregation of "read data" and "do something" more sensible.

    But the command might need the source data updating i.e. "I know you wanted to execute this at a price of $20.34 but the price has moved on to $20.55 and because that price is within limits I executed it anyway - you need to update your calcs..."

  3. #3
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: Command-Query responsability segregation and change notification

    How are you communicating between the UI and the backend that knows that "data impacting has occured"??

    Are they on different machines - workstation and server, for instance??

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  4. #4

    Thread Starter
    PowerPoster
    Join Date
    Jul 2002
    Location
    Dublin, Ireland
    Posts
    2,148

    Re: Command-Query responsability segregation and change notification

    Yes - different machines. The UI is (probably) going to be silverlight communicating over WCF.

    I think the UI is going to have to sub to an event e.g. "I am currenty looking at this x" and then a message is posted to tell it "you know you are looking at x? well refresh your cache because it has changed"..

  5. #5

    Thread Starter
    PowerPoster
    Join Date
    Jul 2002
    Location
    Dublin, Ireland
    Posts
    2,148

    Re: Command-Query responsability segregation and change notification

    Should anyone be thinking about this, my experience is that the CQRS architecture works very well for a big team that needs to move fast as it prevents "model contention" but you do need to spend a lot of time explaining what you are doing to developers who are used to "understanding the logic by looking at the database".

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width