Learned smalltalk syntax. Whats next ?
arning at charm.net
Tue Mar 26 13:48:12 UTC 2002
On 26 Mar 2002 13:46:21 +0100 Martin Drautzburg <martin.drautzburg at web.de> wrote:
>I have a problem
> I am at a dead point at the moment and could use some advice.
> I have now learnded enough smalltalk so I can think about
> smalltalk programming without wanting to write a "continue" or
> "break" statement every couple of minutes. Can also write
> little programs without morphs. Good so far.
> Next thing I thought, would be to dive into morphic, but is
> wouldn't let me in.
>I got stuck here
> E.g. I thought it should be easy to give the browser a
> gradient background. It is easy within a viewer, but this only
> changes the running instance. Tried debugging the Browser when
> is starts up. It is just too much to look at.
Well, the browser is a bit complicated to be the first beast you try to tackle. Take a look at one of the games, perhaps.
> Then I was trying to figure out what morphs to use for my
> TicTacToe exercise. There must be roughly *400 Morphs* in the
> system, many of them without a comment.
A simple bit of advice... start simple. The board is one or more rectangles and the pieces could be simple sketches (nice, hand-drawn X and O). There is a RectangleMorph and a SketchMorph. Try starting with these or maybe a subclass of each. As you try to solve particular problems in your game, keep asking yourself if you have already seen something in Squeak that seems to have solved that problem. Has another game? Some part of EToys? If so, it may pay to take a peek to see what you can borrow.
> Then I wandered if morphs can be used in a MVC type pattern. I
> found an example for lists on the wiki that suggested the
> answer is YES. Tried to figure out if other morphs have the
> "View" capability too. No clue at all.
Well, what is the "view capability"?
- Can a morph display information that exists in another object? Yes.
- Can this morph communicate user input to that other object? Yes.
- Can that other object cummunicate to the morph that something has changed and the morph may need to be redrawn? Yes.
Is it one of these that is causing difficulty or something else?
>Classes vs. Objects
> In general I am very confused by these Viewers. I can
> understand that this is inspired by "self", that there are
> just objects and objects are made tangible. But why would I
> want to use a coputer at all if I want tangible objects ?
> There are plenty of them on my desk (too many actually).
> I used to think the power of programming comes from the power
> of language (an not from the power of pointing at
> things). Somehow I am not willing to change things in a
> viewer, because then I don't know how it works. I was thinking
> of writing applications in Smalltalk, not toys. OTOH I have no
> clue how to figure out how things work.
> Will I have to adopt the "self" philosophy to successfully
> work woth morphic, i.e forget about Classes ? Manipulate my
> objects with viewes and leave the details to the gurus. Should
> the be two types of Smalltalks users/programmers: the
> Class-Programmers and the Viewer-users ?
The short answer is that there are (at least) two rather distinct ways of approaching Squeak. They will probably both be here for a long time (extremists in either camp may wish the other would go away, but that's not likely). If you choose the "class" approach, you will be able to do everything. If you choose the "viewer" approach, some things will be easier and other things will be harder (i.e. not really possible). Pick the one that suits you.
>The paved road
> There was this thread at c.l.s where a guy stated "I can't
> learn smalltalk". This may be one of the reasons people prefer
> other languages: there is more of a paved road which will lead
> you into the language. The tutorials I found tend to suggest
> that it is real easy. After that you know the easy parts. Big
> Maybe I am just too impatient. I can see how powerful squak is
> already and how fast it is evolving. I can see people giving
> really smart answers on this list. I can "smell" the power
> behind it all. If that wasn't the case I would have said "nice
It may not be much consolation, but explorers rarely have the benefit of paved roads. What you will find here are folks willing to help. Look especially for others coming at Squeak from an experience level similar to yours. They may often be able to tell you a few things that made the difference - where hard became easy. Remember to contribute those successes you have - they will help those who follow.
More information about the Squeak-dev