Grasping the concept of Classes & Categories

Daniel Salama dsalama at user.net
Thu Jun 16 16:52:41 UTC 2005


Hello all,

I've been playing with Squeak for some time and have a question. if I  
wanted to use a Squeak instance to serve different applications (say  
multiple applications using Seaside), how unique do classes need to  
be? Sorry for the vague question. Let me be more specific.

I have two applications that both need a class Customer. However, one  
of the application requires that class Customer have a set of  
attributes and methods very different from the second application who  
uses the class Customer for a totally different industry.

If I create a category for each of the applications, can I have a  
class Customer for Category A and another class Customer for Category B?

In a way, I think I'm going to try to answer the question myself, but  
would prefer to get clarification or validation from you guys, who  
are much more experienced than me. The Smalltalk way would be to  
reuse code as much as possible. Therefore, I should probably  
carefully design a class Customer so that it may be sub-classed into  
more specialized classes such as IndustryACustomer and  
IndustryBCustomer. Is this the Smalltalk mentality? Coming from other  
environments which don't "encourage" you to work efficiently may be  
what's confusing me.

Thanks,
Daniel




More information about the Squeak-dev mailing list