Why don't you just write

    user class firstPageForUserClass

?

Lukas

On 11 October 2010 09:16, Stéphane Ducasse <[email protected]> wrote:
> OOP in Smalltalk is nearly the same as in Java!
>
> No typecheck
>
>> I could do the same thing this way, right, but this seems more verbose and 
>> ugly then it has to be.
>>
>>
>>
>>       (user isKindOf: RSPerson ) ifTrue: [returnPage := (RSPerson 
>> firstPageForUserClass) ].
>>       (user isKindOf: RSAdmin ) ifTrue: [returnPage := (RSAdmin 
>> firstPageForUserClass) ].
>>       (user isKindOf: RSTeacher ) ifTrue: [returnPage := (RSTeacher 
>> firstPageForUserClass) ].
>>       (user isKindOf: RSStudent ) ifTrue: [returnPage := (RSStudent 
>> firstPageForUserClass) ].
>>
>>       ^returnPage
>
> why don't you either declare a factory or simply define methods on the 
> RS-Object
>
>> RSPerson >> firstPageForUserClass
>        ^ cccc
>
>> RSAdmin >> firstPageForUserClass
>> RSTeacher >> firstPageForUserClass
>
> Stef
> _______________________________________________
> Pharo-users mailing list
> [email protected]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
>



-- 
Lukas Renggli
www.lukas-renggli.ch

_______________________________________________
Pharo-users mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users

Reply via email to