[Newbies] Re: Design best practice : put state-independent methodsonclass side?

Ralph Johnson johnson at cs.uiuc.edu
Wed Mar 26 14:04:37 UTC 2008

On Tue, Mar 25, 2008 at 5:51 PM, itsme213 <itsme213 at hotmail.com> wrote:

>  Is my specific usage style OK -- many instance methods from many classes
>  calling shared state-less methods from a common class? Or does it have some
>  kind of code smell? Any thought on whether traits (simply mixing them in on
>  the instance side) would be a preferred approach to this?
>  Foo>>m1
>   Library doX: iVar1 with: iVar2
>  Foo>>m2
>   Library doZ: iVar2
>  Bar>>m3
>   Library doX: iVar7 with: ivar8
>  Library class>>doX: anX with: aY
>  Library class>>doZ: aZ

My gut reaction is that you are missing an abstraction.  I can't tell
for sure, because you don't give enough details.  Why don't you put
this code in the class of the ivars?  Maybe the ivars are integers or
strings, and they should be a value object.  Unless you explain more
about the problem domain, there is no way for me to tell.


More information about the Beginners mailing list