|
Re: Best practice for very simple objects: msg#00113lang.smalltalk.squeak.beginners
On Tue, 2007-06-26 at 15:45 +0200, Michael Rueger wrote: > Norbert Hartl wrote: > > > At first I created a lot of classes like AdminRole, > > MemberRole, CreatePermission, ModifyPermission etc. > > I used the class objects for this. These only carry > > some state like index, label. The role objects also > > carry a set of permissions. > > I'm a big fan of instances :-) > me too (in general) :) > Have one Permission class, one for Role etc. > > Then you can have instance creation methods (maybe via a cache) > > Permission modify, Role admin > Yes, this looks very good. So it seems to be all I wanted to have. No class use, shared instances and readable usage. Thanks very much. > Internally you could actually use (symbol) names > > Permission>>modify > > ^Permission new name: #modify > > or > > self cache at: #modify ifAbsentPut: [...] > I like this one. Without any reason to mention. I think I'll like to use == ;) > This would make it easier to extend the role and permission model later > > Permission>>named: permissionID > > > > anAction requires: Modifypermission > > anAction requires: Permission modify perfect. thanks again, Norbert
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Best practice for very simple objects, Michael Rueger |
|---|---|
| Next by Date: | Re: Best practice for very simple objects, Norbert Hartl |
| Previous by Thread: | Re: Best practice for very simple objects, Michael Rueger |
| Next by Thread: | Re: Best practice for very simple objects, Michael Rueger |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |