[Newbies] Design best practice : put state-independent methods on
mm3 at zepler.net
Tue Mar 25 18:27:43 UTC 2008
What's wrong with keeping them instance-side?
On Tue, Mar 25, 2008 at 5:41 PM, itsme213 <itsme213 at hotmail.com> wrote:
> I have some methods that currently refer to iVars, called from other
> of the same class. I need similar functionality in other classes, not
> related by inheritance, and want to keep it DRY.
> If I move the iVar references into explicit method args they can be easily
> re-located and shared.
> Is it then good or bad practice to take a such collection of related
> state-independent methods (they don't depend on any iVar) and put them on
> the class-side of some suitable class?
> My options and concerns:
> - I could move them up the hierarchy on the instance side but sometimes
> single inheritance limits
> - I could use traits for these but am unclear about the future of traits
> - I can put on the class side and call easily from instance-side methods,
> but is this OK practice?
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Beginners