Learned smalltalk syntax. Whats next ?

goran.hultgren at bluefish.se goran.hultgren at bluefish.se
Tue Mar 26 13:52:28 UTC 2002


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.

One good way to understand more is to learn your tools better - have you
tried using implementors of, class refs etc? It can also be very good to
learn to use the hierarchy browser, protocol browser etc. After a few
minutes of digging I found the method constructin the UI for a Browser:

openAsMorphEditing:

(select that string and type Alt-m for implementors etc)

Somewhere in that method you could typically change the UI of all
browsers. A simple test is to add this line at the end just before the
"^window":

	window borderColor: Color black.

Open a new browser and see the effect. This method is run every time a
new browser is opened - select the method name again and type Alt-n to
see the sender methods.

> And there
>         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.

Yep, Squeakers are unfortunately not known for their tendency to
document their code. I also think it's a SHAME. A class comment should
IMHO always be there. Note also that many subclasses of Morph are not
meant for "general use". Unfortunately they "clutter" the view right now
- when the modules system is more workable a lot of "noise classes" will
disappear since you don't really need to have them loaded.
 
> And there
>         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.

Morphs can be used in an MVC style, sure. But there are various
approaches here.

> Classes vs. Objects
>         In general I am very confused by these Viewers. I can

I am not sure I understand what you mean by "Viewers".

>         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). 

One of the basic ideas behind OOP in general and Smalltalk/Self in
particular is (IMHO) that there is great power in "mirroring the real
world" when designing software. In short - the less we need to transform
our model (which typically is out there in the real world) when we try
to build software for it, the better.

>         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

It sounds to me that you perhaps should take a look at a OOP primer to
understand the ideas and principles behind object orientation in
general. Unfortunately I don't have any particular good books to refer
you to, prehaps someone else.

>         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.

Squeak is not the best Smalltalk when learning the basics. It's like
Linux - fun as hell and fully open to tinker with etc. But it's pretty
wild grown and documentation can be of various quality. It's easy to
drown in the "noise". But a good basic book on Smalltalk would probably
save your day - there are a bunch.

>         Will I have to adopt the "self" philosophy to successfully
>         work woth morphic, i.e forget about Classes ? Manipulate my

Nope. Morphic works fine with a class centric view IMHO.

>         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 ?

Again IMHO - definitely NOT. The great thing with Smalltalk is that the
system (when you get the hang of it) can be grasped and handled by a
single person.

> 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
>         deal.
> 
>         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
>         try".

Hang in there - it will come gradually. But I think you need to get one
or two books. And I am talking about Smalltalk/OOP primers, not Squeak
books. The Squeak books are cool but they are not really good for
learning Smalltalk/OOP basics. And if you are on Win32 then perhaps
Dolphin can be worth looking at. I think they have a lot of
documentation/tutorials to download and most of that should be "portable
knowledge".

regards, Göran



More information about the Squeak-dev mailing list