🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.objective-c
Article #121

Re: Requirements for Class Variables for Objective-C

#121
From: Dean Rubine
Date: Tue, 16 Oct 1990 21:02
34 lines
2403 bytes
The choices:

 #1 -- each subclass has its own copy of its parent's class variables
 
 #2 -- all subclasses share a single copy of their parent's class variables

In article <1990Oct15.185718.8342@svc.portal.com> moose@svc.portal.com writes:
>I think this arguement is beginning to get silly.  If you do #2, you can 
>always do #1 by adding a new variable and overridding all methods that affect
>the variable in question.  If you do #1, there is no way to do #2.  
>Therefore, #2 should be done.
>Michael Rutman

     Hmmm.  I too thought the argument was silly, but I reached the opposite
conclusion.  I thought: #2 can be perfectly simulated with global (or static)
variables, while #1 gives some new functionality.  I already gave an example in
a previous post: #2 allows an event handler to be associated with each subclass
of View, just by declaring a class variable "eventHandler" in the View class
(and presumably defining some factory methods in View which reference
"eventHandler").  

     As I read Mr. Rutman's reasoning, given choice #2, all I'd have to do to
associate an event handler with every subclass of View is declare a variable
(class or static) in EVERY subclass, and provide appropriate methods in EVERY
subclass.  Yeech.  Note that I'd likely be repeating the same code in every
subclass - this seems contrary to the object-oriented paradigm, in which
inheritance is supposed to be used to avoid such of repetition of code.  This
problem doesn't come up with class variables of kind #1.    

-- 
ARPA:       Dean.Rubine@CS.CMU.EDU	
PHONE:	    412-268-2613		[ Free if you call from work ]
US MAIL:    Computer Science Dept / Carnegie Mellon U / Pittsburgh PA 15213
DISCLAIMER: My employer wishes I would stop posting and do some work.
Technical Details
Message-ID: <10777@pt.cs.cmu.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!ub!uhura.cc.rochester.edu!rochester!pt.cs.cmu.edu!k.gp.cs.cmu.edu!dandb
References: <5638@stpstn.UUCP> <270A66D0.14263@ics.uci.edu> <kenneth.655324438@exklusiv> <GREGOR.90Oct14231438@spade.parc.xerox.com> <1990Oct15.185718.8342@svc.portal.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!ub!uhura.cc.rochester.edu!rochester!pt.cs.cmu.edu!k.gp.cs.cmu.edu!dandb
From: dandb@k.gp.cs.cmu.edu (Dean Rubine)
Newsgroups: comp.lang.objective-c
Subject: Re: Requirements for Class Variables for Objective-C
Message-ID: <10777@pt.cs.cmu.edu>
Date: 16 Oct 90 21:02:44 GMT
References: <5638@stpstn.UUCP> <270A66D0.14263@ics.uci.edu> <kenneth.655324438@exklusiv> <GREGOR.90Oct14231438@spade.parc.xerox.com> <1990Oct15.185718.8342@svc.portal.com>
Organization: Carnegie-Mellon University, CS/RI
Lines: 34