Re: Refactoring tools available for Cocoa / ObjC?
Re: Refactoring tools available for Cocoa / ObjC?
- Subject: Re: Refactoring tools available for Cocoa / ObjC?
- From: Greg Titus <email@hidden>
- Date: Wed, 3 May 2006 11:46:04 -0700
On May 3, 2006, at 11:24 AM, glenn andreas wrote:
So if you want to define an "abstract class" in Obj-C as a class
which has at least one method which must be implemented in a
subclass (and raises an exception if you try to call that method on
an instance of that class or subclass without having overridden
said method), then yes, by that definition, NSArray and NSString
are abstract classes. They are also class-clusters, which is
another thing (and is part of an implementation detail - view it
more as an "optimization pattern" rather than a "design pattern").
Yes. The 'top' of a class cluster is a specific kind of abstract class.
Though by that definition, NSObject is also an abstract class,
because -copy will raise an exception (since it calls copyWithZone:
which must be implemented in the subclass), as will -mutableCopy
and (indirectly) -forwardInvocation.
Okay, I'd go with that.
So if you want instead to define an abstract class as the above
refined to only include methods that provide "primitive
functionality" (i.e., the actually get/set an item in an array),
then you've got something that has to be based on the programmer's
intention to determine if it is abstract or not (would "copy" of
NSObject be something that provides primitive functionality or not?)
No, you've convinced me that _for_refactoring_purposes_ NSObject
should be treated as an abstract class.
So what, then, is the definition of an "abstract class" in
Objective-C (since half the people say "no, you can't detect one"
and the other have say "yes, you can" but neither are talking about
the same critter...)
In the context of automatically refactoring to move methods up or
down the class hierarchy (the starting point of this conversation),
the only attribute which matters is for the tool to know that it is
okay for there not to be a real implementation of some particular
method in some particular class. That it is abstract at that point in
the hierarchy.
- Greg
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden