Thanks for all the explanations.
and yes, I have to get a feel when I need a new class and when
not.
and when it's "allowed" to use a if then and when not.
and if I understand the explanations I did not ask a class
something so a if then is
DRAT! What (genius negated) designed gmail's interface?
If I am wrong that the canHandleInput: class method of
IllegalMoveSanta should return false, not true (because
the order of the elements of #subclasses is not defined,
so that IllegalMoveSanta might *always* be selected),
then that is
In Advent-of-Code 2015, the first problem is
really quite simple. There are at least two
ways to think about it.
"CS101":
set a counter to 0
for each character of the string
if it is '(' increment the counter
if it is ')' decrement the counter
report the counter
"Higher
> The idea of a flat ban on #ifTrue:ifFalse: is ridiculous.
> Number>>abs
>^self negative ifTrue: [self negated] ifFalse: [self]
>
> Is there any better way to do this? Not really, you can
> only move the #ifTrue:ifFalse: somewhere else.
But still it’s always a good thought experiment to
> On 28 Nov 2018, at 06:15, Richard O'Keefe wrote:
>
> The idea of a flat ban on #ifTrue:ifFalse: is ridiculous.
> Number>>abs
>^self negative ifTrue: [self negated] ifFalse: [self]
>
> Is there any better way to do this? Not really, you can
> only move the #ifTrue:ifFalse: somewhere
The idea of a flat ban on #ifTrue:ifFalse: is ridiculous.
Number>>abs
^self negative ifTrue: [self negated] ifFalse: [self]
Is there any better way to do this? Not really, you can
only move the #ifTrue:ifFalse: somewhere else.
The main argument against #ifTrue:ifFalse: is NOT TO USE
IT FOR
Roelof,
One technique to eliminating the use of #ifTrue:ifFalse: is to use
double dispatching. There are some good examples of using double
dispatching in Ralph Johnson's paper "ARITHMETIC AND DOUBLE DISPATCHING
IN SMALLTALK-80"[1]. you should be able to get the basic idea by
skimming the
Hello,
Yesterday I had a talk with luc frabresse about using if then.
He said if I understand it right, Its the best to not using a if then or
a ifTrue/ifFalse.
Can anyone help me figure out how to rewrite this project so I will not
use the ifTrue in the basement function.
my code so far