abstract-factory


Differences between Abstract Factory Pattern and Factory Method,confused by one case


The main difference between a "factory method" and an "abstract factory" is that the factory method is a single method, and an abstract factory is an object. But, sometimes I can't say what it is,for example
class Product{
}
interface Facotory{
public Product create();
}
class FactoryA implements Facotory{
public Product create() {
return null;
}
}
class FactoryB implements Facotory{
public Product create() {
return null;
}
}
Can you tell me it is factory method or abstract factory?Thank you!
IMO, Your current example above is Factory Method.
As you have defined an interface (Factory) with a factory method (create) that allows sub classes (FactoryA and FactoryB) to decide which class to instantiate (Product derived classes).

Related Links

Why use an abstract factory
Differences between Abstract Factory Pattern and Factory Method,confused by one case
Abstract factory bad design?

Categories

HOME
xpath
events
applescript
add-on
plpgsql
linker
facebook-android-sdk
gprs
graphql-js
polymer-2.x
fasm
getopenfilename
business-intelligence
orc
mailmerge
jquery-select2-4
smartgwt
sonata
orange-api
infrared
android-custom-view
gitkraken
stackexchange.redis
device
software-packaging
dragula
environment
nurbs
prompt
webviewclient
xdebug
android-cardview
network-analysis
envoy
objectmapper
microsoft-certifications
shapeless
listjs
advanced-filter
devtools
restful-architecture
buildforge
wdk
spinner
fastlane
hidden-markov-models
sspi
spring-restcontroller
directwrite
lightning-workbench
gestures
visual-format-language
watir-webdriver
deedle
wikimapia
predicates
mifos
ternary-operator
deviare
jpda
ftp-client
callouts
mathml
between
perforce-integrate
wicked-pdf
gridbaglayout
android-mapview
juniper-network-connect
dsa
dnx50
apple
hmisc
vdm-sl
ampersand
abstract-factory
incron
jcheckbox
string.format
zend-mail
dmake
back
mobile-country-code
wso2bam
cpu-time
jomsocial
smips
sql-view
virtual-channel
xs
mongo-jackson-mapper
icenium
multiple-dispatch
mkannotation
expression-web
datacontracts
multiple-users
3-tier
source-code-protection
subtext
accumulator
acceleration

Resources

Encrypt Message