In Elements of Reusable Object Oriented software by Erich Gamma and friends, the intent for Abstract Factory Pattern says:

Provide an interface for creating families of related or dependent objects without specifying their concrete classes.

Can anyone explain in clearer terms what does author mean by related or dependent here. I am new to all this and i don't have a prior perception of this and i am confused reading it on the first go.

  • 1
    Don't mind, my question was -5ed and deleted. Strong moderation, nothing new... – Fusseldieb Nov 5 '18 at 13:11
  • 2
    To be honest, I'd be more worried about 'families' - when was the last time you saw an abstract factory in the wild that created 'families' rather than single instances? – Pete Kirkham Nov 5 '18 at 13:30
  • 1
    It means one of the objects knows about the other. Or that some object knows about them both. – candied_orange Nov 5 '18 at 13:34
  • 2
    @JotWaraich I appreciate you being willing to clarify. But we greatly prefer you do it by editing the question. Answering a question should not require reading through it's comments. – candied_orange Nov 5 '18 at 15:16
  • 2
    It has no special meaning, this is just the normal standard English meaning of those words. – Jörg W Mittag Nov 6 '18 at 10:06

Wikipedia says that "The abstract factory pattern provides a way to encapsulate a group of individual factories that have a common theme without specifying their concrete classes."

Take a look at the picture below.

enter image description here

"Related" here means that all of the concrete factories create buttons.

  • "Families" also implies that there are other related things, continuing the GUI example, there could also be TextEdit and Frame interfaces with WinTextEdit and OSXFrame etc concrete classes – Caleth Nov 6 '18 at 10:04
  • @Caleth: Indeed. Part of the problem with vocabulary questions like this one is that it's tricky to know the right scope of information to provide in an answer. While the community prefers comprehensive answers, really it is just a question about a word. Full understanding of a pattern like this requires more than just knowing a word. – Robert Harvey Nov 6 '18 at 15:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.