Click here to Skip to main content
15,888,454 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionValgrind like tool for windows Pin
Chintoo72311-Jan-06 15:34
Chintoo72311-Jan-06 15:34 
AnswerRe: Valgrind like tool for windows Pin
Stephen Hewitt11-Jan-06 16:23
Stephen Hewitt11-Jan-06 16:23 
QuestionSilly RichEdit question... Pin
KellyR11-Jan-06 12:36
KellyR11-Jan-06 12:36 
AnswerRe: Silly RichEdit question... Pin
Stephen Hewitt11-Jan-06 13:04
Stephen Hewitt11-Jan-06 13:04 
GeneralRe: Silly RichEdit question... Pin
KellyR11-Jan-06 14:12
KellyR11-Jan-06 14:12 
GeneralRe: Silly RichEdit question... Pin
Stephen Hewitt11-Jan-06 14:29
Stephen Hewitt11-Jan-06 14:29 
GeneralRe: Silly RichEdit question... Pin
KellyR11-Jan-06 14:38
KellyR11-Jan-06 14:38 
QuestionDesign patterns - simple questions. Pin
Nick_Kisialiou11-Jan-06 12:08
Nick_Kisialiou11-Jan-06 12:08 
Assumptions and constraints:
I am working with C++, Object-oriented design. I am using two layers - UI and domain layer which contains application logic.

Question 1.

Problem formulation:
At the architectural level I need to separate UI from the application logic. At the design level I am using a facade/controller object in the domain layer. To track the updates of the state of domain objects I use Publisher/Subscriber design pattern, so that domain objects remain decoupled from UI but UI objects received notifications when a domain object state changes.

Question:
Is Mediator pattern more appropriate for this purpose?

Justification:

The downsides of Publisher/Subscriber pattern:

a) Domain object is coupled to the Publish interface.
b) When moving UI to a difference process or a different remote computer in the network, the publishing logic must be changed.
c) UI objects are coupled to the Publisher.

How do I suggest applying Mediator (Mediator-Singleton)? (There may be several different Mediators serving this purpose.)

a) During initialization stage each object registers with the Mediator to either send or receive a message with a certain MessageID. (Since this specific Mediator is Singleton it can easily be made visible from all domain and UI objects.)
b) When state of the domain object changes, the latter sends a message to the Mediator to inform it about the change.
c) Mediator stores the received message in its storage and forwards the forwards the message to all listeners waiting for the corresponding MessageID.
This scheme achieves the separation of concers - concern of message passing is moved to a separate class instead of domain objects. All objects are decoupled except for the Mediator. This design supports the reuse, and can be easily extended to a network application. For network applications it is a concern of two Mediators in both computers to exchange the messages, thus the design is connection independent.

So why is it not used, but Publisher/Subscriber is used instead?

Question 2.

Problem formulation:
Separation of UI and domain objects is usually implemented with ONE facade/controller object in the domain layer. For example, see Craig Larman, "Applying UML and patterns".

Question:
Do I need a similar facade/controller object in the UI layer? I feel like I do, but I have not seen people suggesting it, so I may be wrong.

Justification:
If UI is moved to a remote computer then all requests from UI objects will go through network, hence, all UI will need to be changed to accomodate for TCP/IP requests.
When UI grows large, when we use Operating System SendMessage(.) etc. the UI becomes a mess if we don't have a control over the sequential order of messages.

Do I make sense with my solutions or there is something that I have missed? Would appreciate any suggestions.

Thanks!

Nick Kisialiou


0x2B | -0x2B
AnswerRe: Design patterns - simple questions. Pin
Curtis Schlak.11-Jan-06 13:53
Curtis Schlak.11-Jan-06 13:53 
QuestionProblem with instantiating ActiveX Variant* Mething Pin
godspeed12311-Jan-06 11:43
godspeed12311-Jan-06 11:43 
AnswerRe: Problem with instantiating ActiveX Variant* Mething Pin
Stephen Hewitt11-Jan-06 12:04
Stephen Hewitt11-Jan-06 12:04 
GeneralRe: Problem with instantiating ActiveX Variant* Mething Pin
godspeed12311-Jan-06 13:12
godspeed12311-Jan-06 13:12 
GeneralRe: Problem with instantiating ActiveX Variant* Mething Pin
Stephen Hewitt11-Jan-06 13:16
Stephen Hewitt11-Jan-06 13:16 
GeneralRe: Problem with instantiating ActiveX Variant* Mething Pin
Stephen Hewitt11-Jan-06 13:37
Stephen Hewitt11-Jan-06 13:37 
GeneralRe: Problem with instantiating ActiveX Variant* Mething Pin
godspeed12311-Jan-06 16:59
godspeed12311-Jan-06 16:59 
GeneralRe: Problem with instantiating ActiveX Variant* Mething Pin
Stephen Hewitt11-Jan-06 17:10
Stephen Hewitt11-Jan-06 17:10 
GeneralRe: Problem with instantiating ActiveX Variant* Mething Pin
godspeed12311-Jan-06 17:56
godspeed12311-Jan-06 17:56 
QuestionAm I coding right? Pin
Lord Kixdemp11-Jan-06 11:29
Lord Kixdemp11-Jan-06 11:29 
AnswerRe: Am I coding right? Pin
Nick_Kisialiou11-Jan-06 13:21
Nick_Kisialiou11-Jan-06 13:21 
GeneralRe: Am I coding right? Pin
Owner drawn11-Jan-06 17:15
Owner drawn11-Jan-06 17:15 
AnswerRe: Am I coding right? Pin
Prakash Nadar11-Jan-06 17:51
Prakash Nadar11-Jan-06 17:51 
AnswerRe: Am I coding right? Pin
Vipin Aravind11-Jan-06 23:22
Vipin Aravind11-Jan-06 23:22 
GeneralRe: Am I coding right? Pin
Eytukan12-Jan-06 0:43
Eytukan12-Jan-06 0:43 
GeneralRe: Am I coding right? Pin
Vipin Aravind12-Jan-06 1:32
Vipin Aravind12-Jan-06 1:32 
GeneralRe: Am I coding right? Pin
Eytukan12-Jan-06 1:37
Eytukan12-Jan-06 1:37 

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.