Abstract Factory - II Abstract Factory vs Factory

by ipsit 3. August 2009 17:32
The other day we had a discussion related to the abstract factory and let me tell you, flames flew and it was high on melodrama.
Anyways coming back to the main point, the root of whole discussion was,
A: Why should I use the abstract factory, just for a parallel set of classes, what am I getting out of it ?
B: You are abstracting your product, that's why you are creating it. Apart from that, its a you have a mechanism for creating related set of products, which is important here, you see you should not forget that, its for creating a set of related family of products.
C: But say if you are just creating is two set of components, a UI Components for rich mode and the simple mode, could you not do with a static Factory implementation instead of so much of fun fare? And also if you look closely, what you are doing is essentially now binding your classes to the implementation of the Abstract Factories some where, because to get the code running you have to write the Implementation class some where, so would not it be better if we had just a static factory class which gives us what we need.
B: hmmmm...
A: Apart from that so much of code to manage .... That's a good one C:)
C: Thanks! Man
B: Factory Method defines an interface for creating an object, but lets subclasses decide which of those to instantiate. A factory method lets classes defer instantiation to subclasses.By contrast, an Abstract Factory provides an interface for creating families of related or dependent objects without specifying their concrete classes.
C: We have a family of related objects but, ... I don't want to take a purists view or go by book view.. I look at convinience and unless you tell me why, I don't see any reason why I should not go for a Factory than a Abstract Factory here.
A: And if you ask me, I guess you are over complicating, is not this kind of an YAGNI.  
B: Well, let me examine the definitions a bit more:
Factory Method defines an interface for creating an object, but lets subclasses decide which of those to instantiate. A factory method lets classes defer instantiation to subclasses.
Which essentially means, in this case the decision is taken by sub class -> Inheritance is in action.
Abstract Factory provides an interface for creating families of related or dependent objects without specifying their concrete classes. Now in this case the job of creating the instance of the products are delegated -> Composition in Action.
And as you guys already know Composition allows you to delay the creation of back-end objects until (and unless) they are needed, as well as changing the back-end objects dynamically throughout the lifetime of the front-end object. With inheritance, you get the image of the superclass in your subclass object image as soon as the subclass is created, and it remains part of the subclass object throughout the lifetime of the subclass.
So I would say, if you need it dynamically vary, take the composition root and enjoy the benefits of Abstarct Factory else, Factory should be just fine for you.
C: hmmm..
A: ok
Hope you like the dialogue....:)

Currently rated 4.0 by 1 people

  • Currently 4/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Design Pattern | General | MAPI | Refactoring

The Tryst with MAPI

by ipsit 16. June 2009 08:12

For the past two weeks I was up against MAPI. I must admit, its a amazing piece of work and liked it, the more I delved into it.

Let me delve a bit more into the specifics of the problem a bit more.

We have a piece of software, and it is used to synch up contacts across Exchange and a custom application using Mapi Server Client. Now this works fine if the Systems are Exchange Server 2003 on Win2k3, and Our Application is on Windows 2008. But the problem started appearing when we tried the same thing out when the combination is Exchange 2007 on Win2k8 and our application on Win 2k8. 

I dug deep and I resorted to aprroach, the only guy who I knew blogs about MAPI - SGriffin. And he did respond and put us on the right track.

If you face same kind of problems that we faced, the things that you need to check is:

  • There is a issue with with IPv6 - Click Here and Click Here
  • Ensure that you create the Service Account properly - Click Here
  • Make sure your user with whom you created your profile is a member of "Exchange Organization Administrator"
  • Ensure you download and install the latest Exchange MAPI server client
Hope this heps.

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

MAPI


Inida

About Coderslog

One fine day we thought, we need to be contributing to our community.

So good sense prevailed, and that's how coderslog got started. That's about us.

Calendar

<<  March 2010  >>
MoTuWeThFrSaSu
22232425262728
1234567
891011121314
15161718192021
22232425262728
2930311234

View posts in large calendar

RecentPosts

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2010 CodersLog