2

I have read that Obj-C class clusters are an implementation of the abstract factory.

Can anyone explain if there are any differences between the 2 as design patterns. I read somewhere that there are certain restrictions on class clusters that don't apply to traditional abstract factory but it did not give more details.

cacau
  • 3,606
  • 3
  • 21
  • 42
  • *'certain restrictions on class clusters that don't apply'* - If you phrase your question more specifically we might be able to answer your question. – cacau Mar 03 '14 at 07:51
  • @cacau thanks, i checked that link you sent, not sure I understand it the answer fully. could you offer a lower level explanation on the differences? and an example of when you would use each one? please. – user1283153 Mar 08 '14 at 17:07
  • http://stackoverflow.com/a/2459385/839506 This may help. It has an implementation. – Doon Apr 01 '15 at 20:59

1 Answers1

0

Most of the limitations concern attempting to modify the Foundation class clusters rather than those you may write on your own. For example, subclassing NSDictionary (which is a Foundation class cluster) can lead to some interesting problems.

You are free to implement your own class clusters, which is fairly easy and can have a high payoff. A class cluster is a type of abstract factory.

Community
  • 1
  • 1
quellish
  • 21,123
  • 4
  • 76
  • 83