• 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
Re: Refactoring tools available for Cocoa / ObjC?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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 10:18:15 -0700


On May 3, 2006, at 9:30 AM, glenn andreas wrote:


On May 3, 2006, at 11:22 AM, Greg Titus wrote:
The reason is that, just again, whilst in Smalltalk there can be some (whatever sweet way unknown to me they are achieved and detected), in ObjC *there are no abstract classes*. Period. You encounter NSObject instances pretty often, a few times I've even instantiated NSArrays. I haven't ever instantiate an NSString, but I bet some other one did :) And so forth.

NSObject and NSArray are not abstract. NSString, on the other hand, is. If you don't see the distinction, then no wonder you aren't thinking about this very well.


How do figure that "NSString" is abstract but "NSArray" isn't? As far as I'm concerned, none are abstract, since, other than the fact that there is no "abstract class" in Objective-C, with all of them you can instantiate them, send them messages, etc...:


x = [[NSObject alloc] init]; NSLog(@"%@", [x description]); [x release];

x = [[NSString alloc] init];
NSLog(@"%@", [x description]);
[x release];

x = [[NSArray alloc] init];
NSLog(@"%@", [x description]);
[x release];

I will agree than NSArray and NSString are class clusters, but neither fact makes them abstract classes (their clusteriness being entirely an implementation detail), and certainly doesn't make NSString abstract and NSArray not.

Turns out both NSArray and NSString are abstract classes, I was mistaken. Forgive me - in earlier releases NSArray was concrete. It is now abstract. Try actually logging [[x class] description] in each case, and you will find that you have actually instantiated NSObject, NSCFString, and NSCFArray. If you looked at the _actual_ NSArray class, you would find declarations of -objectAtIndex: and -length which raise exceptions. These are the abstract methods which must be implemented by subclasses.


You guys are both getting confused by Java/C++ making 'abstract' into a language keyword. When we are talking about refactoring tools we are talking about class patterns. Abstract Superclass is a pattern, not necessarily a language feature. It is _not_ a language feature in either Smalltalk or in Objective-C. That does _not_ mean that you can't detect the _pattern_.

	- 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


  • Follow-Ups:
    • Re: Refactoring tools available for Cocoa / ObjC?
      • From: glenn andreas <email@hidden>
    • Re: Refactoring tools available for Cocoa / ObjC?
      • From: Ondra Cada <email@hidden>
    • Re: Refactoring tools available for Cocoa / ObjC?
      • From: Ondra Cada <email@hidden>
References: 
 >Refactoring tools available for Cocoa / ObjC? (From: "Eric Lin" <email@hidden>)
 >Re: Refactoring tools available for Cocoa / ObjC? (From: Marcel Weiher <email@hidden>)
 >Re: Refactoring tools available for Cocoa / ObjC? (From: "Eric Lin" <email@hidden>)
 >Re: Refactoring tools available for Cocoa / ObjC? (From: Ondra Cada <email@hidden>)
 >Re: Refactoring tools available for Cocoa / ObjC? (From: Marcel Weiher <email@hidden>)
 >Re: Refactoring tools available for Cocoa / ObjC? (From: Ondra Cada <email@hidden>)
 >Re: Refactoring tools available for Cocoa / ObjC? (From: Marcel Weiher <email@hidden>)
 >Re: Refactoring tools available for Cocoa / ObjC? (From: Ondra Cada <email@hidden>)
 >Re: Refactoring tools available for Cocoa / ObjC? (From: Horst Hoesel <email@hidden>)
 >Re: Refactoring tools available for Cocoa / ObjC? (From: Ondra Cada <email@hidden>)
 >Re: Refactoring tools available for Cocoa / ObjC? (From: Greg Titus <email@hidden>)
 >Re: Refactoring tools available for Cocoa / ObjC? (From: Ondra Cada <email@hidden>)
 >Re: Refactoring tools available for Cocoa / ObjC? (From: Greg Titus <email@hidden>)
 >Re: Refactoring tools available for Cocoa / ObjC? (From: glenn andreas <email@hidden>)

  • Prev by Date: Re: Refactoring tools available for Cocoa / ObjC?
  • Next by Date: Re: Refactoring tools available for Cocoa / ObjC?
  • Previous by thread: Re: Refactoring tools available for Cocoa / ObjC?
  • Next by thread: Re: Refactoring tools available for Cocoa / ObjC?
  • Index(es):
    • Date
    • Thread