newbie style question regarding constants
Lex Spoon
lex at cc.gatech.edu
Fri Nov 14 14:45:14 UTC 2003
> > AuthMethod class>>METHODSIMPLE
> > ^ 16rFFFF
> >
> > so I do a
> >
> > conn login: 'me' credential: '' authMethod: (AuthMethod: METHODSIMPLE).
By the way, it's worth thinking about turning these codes into beefier
objects than simple integers or symbols. Instead of writing code like
this:
authMethod = (AuthMethod simpleMethod) ifTrue: [
"do simple authentication" ].
authMethod = (AuthMethod rot13Method) ifTrue: [
"do rot13 authentication" ].
"... one ifTrue for each method ..."
You could write this:
authMethod authenticate: self.
authenticate: is a method that is different for each kind of
authentication.
-Lex
More information about the Squeak-dev
mailing list
|