• 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: Category or Protocol? (sidetrack)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Category or Protocol? (sidetrack)


  • Subject: Re: Category or Protocol? (sidetrack)
  • From: Ondra Cada <email@hidden>
  • Date: Fri, 22 Apr 2005 02:19:28 +0200

Scott,

On 22.4.2005, at 2:01, Scott Ellsworth wrote:

More than that: in fact, it is not possible *at all* :))

Actually, it is possible. I do this all the time with IDEA.

If you add a parameter to a base class, it asks if you want it propagated to the implementations in all of the implementing classes. Similarly, if you change a method in an interface, it updates all the implementing classes, and vice versa. It also finds all usages of the method via instances of the class, subclasses, and via interfaces.

(Not even with Java, see reflection/NSSelector/action-target/first responder stuff... And of course, even *considerably* less with ObjC or another decent language.)

You can certainly break reflection, but catching direct method calls covers a lot of ground. The majority of cases, in my experience.

Majority in Swing or similar low-level APIs; minority (or perhaps still majority, but with a too big number of exceptions to be practical) in Cocoa though. See below.


Believe me, this makes life run a lot faster, and does reward typical usage of the Java type system.

The problem is that "typical Java type system" does not support things like target-action paradigm, First Responder, KVC/KVO, bindings, and so forth, and so forth (I don't really know, but I bet CoreData models would fit this category too). Not speaking of HOM, which is not part of Cocoa (alas), but which is *definitely* worth adding to your private framework set :)


These tools make life *so much* faster you even don't have time to think of this kind of re-factoring :))

More seriously: you can't have it both ways. Either you got strong typing (which then allows semi-automatic re-factoring), or you got hi-level metaprogramming. Whilst the former has its strong points, the latter is *inifinitely* better.
---
Ondra Čada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc


_______________________________________________
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: Category or Protocol? (sidetrack)
      • From: John Stiles <email@hidden>
References: 
 >RE: Category or Protocol? (sidetrack) (From: Jeff Laing <email@hidden>)
 >Re: Category or Protocol? (sidetrack) (From: Rick Kitts <email@hidden>)
 >Re: Category or Protocol? (sidetrack) (From: Ondra Cada <email@hidden>)
 >Re: Category or Protocol? (sidetrack) (From: John Stiles <email@hidden>)
 >Re: Category or Protocol? (sidetrack) (From: Ondra Cada <email@hidden>)
 >Re: Category or Protocol? (sidetrack) (From: Scott Ellsworth <email@hidden>)

  • Prev by Date: Re: Category or Protocol? (sidetrack)
  • Next by Date: Re: Memory management with nibs
  • Previous by thread: Re: Category or Protocol? (sidetrack)
  • Next by thread: Re: Category or Protocol? (sidetrack)
  • Index(es):
    • Date
    • Thread