<br/>&gt; On May 26, 2016, at 8:29 AM, Ron Teitelbaum [via Smalltalk] &lt;<a href="/user/SendEmail.jtp?type=node&node=4897621&i=0" target="_top" rel="nofollow" link="external">[hidden email]</a>&gt; wrote:
<br/>&gt; 
<br/>&gt; One more question for you. &nbsp;I mentioned returning a newly created instance or a specific class from a class side method. &nbsp;Can you name another reason why you would write a method on the class side? &nbsp;
<br/><br/>When you want the class as a whole to do something. &nbsp;When there is only one instance of an object and other is not desirable or logical.
<br/><br/>For example, one compiler: two is not practical. &nbsp;One instance of the number Pi. &nbsp;One instance of Nil. Why would you need another? &nbsp;
<br/><br/>&gt; Why would it be a good idea to put a method on the class side instead of the instance side? &nbsp;(a hint for you, I’m thinking of something where nothing is returned. (of course in Smalltalk if nothing is returned you get back self, what I mean is that nothing useful is returned)) Bonus points for 2 or more answers with or without returning
<br/>&gt; something J.
<br/><br/>You would put a method on the class side when the method applies to all instances of the class. &nbsp;For example, Window closeAllWindows. &nbsp;Or Process stopAllProcesses. &nbsp; Or Smalltalk saveImage.
<br/><br/>I don’t think this is what you had in mind, though.
<br/><br/>Sincerely,
<br/><br/>Joe.
<br/><br/><br/>

        
        
        
<br/><hr align="left" width="300" />
View this message in context: <a href="http://forum.world.st/FileDirectory-tp4897377p4897621.html">Re: FileDirectory</a><br/>
Sent from the <a href="http://forum.world.st/Squeak-Beginners-f107673.html">Squeak - Beginners mailing list archive</a> at Nabble.com.<br/>