[Newbies] Re: crossSum
Simon Kirk
simon.kirk at pinesoft.co.uk
Tue May 9 12:29:55 UTC 2006
Enrico Schwass wrote:
> Hello
>
> First of all. The creation of this mailinglist was a very good idea.
> Reading the original list I always felt wrong, because of the very high
> level of questions and ... yes answers. Thanks :)
>
> Anyway. I was looking for a crossSum Method for Integers.
>
> e.g. 251 crossSum (sometimes called checksum) should return 8
>
> 1234 -> 10
>
> I couldnt find one with method finder. So I wrote one by myself.
> And a friend - also a smalltalk newbie - did another one.
>
> Probably both are not perfect.
>
> The first problem is: Where to put the new method? We decide to put it
> directly into Integer (arithmetic). There are no side effects, we guess.
> Are we right?
>
> Second, we dont know the class library very well. It tooks 20 min to
> find the smalltalk equivalent to !=
>
> Its ~= for other newbies :)
>
> So we never know, if we are doing it the smalltalk way.
>
> It would be great if others post their solution and it could be a good
> example for describing the test first development cycle, too. Another
> area I am not so familiar with. But I am eager to learn this.
>
> BTW: How can I tell method finder to use new implemented methods for
> example search? 1. 2. 3. 4. 10 didnt show me crossSum.
>
> Have a nice day
> Enno
Hi!
As a not-so-long-user of squeak myself, I've always found this page
invaluable for digging out various fundamental language features:
http://minnow.cc.gatech.edu/squeak/5699
Sorry if you've seen it before, or seen it mentioned before ;)
HTH.
Simon
More information about the Beginners
mailing list