Skip to content

Design pattern ask for advice

George George

Asked Oct 24, 2008, 3:20 AM EDT1 answer
Share
LinkedInX

Hello everyone,


I am designing an application which could be treated as a framework application to host other components, e.g. functions like component life cycle management and delegate from client to call the components.

Now I have two design patterns, and I want to ask for advice about which one is better and why.

Design pattern 1, using interface, for example, let client application impement interface, which contains method called Initialization, and my application framework call Initialization method when I want to initialize a component;

Design pattern 2: using event for example, OnIntialize event, client application register event handler (callback), and when my application framework wants to initialize a component, I will send OnInitialize event.

Any advice?


thanks in advance,
George

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • +1
    I think the first approach will be better where u will give an interface to client for implementation that will give the client application developer a better visibility and guidance in coding according to his requirement.
    +1