Animorphic ST (Strongtalk) released!
Stefan Matthias Aust
sma at 3plus4.de
Sun Aug 4 16:54:52 UTC 2002
Diego Gomez Deck wrote:
>> As I tried to explain, in Java for example, it's mch easier to
>> undestand new unknown frameworks once you've at least an idea what's
>> going on. Just type
>>
>> aButton.
>>
>> and search the presented method set. If you know (in Java) that
>> accessor method are prefixed with get and set and guess, that the
>> buttons label is called text, you can find the setText() method. You
>> immediately learn that it needs a string as argument which as to be
>> filled in.
>
> Let's suppose this is the first time with aButton.
>
> I'll white this code:
>
> self halt.
>
> Then I'll open an Inspector for aButton and play with it until I get
> enough knowledge of it.
First, there's the problem, how to get that button. Often, a simple
Button new is not enough. But once I get my button, sure I can look
into an inspector or browse the buttons methods. Still, I've to guess.
Trying out methods which might destroy my whole system is dangerous.
And I have to look up a method in a browser, remember it, and type it.
No help from the system, no tooltips, no code completion.
> Play with objects, don't read code.
Okay, I just tried. Opening a workspace, typing
Button new
and pressing Alt+I. ...Hm, doesn't look like a morphic button (no
owner, no bounds,...) Let's see
self browse
...ooops, error, drop keyboard, grab mouse, click on abandon. Trying to
select browse with keyboard - the old error that you cannot shrink a
selection via keyboard is still there (hello old friend) - so I grabbed
again the mouse, select the word "browse" open, the popup menu... no
browse menu (I moment later while writing this, I remembered, there's a
second menu page) So again hand-on-keyboard, pressing Alt+B (I'm better
in remembering shortcuts that menus, obviously)
A new browser opens and I learn that Behavior is the class which
implements browse. Assuming that I don't know Behavior's place in the
class hiearchy, I grab the mouse, open the popup menu and choose "browse
hierachy", scrolling up and down in the up-popping browser, I decide
that this is a class method, so ...
Diging down to my inspector be closing two browsers, I try
self class browse
and get to my browser I actually tried to open (just by guessing and
playing around). Well... From
module: #(Squeak MVC Editors)
I guess that this is an old MVC component (the class comment isn't
really helpful) and I close the browser and the inspector.
Let's try
MorphicButton ... Error
MorphButton ... Error
ButtonMorph ... Error
Grr... I get frustrated. But wait, there was a StringButtonMorph in
the correction list so I choose that one. I've a new inspector.
I select self and open a hierachy browser. The class is shown at the
top of the class list. Is it the root of the class hierachy? No, can't
be. Wait, the pane as a scroll bar which is just too small to should
that there's more above. I scroll down. StringButton inherits from
StringMorph, I didn't expect that.
How do I get that Button on my screen? Probably a Morph should know...
I'm shocked! Class Morph has 1081 methods and more categories that I
ever can look at at once, even if I resize the browser. I select
--all-- and try to find something like #open or #show.
Jepp, there's a #show method. Great. I switch back to my inspector
(which was totally covered by the browser) and type
self show
nothing happens. Let's try #openInWorld that sounds promissing.
Great there's a word "Flash" in the topleft edge of my screen.
I notice that "contents" contains Flash. I change that to 'Stefan' in
the inspector. Nothing happens... I recheck, the variable really has
the new value and a
self contents
correctly answers Stefan. Again frustrating. I change the
actionSelector to #beep. A quick check
self beep
confirms that everything can beep, even if the "beep" sounds like a pot
of coffee falls down. I click my button but nothing happens...
well with the exception that now it shows "Stefa"
Very frustrating. I give up.
That long rant might show that just exploring the system doesn't really
help. Disclaimer: Don't try to help me, I know how Morphic works and
how I should have proceeded. I just wanted to demonstrate some common
mistakes. (Accepting "self" the target slot eventually makes the button
to rattle on click)
The big question is whether code completion would have helped me. Not
much, I'm afraid, but at least, it could have helped to reduce the large
amout of methods I was confronted with.
> No... I don't use any of these options. I use the Debugger and
> Inspectors to play with objects and this is comfortable to me (and
> really funny!)
I feel less productive in an unknown Smalltalk system (like Squeak has
become to me) than an unknown Java system (like the Eclipse source
code). Once you got an understanding of most of your system, things
might be different.
I once felt much more productive with Smalltalk than with Java.
> Yes... It's trial-and-error, what is wrong with this? How did you learn
> to walk, talk, etc?
I played around with Ned Konz connector morphs (great stuff!) and
managed to look up Morphic four times just by following the examples.
So trial and error isn't always the best way. It was quite frustrating
so see my image (with all stuff unsaved) to become inaccessible, still
reacting to my mouse moves, trying to route the connectoring throwing
exceptions continuously.
> No tool/language can convert bad programmers in good ones.
It can't do this automatically, but it can support programmers in
learning to improve there skills. Reading other people's code helps.
Smalltalk is great in this respect, as you can learn from the system's
code -- if that's written in a clean and easy to read style.
>> And there's another point with unit tests. As they're written in the
>> same language and are always run together with your code, can you
>> assure that the semantic of your program doesn't change if you don't
>> run them?
>
> I don't follow you. What means "if you don't run them?"
I meant, how can you assure that your unit tests don't change the
semantics of your code and once, if you remove the unit tests to get
your production code, it will fail because something is missing.
I could be as simple as a useful extension #foobar, which the unit test
package adds to your system and which you accidentally uses.
> A declarative type system affect my code too much. The models generated
> most of the times are more complex than the equivalents without a typed
> system. Do you want an example? EJB.
Actually, EJBs are something which weren't made to run with Java. They
do all kind of tricks to work around the limitations of Java. Could be
so funny, if not anybody would want to use them :-)
bye
--
Stefan Matthias Aust //
www.3plus4software.de // Inter Deum Et Diabolum Semper Musica Est
More information about the Squeak-dev
mailing list
|