|
Re: Best practice for very simple objects: msg#00110lang.smalltalk.squeak.beginners
Nothing wrong with a lot of classes with only a few polymorphic messages. Many of the design patterns leverage this. I would get the behavior over to the instances. So your examples would look like: anAction requires: Modifypermission new and aUser hasPrivilege: AdminRole new If you are worried about creating too many Role or Permission objects and then simply throwing them away, you can share them. Note that this qualifies as an optimization. You should really only optimize after you've proven that you need to optimize. The Singleton design pattern is the best known sharable but you could also use a pool dictionary or some other well known object. I avoid class side behavior like the plague. Instances for objects, classes for making objects. Exceptions rare! On 6/26/07, Norbert Hartl <norbert@xxxxxxxxxx> wrote: Hi,
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Best practice for very simple objects, Norbert Hartl |
|---|---|
| Next by Date: | Re: Best practice for very simple objects, Michael Rueger |
| Previous by Thread: | Best practice for very simple objects, Norbert Hartl |
| Next by Thread: | Re: Best practice for very simple objects, Michael Rueger |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |