[Newbies] remembering variables
billsix at gmail.com
Tue Jun 3 05:10:37 UTC 2008
I went to a college where they only taught Java, so hopefully I can help you
In school, I was taught that the 3 tenets of object oriented programming are
encapsulation, inheritance, and polymorphism. That may be true, but only if
one chooses to ignore history (which reminds me, I should call up Johns
Hopkins and ask for most of my tuition back). In Smalltalk: "OOP ... means
only messaging, local retention, protection, and hiding of state-process,
and extreme late-binding of all things". The focus is on sending and
receiving messages between objects, regardless of their types.
I can understand your desire to know the type of each variable beforehand,
if that's the style of development that you are most familiar with. But try
this. First, read this article <http://coweb.cc.gatech.edu/cs2340/5556>on
the Squeak debugger. After, look at a unit test, add a halt somewhere in
the implementation code, and run that unit test. The debugger will pop up.
The debugger is like a stack trace, only you can inspect every object in
this frozen process (including their types). Once you are familiar enough
with the Smalltalk and the debugger, you may find that C++/Java/C# type
systems are a pain.
However, if type-free development doesn't suit your tastes, but you are
still looking for a language which offer high levels of abstraction, you may
want to look into Haskell. Me, I feel more productive with Lisp dialects
You said you're still new to Smalltalk - I can recommend a few books that
helped me, if you're interested.
Hope you found this somewhat helpful,
On Mon, Jun 2, 2008 at 8:57 PM, peter h meadows <phm at sdf.lonestar.org>
> Ah. Well, more often than not the variables in my code stay as one 'type'
> of thing. And I thought that generally they would otherwise things would get
> really confusing!?
> Sometimes when I try to understand how a program is working I get lost in
> the debugger. What I'd like is a kind of overview of what's going on.
> Something I can browse and focus in on the parts that seem interesting. In
> theory I can do this with the system browser but it doesn't tell me how
> everything fits together. I want to see an overview of how all the parts fit
> together.. Who uses what.. Which bits are connected.. The order in which
> things are done, etc.
> Can I get the debugger to show a tree of message sends, that I can browse?
> Something like that?
> Any ideas? thx.
> "peter" == peter h meadows <phm at sdf.lonestar.org> writes:
>> peter> Oh. I'm still very new to smalltalk. It seemed like it would help
>> me to
>> peter> understand what's going on. I wanted it to remember everything. E.g
>> peter> the thing is an array it will tell me what has been stored in it.
>> peter> wouldn't it help with code completion? If it knows what type of
>> peter> it was in the past it can guess which messages I want to send to
>> peter> it. That would be useful.
>> But the problem is that a given type in the past is not any indication of
>> a type in the future.
>> You're not "thinking smalltalk" yet. Stop worrying about types. :)
>> Oh, and they aren't types. They're instances of classes.
>> If you want to see what's going on, learn to single step in the debugger.
>> It's quite informative.
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Beginners