ECom plug-in – in the lights of Strategy Pattern PDF Print E-mail

When I started understanding ECom architecture of Symbian, I tried to map it with some design pattern from the GoF book. This way I found out that the Strategy Pattern described as one of the Behavioral Patterns is the closest match. Let me share my understanding with you.

First of all, let me tell you about the Strategy Pattern as it has been described in the GoF book. It says that we should use Strategy Pattern when we have a family of related classes differing only in their behaviors. The class diagram of a simple strategy pattern would be like the following:

ecom.jpg

What this diagram essentially depicts is that Context and Strategy work hand in hand to determine which ConcreteStrategy to pick up in the runtime. We may pass a ConcreteStratgy object to the Context constructor to achieve this.

This can also be achieved by creating a template class of Context and passing Strategy as a template parameter. This will, however, be at compile time. Hence it would increase the efficiency with the cost of larger code footprint.

Now let me dissect the ECom framework to describe how it can be mapped with the strategy pattern. We know ECom framework is built as a client-server architecture. We don't have to bother about the background processing that the server does. What all we need to understand is the client interface of the ECom. There is a singleton class called REcomSession which is the client side interface of the ECom framework. It has got several exported functions out of which ListImplementationsL (there are three overloaded version of it) and CreateImplementationL (there are twelve overloaded versions of it) are the most important one.

So, to map the ECom architecture with the Strategy pattern, we need to understand when a client application (read context in the Strategy pattern) tries to load a specific implementation (read ConcreteStrategy in the Strategy pattern), how the ECom framework resolves it.

To do that, let me delve into one of the CreteImplementationL function of the client interface of the ECom architecture. I have taken the following function:

 

EXPORT_C TAny* REComSession :: CreateImplementationL(TUid aInterfaceUid, Tuid& aDtorIDKey, const TecomResolverParams& aResolutionParameters)

To implement an application which takes the help of the ECom architecture, we need to call the above function (say for example, from a menu command). Now, the most important things we need to know to load the correct implementation, are the Interface ID and the Resolution Parametrs. These are there in the registration file of the ECom plug-in.
So, here lies the analogy between the ECom architecture and the Strategy Pattern.

  1. .In strategy pattern, we have a strategy interface from where different strategies are realized. In ECom, we create an interface which are realized in different implementations.

  2. .In Strategy, we pass the Strategy interface as a parameter to the context to load the correct implementation at runtime. The context object is created with the correct implementation of the Strategy interface. In ECom, we create the correct implementation by passing the Interface ID and the Resolution parameter from Client (read context) to the ECom framework.

  3. .In strategy pattern, the client of the context must know what are the concrete strategies available for the current strategy interface. In ECom, the application must know what are the implementation we have for a specific interface. Of course we can query about it using ListImplementationsL, however, the knowledge must be available to the application.

So, in essence ECom plug-in architecture is some kind of application of the strategy pattern.

If you want to comment anything about this school of understanding about ECom architecture, please mail me at

This e-mail address is being protected from spambots. You need JavaScript enabled to view it

 

Source: http://www.newlc.com/ecom-plug-%E2%80%93-lights-strategy-pattern

Comments (9)Add Comment
a very nice website
written by acs à main , June 25, 2010
his site is amazing. Very well developed with great information.
Thanks for a wonderful experience.
report abuse
vote down
vote up
Votes: +0
...
written by coach bags , June 28, 2010
Thanks for the nice blog. It was very useful for me. Keep sharing such ideas in the future as well. This was actually what I was looking for, and I am glad to came here! Thanks for sharing the such information with us.
report abuse
vote down
vote up
Votes: +0
handbag
written by Frank , July 19, 2010
Gucci handbag does not only is a symbol of taste and fashion, but also is a symbol of social status and recognition. And it is the reason that Gucci has swept the world. How amazing for you to have one or more Gucci.What is important,brand handbag are available at a lower price now. I hope our new brand handbag will meet with your favorite items below. As you see above Gucci bags,which are good enough for you to have one.We also offer all kinds of wholesale designer handbag!
report abuse
vote down
vote up
Votes: +0
...
written by air jordan 10 , July 22, 2010
They are strongly recommended by friends.Personallyhttp://www.prada-outlet-store.com
report abuse
vote down
vote up
Votes: +0
...
written by ugg , July 29, 2010
Ashley air jordan 13 Tisdale nike air jordan shoes wasair jordan 9 seenair jordan flight air jordan 2 leaving
report abuse
vote down
vote up
Votes: +0
...
written by ugg , July 29, 2010
Ashley air jordan 13 Tisdale nike air jordan shoes was
report abuse
vote down
vote up
Votes: +0
...
written by ultra tall ugg boots , August 19, 2010
Keep sharing such ideas in the future as well
Classic Tall Ugg Boots
Classic Short Ugg Boots
report abuse
vote down
vote up
Votes: +0
http://www.watcheslux.com
written by watcheslux.watches , September 02, 2010
It was just recently when weve talked about her Alexander McQueen satchel, and this time, though the particular style from the louis vuitton carl f. bucherer watches replicas
bags didnt match her rather plain outfit (unlike what weve viewed her a few days back that has a floral frock), no less than the particular shade tells that it really is versatile to get paired along with any other colors of outfits.
report abuse
vote down
vote up
Votes: +0
nike air max 2010
written by nike air max 2010 , September 06, 2010
Nike Shox deliver men's [b]Nike Air Max 2009[/b]is a [b]nike air max 2010[/b] with a small amount of construction of cushion that gives it the idea support and light weight feel to also features Nike Shox technology for optimum cushioning and comfort. It has a rubber outsole for exact grip and quick court moves
report abuse
vote down
vote up
Votes: +0

Write comment
quote
bold
italicize
underline
strike
url
image
quote
quote
smile
wink
laugh
grin
angry
sad
shocked
cool
tongue
kiss
cry
smaller | bigger

security code
Write the displayed characters


busy
 

 

This domain is for sale! Please contact me via contact page!