Click here to Skip to main content
15,895,799 members
Home / Discussions / Design and Architecture
   

Design and Architecture

 
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 
Hi,

I have question regarding architecture when dealing with composition/aggregation hierarchy. The three classes below "House", "Room" and "Door" describes a simple nested architecture used for this question. This architecture means that when I use a House object and want to refer to a door nested in a Room I will brake the "Law of demeter" rule that states that I should only use direct connection like House.ToString() not indirect connection like House.Room.Door.ToString(), is this okay or bad practise, is there any better way of organising the architecture?



Would it be better to do helper functions for the door in the Room Class, and not expose a Door object public, like:

DoorOpen();

DoorClose();



If this arhitecture is prefered, what should be done with the events inside the Door class, should they also be defined once again in the Room class and be "chained" back thru it's parent classes some way ?





Any thoughts, tips and ideas would be helpful.




public class House
{

public House()
{
Room = new Room();
}

public Room Room { get; private set; }

}


public class Room
{

public Room()
{
Door = new Door();
}

public Door Door { get; private set; }

}


public class Door
{

public event EventHandler<EventArgs> OnOpen;
public event EventHandler<EventArgs> OnClose;
private bool _isOpen;

public Door()
{
}

public void Open()
{
_isOpen = true;
OnOpen(this, new EventArgs());
}

public void Close()
{
_isOpen = false;
OnClose(this, new EventArgs());
}

}
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 
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 

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.