On Tue, Dec 31, 2019 at 11:29 AM Roelof Wobben via Pharo-users
<pharo-users@lists.pharo.org> wrote:
>
> I solved it but I think with ugly code on the class side.
>
> solution
>      | computer |
>      computer := self new.
>      computer readRam: computer masses.
>      computer patchRam: 1 value: 12.
>      computer patchRam: 2 value: 2.
>      computer processData: computer ram.
>      computer at: 0
>
> Is there a way I can make this more smalltalk.

I don't know exactly why you mean by "more smalltalk", I don't know
the problem you're solving, but you have a class side method that
doesn't return anything, and the readRam: and processData: methods
pass arguments that the receiver already have.

So I'd do:

solution
     | computer |
     computer := self new.
     computer readMasses;
     computer patchRam: 1 value: 12.
     computer patchRam: 2 value: 2.
     computer processRAMData.
     ^computer at: 0 "I don't know what this does".

Reply via email to