logo       

Design best practice : put state-independent methods onclass side?: msg#00163

lang.smalltalk.squeak.beginners

Subject: Design best practice : put state-independent methods onclass side?

(forgot to copy the list)

Classes are certainly well known, but not the only way to get a well
known object.

My pragmatic issue with using class side methods for Singletons is
that it is a bunch of work to refactor the class side behavior to
instance side later. Look at the original PWS server for a squeak
specific example.

My design issue is that classes are for making instances (technically
for defining behavior of instances). Making them the building block of
the program means that I'm giving them extra responsibility. I like to
keep the responsibility list as small as possible.

(Someone walked off with my Design Patterns Smalltalk Companion, which
wrote about these issues better than I can.)



On Tue, Mar 25, 2008 at 2:51 PM, Ramon Leon <ramon.leon@xxxxxxxxxxxxx> wrote:
> > I'm guessing you like that the class methods can be invoked
> > easily from the class name. What you want is a well known object.
>
> Like a class?
>
>
> > I wouldn't use a class object just to create a well known
> > object. I'd probably start with a Singleton and work from there.
>
> Like a class? Classes are singletons, what do you have against using them
> as such?
>
> Ramon Leon
> http://onsmalltalk.com
>
>


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise