Trouble Getting adjusted to Smalltalk

Doug Way dway at riskmetrics.com
Tue Oct 23 18:52:49 UTC 2001


Alan Mortensen wrote:
> 
> I'm having difficulties tinkering around with Smalltalk after being a
> long term Java developer.  My biggest problem is with typing (as in
> class types)... how do you know what to pass methods?  Often I see
> parameter names like aRectangle.. so I guess that's clear.. but what if
> it's something like aBounds..

This is a general issue for beginners when learning a dynamically typed language.  You do have to learn some idioms that more experienced Smalltalkers take for granted, such as "I know 'bounds' is usually going to be a Rectangle".  (You have the same issues with other dynamically typed languages such as Python, Ruby, Lisp, etc.)

I think some sort of type inferencing built into the browsers would help a great deal for beginners in this situation.  Type inferencing would analyze the source code in the image and give you a good guess for what types the parameters of a method are, and what types instance variables are, etc.

This is why I added some simple type inferencing (actually type "collecting") directly to my Whisker browser, although only for instance variables, not parameters.  (See http://www.mindspring.com/~dway/smalltalk/whisker.html for more info on Whisker.)

Another good way to learn what objects are passed into methods is to use the debugger.  You can put a "self halt" in a method, and start stepping through it, and you'll see "Ah, this parameter is a Rectangle, this other one is a Point".  (Be careful that you don't put a halt in a low-level method that might cause an infinite loop.)

> Oh as a side note, how is smalltalk doing these days usage-wise?  I know
> Java has blown up in usage and may outpace C++ soon, but Smalltalk has
> just been chuggin' along since the early days.  I had heard that up
> until like 98 there had been steady growth but no one's been talking
> about its marketshare since.

Pretty much everyone knows that Java has a larger market share than Smalltalk (unless you've been living in a cave :) ).  Most of us are here because of the quality of the language, and because of the unique features of Squeak, not because we want to use the most popular (or most hyped) language.  But yeah, I'd say Smalltalk's market share has been holding steady overall, not rapidly increasing or decreasing at this point.

- Doug Way
  dway at riskmetrics.com




More information about the Squeak-dev mailing list