<div dir="ltr">I know I didn&#39;t ask for this, but thanks for the explanation! &nbsp;I am just starting to think more in objects, although I still find myself trying to push them around. &nbsp;My new mantra is &quot;ask the object to do it for me...ask the object to do it form me...&quot;<div>
<br></div><div>Fortunately, I am dealing with slightly more concrete objects in Healthcare (patients, bills, supplies, etc...).</div><div><br></div><div>Take care,</div><div><br></div><div>Rob</div><div><br><div class="gmail_quote">
On Fri, Sep 26, 2008 at 8:32 PM, Norbert Hartl <span dir="ltr">&lt;<a href="mailto:norbert@hartl.name">norbert@hartl.name</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="Ih2E3d">On Fri, 2008-09-26 at 17:06 -0500, Mark Volkmann wrote:<br>
&gt; Is there an equivalent of Java&#39;s enumerated values (enum) in Smalltalk?<br>
&gt;<br>
</div>Yes and a very good one. We call it class! :))<br>
<br>
A usage pattern I see often is this one (in java):<br>
<br>
- define an Enum MyEnum with constants: one two three<br>
- anywhere in the code assign MyEnum.two to variable myCase<br>
- later build a case construct that selects a body of<br>
 &nbsp;code to execute depending on the value of myCase<br>
- execute the selected code (that prints something)<br>
<br>
So we would do:<br>
<br>
- define a class MyEnum and class methods for one, two, three<br>
 &nbsp;to create instances of MyEnum which are initialized differently.<br>
 &nbsp;MyEnum has a method printSomething which contains the same<br>
 &nbsp;code as in the enum example<br>
- anywhere in the code assign MyEnum two to myCase<br>
- later invoke myCase printSomething<br>
<br>
The difference between those two is that we use the builtin<br>
case construct that is called method lookup. And it is less<br>
code and better to read. And your constant is an object that<br>
is alive and could provide you with many more things than<br>
printSomething.<br>
<br>
Just ask if this isn&#39;t clean as I might think.<br>
<font color="#888888"><br>
Norbert<br>
</font><div><div></div><div class="Wj3C7c"><br>
<br>
<br>
_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@lists.squeakfoundation.org">Beginners@lists.squeakfoundation.org</a><br>
<a href="http://lists.squeakfoundation.org/mailman/listinfo/beginners" target="_blank">http://lists.squeakfoundation.org/mailman/listinfo/beginners</a><br>
</div></div></blockquote></div><br></div></div>