Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C# 2012/5.0 > BOOK: Patterns, Principles and Practices of Domain-Driven Design
Password Reminder
Register
| FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
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,
Reply With Quote
  #2 (permalink)  
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..
Reply With Quote
  #3 (permalink)  
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?
Reply With Quote
  #4 (permalink)  
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.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 04:02 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.