Miscellaneous questions...

Terry Raymond squeak-craft at cox.net
Fri Sep 9 19:18:16 UTC 2005


> -----Original Message-----
> From: squeak-dev-bounces at lists.squeakfoundation.org [mailto:squeak-dev-
> bounces at lists.squeakfoundation.org] On Behalf Of Blake
> Sent: Thursday, September 08, 2005 10:03 PM
> To: squeak-dev at lists.squeakfoundation.org
> Subject: Miscellaneous questions...
> 
> Just a few things to throw out here:
> 
> -> Still wondering about the Squeakland image; the download is less than
> 1MB, so obviously it's not in there (right?).
> 
> -> When you're developing classes and testing stuff out, do you expose all
> the instance variables? And then later, remove the accessors you don't
> want the user to have? I notice that to test/debug it's often easiest to
> have access to everything from the Workspace, but really don't want that
> to be exposed to clients of the class.

I frequently write my initial code as if I have accessors but later
change it to ivar refs.  I think direct variable references are more
readable and self accessors are not good for encapsulation.

> -> If you were creating a deck (of cards) class and a card class, would
> you put the card's rank and suit in as strings or as symbols, keeping in
> mind that you were later going to reveal the class to students for
> educational purposes? I know I want the deck to be card neutral, i.e., to
> be usable for a deck of any sort of cards, but the cards themselves (for
> standard decks), for convenience, are described as being (rank) "King" and
> (suit) "Hearts". But perhaps that should be #king and #hearts. (I tend to
> worry about making global symbols: seems like courting trouble.)

I would not use any primitive value type object to represent suit or rank.
I would use objects, i.e. a Heart object and a King object. Doing so
makes it much easier to do reasoning and comparisons between cards.

I am from the old school and used to start out using symbols, numbers,
or strings to represent state.  I eventually found out that real
objects do a much better job. Rather change my code from some value
type of representation to a real object after I found out I need it,
I think it is better to just start off that way.

> Nothing real urgent, just stuff that has occurred to me.





More information about the Squeak-dev mailing list