Click here to Skip to main content
15,909,445 members
Home / Discussions / Design and Architecture
   

Design and Architecture

 
AnswerRe: walk with open source software version Pin
Eddy Vluggen10-Apr-10 23:38
professionalEddy Vluggen10-Apr-10 23:38 
QuestionDesigning Dynamic Reports Pin
Richard Blythe9-Apr-10 6:33
Richard Blythe9-Apr-10 6:33 
AnswerRe: Designing Dynamic Reports Pin
Jonathan Davies10-Apr-10 2:01
Jonathan Davies10-Apr-10 2:01 
AnswerRe: Designing Dynamic Reports Pin
Mycroft Holmes11-Apr-10 0:39
professionalMycroft Holmes11-Apr-10 0:39 
QuestionBusiness Process /DFD Pin
εїзεїзεїз21-Mar-10 23:26
εїзεїзεїз21-Mar-10 23:26 
QuestionMVP/MVC/Decoupled architecture VS modern databound controls Pin
ruanr18-Mar-10 4:31
ruanr18-Mar-10 4:31 
JokeRe: MVP/MVC/Decoupled architecture VS modern databound controls Pin
Luc Pattyn18-Mar-10 5:44
sitebuilderLuc Pattyn18-Mar-10 5:44 
AnswerRe: MVP/MVC/Decoupled architecture VS modern databound controls Pin
Jonathan Davies19-Mar-10 2:41
Jonathan Davies19-Mar-10 2:41 
AnswerRe: MVP/MVC/Decoupled architecture VS modern databound controls Pin
Eddy Vluggen27-Mar-10 22:16
professionalEddy Vluggen27-Mar-10 22:16 
AnswerRe: MVP/MVC/Decoupled architecture VS modern databound controls Pin
Abhinav S27-Mar-10 22:25
Abhinav S27-Mar-10 22:25 
AnswerRe: MVP/MVC/Decoupled architecture VS modern databound controls Pin
Mycroft Holmes11-Apr-10 0:52
professionalMycroft Holmes11-Apr-10 0:52 
QuestionDevelopment Magazines Pin
Dio2216-Mar-10 11:12
Dio2216-Mar-10 11:12 
AnswerRe: Development Magazines Pin
Kevin Marois20-Apr-10 7:29
professionalKevin Marois20-Apr-10 7:29 
QuestionLMS platform Pin
chiranjeevi110511-Mar-10 19:34
chiranjeevi110511-Mar-10 19:34 
AnswerRe: LMS platform PinPopular
R. Giskard Reventlov11-Mar-10 21:22
R. Giskard Reventlov11-Mar-10 21:22 
QuestionComposition/Aggregation law of demeter Pin
DiiJAY7-Mar-10 9:54
DiiJAY7-Mar-10 9:54 
GeneralRe: Composition/Aggregation law of demeter Pin
Graham Breach7-Mar-10 10:15
Graham Breach7-Mar-10 10:15 
AnswerRe: Composition/Aggregation law of demeter Pin
Luc Pattyn7-Mar-10 10:48
sitebuilderLuc Pattyn7-Mar-10 10:48 
GeneralRe: Composition/Aggregation law of demeter Pin
DiiJAY7-Mar-10 22:06
DiiJAY7-Mar-10 22:06 
GeneralRe: Composition/Aggregation law of demeter Pin
Graham Breach7-Mar-10 23:42
Graham Breach7-Mar-10 23:42 
GeneralRe: Composition/Aggregation law of demeter Pin
Jonathan Davies8-Mar-10 1:10
Jonathan Davies8-Mar-10 1:10 
AnswerRe: Composition/Aggregation law of demeter Pin
Pete O'Hanlon8-Mar-10 1:36
mvePete O'Hanlon8-Mar-10 1:36 
There are various patterns that you could apply here, but the one that immediately springs to mind here is that you could use a Mediator here. Depending on the implementation of the Mediator, what you might want to do is:
public class Door
{
  public Door()
  {
  }

  public void Open()
  {
    _isOpen = true;
    Mediator.Instance.NotifyColleagues(DoorState.Open);
  }

  public void Close()
  {
    _isOpen = false;
    Mediator.Instance.NotifyColleagues(DoorState.Closed);
  }
}

public class House
{
  private int _ambientTemperature = 22;

  public House()
  {
    Mediator.Instance.Register((object o) => { _ambientTemperature -= 2; }, DoorState.Open);
    Mediator.Instance.Register((object o) => { _ambientTemperature += 2; }, DoorState.Closed);
  }
}
In this example, House is decoupled from Door; it registers an interest in the DoorState messages and reacts accordingly without any events having to tunnel up. It's the responsibility of the Mediator to route the message to the appropriate targets, so everything becomes nice and decoupled - more importantly, this is easily testable. If you want a sample Mediator, this is based around the one I use here[^].

"WPF has many lovers. It's a veritable porn star!" - Josh Smith

As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.


My blog | My articles | MoXAML PowerToys | Onyx



AnswerRe: Composition/Aggregation law of demeter Pin
DiiJAY8-Mar-10 6:08
DiiJAY8-Mar-10 6:08 
GeneralRe: Composition/Aggregation law of demeter Pin
Jonathan Davies8-Mar-10 6:26
Jonathan Davies8-Mar-10 6:26 
GeneralRe: Composition/Aggregation law of demeter Pin
DiiJAY8-Mar-10 6:47
DiiJAY8-Mar-10 6:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.