Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: Patterns, Principles and Practices of Domain-Driven Design
This is the forum to discuss the Wrox book Patterns, Principles and Practices of Domain-Driven Design by Scott Millett; ISBN: 978-1-118-71470-6
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Patterns, Principles and Practices of Domain-Driven Design section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 3rd, 2015, 09:52 AM
Registered User
Points: 5, Level: 1
Points: 5, Level: 1 Points: 5, Level: 1 Points: 5, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2015
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Having a Domain Event update the UI?‏

I was wondering about how you would have a Domain Event update the UI (for instance, using AngularJS/WPF/etc.). For example, if someone changes the name of a Product while another user is looking at the Product page.

Should you:
  • Just have the UI poll to check for changes/updates?
  • Only update the UI based on manual user refreshes?
  • Have the UI listen directly to a message bus and respond to messages?

Are there any advantages/disadvantages of each approach? Which do you use, if any?

Thanks,
 
Old August 4th, 2015, 01:21 PM
Wrox Author
Points: 237, Level: 4
Points: 237, Level: 4 Points: 237, Level: 4 Points: 237, Level: 4
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2015
Posts: 59
Thanks: 1
Thanked 5 Times in 5 Posts
Default

Hi,

Great question.

For this scenario I would use a websockets/long polling based solution. A domain event would be fired in one bounded context and it would be handled in the website. The website would then pump the event down to the browser; perhaps translated into a UI-specific format.

In .NET I would use SignalR, on the JVM I would use Atmosphere.

Other solutions do exist, though, especially when using Event Sourcing. You could expose your domain events as an atom feed, which is directly polled by the UI. As soon as a new event appears on the atom feed, that is the UI's trigger to apply the event to the UI.

With the latter approach you have to write the polling logic yourself on every view page. With the former you have to learn a complex framework and couple yourselves to it a bit.

Inside a desktop application/WPF it's probably easier. Inside your message handler you could just update the view model, which would then propagate changes to the UI, if you are using MVVM.

Sound useful?

Last edited by nick_t; August 4th, 2015 at 01:25 PM..
 
Old February 11th, 2016, 09:12 AM
Registered User
Points: 15, Level: 1
Points: 15, Level: 1 Points: 15, Level: 1 Points: 15, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Feb 2016
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Thanks for recommending Atmosphere. Looks very interesting.

Quote:
Originally Posted by nick_t View Post
Hi,

Great question.

For this scenario I would use a websockets/long polling based solution. A domain event would be fired in one bounded context and it would be handled in the website. The website would then pump the event down to the browser; perhaps translated into a UI-specific format.

In .NET I would use SignalR, on the JVM I would use Atmosphere.

Other solutions do exist, though, especially when using Event Sourcing. You could expose your domain events as an atom feed, which is directly polled by the UI. As soon as a new event appears on the atom feed, that is the UI's trigger to apply the event to the UI.

With the latter approach you have to write the polling logic yourself on every view page. With the former you have to learn a complex framework and couple yourselves to it a bit.

Inside a desktop application/WPF it's probably easier. Inside your message handler you could just update the view model, which would then propagate changes to the UI, if you are using MVVM.

Sound useful?
 
Old February 11th, 2016, 05:41 PM
Wrox Author
Points: 237, Level: 4
Points: 237, Level: 4 Points: 237, Level: 4 Points: 237, Level: 4
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2015
Posts: 59
Thanks: 1
Thanked 5 Times in 5 Posts
Default

I first used atmosphere almost 3 years ago in a Scala/Akka/Play Framework app: http://blog.ntcoding.com/2013/09/atm...p-by-step.html

Good memories It's probably advanced quite a lot since then so I'm not sure I could help much. But I'd be keen to hear how you get on with it. So please feel free to share your story on here.




Similar Threads
Thread Thread Starter Forum Replies Last Post
Mirroring the domain behaviors on the UI varghesep BOOK: Patterns, Principles and Practices of Domain-Driven Design 2 May 30th, 2015 10:29 AM
Is it possible to dynamically update OnClick code for Event? AnninCT Access VBA 2 April 16th, 2010 03:24 PM
Extra conditional update click event in FormView nuttylife2 ASP.NET 2.0 Professional 1 July 31st, 2006 08:00 PM
MsgBox in Enter Event does not allow update richtrini Excel VBA 2 March 8th, 2006 10:43 AM
why not run in MM:update event? zzzz8888 ASP.NET 1.0 and 1.1 Basics 0 May 26th, 2004 10:07 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.