473,385 Members | 1,620 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Abstract factory and Application layers


Hi,

I have an application composed from layers like the following

A
--B
---C

A is the top layer
C uses an Abstract Factory to Create Concrete classes
I wonder if A should create the concrete factory,pass it to B,and than B
will pass it to A
or maybe it is better to create a Concrete factory in B

what are the advantages in disadvantages in each approaches?
create the Concrete factory in the upper most layer
or in the a layer which is one level higher that the layer which uses the
factory?

Thanks
Nov 16 '05 #1
2 1740
hello Julia,

I honestly have to think about what you mean by "layers" because this
doesn't seem to be the same as Buschmann's Layers pattern.

I think you are saying this:
The 'A' layer is a set of interfaces and base classes.
The 'B' layer is a set of concrete classes inherited from 'A' and
The 'C' layer is composed of the collaborating objects (the controllers) who
need to use the classes in 'B'. You want to know where to create your
concrete factory derived from your Abstract Factory base class.

In B.

The concrete factory is, by definition, coupled to the classes it creates.
All factory methods have to know the name of the object that they create
(that's their point). (Factories aren't the only way to abstract object
creation, of course, but that is too much for a Newsgroup posting :-).

Therefore to have "layers" that are cohesive in nature, you want your
concrete factory to be packaged in with the classes that it creates. If I
guessed about your layered structure correctly, then you would place the
abstract factory in A (since it defines types in A), the ConcreteFactory
that inherits from the AbstractFactory in B, and the FactoryFactory in B
(since it creates types of type AbstractFactory, and those types are
declared in B).

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"Julia" <co********@012.net.il> wrote in message
news:uh**************@TK2MSFTNGP15.phx.gbl...

Hi,

I have an application composed from layers like the following

A
--B
---C

A is the top layer
C uses an Abstract Factory to Create Concrete classes
I wonder if A should create the concrete factory,pass it to B,and than B
will pass it to A
or maybe it is better to create a Concrete factory in B

what are the advantages in disadvantages in each approaches?
create the Concrete factory in the upper most layer
or in the a layer which is one level higher that the layer which uses the
factory?

Thanks

Nov 16 '05 #2
hello Julia,

I honestly have to think about what you mean by "layers" because this
doesn't seem to be the same as Buschmann's Layers pattern.

I think you are saying this:
The 'A' layer is a set of interfaces and base classes.
The 'B' layer is a set of concrete classes inherited from 'A' and
The 'C' layer is composed of the collaborating objects (the controllers) who
need to use the classes in 'B'. You want to know where to create your
concrete factory derived from your Abstract Factory base class.

In B.

The concrete factory is, by definition, coupled to the classes it creates.
All factory methods have to know the name of the object that they create
(that's their point). (Factories aren't the only way to abstract object
creation, of course, but that is too much for a Newsgroup posting :-).

Therefore to have "layers" that are cohesive in nature, you want your
concrete factory to be packaged in with the classes that it creates. If I
guessed about your layered structure correctly, then you would place the
abstract factory in A (since it defines types in A), the ConcreteFactory
that inherits from the AbstractFactory in B, and the FactoryFactory in B
(since it creates types of type AbstractFactory, and those types are
declared in B).
--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"Julia" <co********@012.net.il> wrote in message
news:uh**************@TK2MSFTNGP15.phx.gbl...

Hi,

I have an application composed from layers like the following

A
--B
---C

A is the top layer
C uses an Abstract Factory to Create Concrete classes
I wonder if A should create the concrete factory,pass it to B,and than B
will pass it to A
or maybe it is better to create a Concrete factory in B

what are the advantages in disadvantages in each approaches?
create the Concrete factory in the upper most layer
or in the a layer which is one level higher that the layer which uses the
factory?

Thanks

Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
by: Medi Montaseri | last post by:
Hi, Given a collection of similar but not exact entities (or products) Toyota, Ford, Buick, etc; I am contemplating using the Abstraction pattern to provide a common interface to these products....
3
by: Sebastian Faust | last post by:
Hi, I am currently reading the chapter about abstract factorys from "Modern C++ Design" and wondering how it would be possible to create an object which has a constructor with parameters. At the...
4
by: max | last post by:
Hello, I analyze this design pattern for a long time but I do not understand how this pattern work and what the purpose is? (I looked a this site...
33
by: Chris Capel | last post by:
What is the rationale behind the decision not to allow abstract static class members? It doesn't seem like it's a logically contradictory concept, or that the implementation would be difficult or...
3
by: Christer | last post by:
Hi all! We're creating an administration for a web application. This includes severeal aspx pages. Our key entity in the web application is "Profile", which can have a certain type. Based on...
0
by: Craig Buchanan | last post by:
i am trying to build an application that uses plugins to extend the business functionality of an application. i've decided to use inheritance of abstract classes as the mechanism to do this. ...
0
by: mailforpr | last post by:
Hi. Let me introduce an iterator to you, the so-called "Abstract Iterator" I developed the other day. I actually have no idea if there's another "Abstract Iterator" out there, as I have never...
16
by: RSH | last post by:
Hi, I am a fairly seasoned developer and have recently started looking at software design patterns. I am starting with the Abstract Factory Pattern and was wondering if someone could help me...
4
by: C# | last post by:
http://www.questpond.com/FreeDesign1.htm I was going through the above videos. Can i conclude Abstract factory patterns are extensions of factory patterns. I have made the conclusion after...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.