• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
make class cluster
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

make class cluster


  • Subject: make class cluster
  • From: Hans van der Meer <email@hidden>
  • Date: Sat, 6 Oct 2007 14:10:34 +0200

I am uncertain how to construct a class-cluster and cannot find all I should know in the ObjC and Cocoa guides (the montharray example in the latter is kind of special). Let me describe the setup I have in mind.

Two classes are to be made, having many methods in common but differing in the init method and how they produce their result. Hence the idea of making a class-cluster.

The idea is now:

1. The class-cluster class is merely a dispatcher of the worker classes.
2. Each of the three classes (cluster class and two work classes) descends directly from NSObject and thus they are independent classes.
3. The cluster class is called with [[cluster-class alloc] init...] and dispatches a work class by returning [[work-class alloc] init...]


Questions I could not satisfactorily answer myself:

1. Is the setup of three independent classes correct or should I make the two work classes a subclass of the cluster class? The common code can then be shared through the cluster class.

2. In the sequence [[cluster-class alloc] init...] should I release self? Thus in the cluster-class as init for the production of a work class:
- (id) init... {
[self release]; // needed??? too early at this point???
id worker = [[worker alloc] init...];
return worker;
}


I would appreciate your expert insight. Thanks in advance.

Hans van der Meer



_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: make class cluster
      • From: Mike Abdullah <email@hidden>
    • Re: make class cluster
      • From: Sean Murphy <email@hidden>
  • Prev by Date: Re: Working with XML files
  • Next by Date: Re: NSTableView questions
  • Previous by thread: Re: QT & NSData
  • Next by thread: Re: make class cluster
  • Index(es):
    • Date
    • Thread