Click here to Skip to main content
15,888,053 members
Home / Discussions / Design and Architecture
   

Design and Architecture

 
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 
GeneralRe: Composition/Aggregation law of demeter Pin
Jonathan Davies8-Mar-10 7:22
Jonathan Davies8-Mar-10 7:22 
GeneralRe: Composition/Aggregation law of demeter Pin
DiiJAY8-Mar-10 9:26
DiiJAY8-Mar-10 9:26 
GeneralRe: Composition/Aggregation law of demeter Pin
Jonathan Davies8-Mar-10 10:01
Jonathan Davies8-Mar-10 10:01 
GeneralRe: Composition/Aggregation law of demeter Pin
David Skelly8-Mar-10 22:24
David Skelly8-Mar-10 22:24 
GeneralRe: Composition/Aggregation law of demeter [modified] Pin
Jonathan Davies8-Mar-10 23:35
Jonathan Davies8-Mar-10 23:35 
QuestionWhat do you think? Pin
Megidolaon5-Mar-10 9:02
Megidolaon5-Mar-10 9:02 
AnswerRe: What do you think? Pin
Pete O'Hanlon5-Mar-10 10:24
mvePete O'Hanlon5-Mar-10 10:24 
AnswerRe: What do you think? Pin
Jonathan Davies8-Mar-10 1:25
Jonathan Davies8-Mar-10 1:25 
QuestionWhat is System Architecture Diagram Pin
meeram39524-Feb-10 21:48
meeram39524-Feb-10 21:48 
AnswerRe: What is System Architecture Diagram Pin
R. Giskard Reventlov24-Feb-10 22:05
R. Giskard Reventlov24-Feb-10 22:05 
QuestionEnterprise Application Blocks for .Net Pin
meeram39522-Feb-10 22:09
meeram39522-Feb-10 22:09 
AnswerRe: Enterprise Application Blocks for .Net Pin
Richard MacCutchan22-Feb-10 22:36
mveRichard MacCutchan22-Feb-10 22:36 
QuestionInternet Firewall Pin
Abhirami vijayan21-Feb-10 18:32
Abhirami vijayan21-Feb-10 18:32 
AnswerRe: Internet Firewall Pin
Richard MacCutchan21-Feb-10 22:03
mveRichard MacCutchan21-Feb-10 22:03 

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.