[Newbies] comparing to an exact class & storing class association relationships

Randal L. Schwartz merlyn at stonehenge.com
Fri Apr 20 09:46:56 UTC 2012


>>>>> "Ben" == Ben Coman <btc at openInWorld.com> writes:

Ben> doh! <smacks-head>   funny how it works itself out when you step away for a
Ben> while - this works fine...

Ben> B class >> relations
Ben>   (self == B)
Ben>       ifTrue:  [ ^ {     E-> #addE.  }     ]
Ben>       ifFalse: [ ^ {}  ]

Ben> but I still wonder if it is the right approach

Without further analysis, or description of the problem you're trying to
solve, this already looks far too fragile for me.

For one, it fails the "null subclass" test.  You should always be able
to subclass a class, putting no methods in the subclass, and the
subclass and superclass objects would be completely interchangeable.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn at stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.posterous.com/ for Smalltalk discussion


More information about the Beginners mailing list