"Smalltalk for C programmers"

Giovanni Giorgi giovanni.giorgi at mlab.disco.unimib.it
Thu Feb 10 13:23:45 UTC 2000


Stephan Rudlof wrote:

> [...]>   1. C language is broadly used.
> >   2. C programmers who do not know C++ can have benefit form Smalltalk,
> >      without having to learn C++ (which is a C with a little of objects
> >      in it  and same error-prone of C:)
>
> C++ is *much* more error-prone as C, because it is ANSI-C with *many*
> additional constructs. Therefore the complexity of C is enlarged.

>[...]
>I don't want to complain only: C++ is better than C if its features are
>used modestly. And it is as fast as C, because it is C with extensions
>(important for e.g. image processing).

I think you are right. I have used C++ only for some projects in the
University, and I leave it when STL seems to me too difficult to understand.
Then I find out Smalltalk....

> [...]C is quiet far away from Smalltalk.
>
> So, how do you want to exploit the C background of the potential readers
> for didactic concepts which introduce Smalltalk and OOP?

I think Smaltalk has some strong point in this direction: Smalltalk is the
first language with a simple but clear concept of class.
You have class methods and instances methods, clearly divided (no "static"
reserved word, for example)
All is an object.
You can ignore the meta-class related-problems at a first look.
If you exclude:

   * Smalltalk language estensions (like the possibility of new 'statements'
     like swich-like....)
   * The "strange" untyped syntax for declaring variables
   * The concept of code block

...Smalltalk is *easy* to understand, even easier than Java.

For example, one of the first question a student can do in Java  is: "Why int
is written so, and String has a capital S?..."
The response is the difference from native data types and  the concept of
class (plus some "strange" thing like the use of + and == in
Strings...)...about an hour of lesson.

If you take VisualBasic and look at the concept you must know (and
re-understend, like class with no inheritance)
I see more difficulties...(ok, I know VB is a ugly language, but it is used by
someone after all:)

And best, you have fun using Smalltalk!!
If your first code in Smalltalk is a bit ugly do not matter, it is far away
form the first bad code you wrote in C, in my own opinion (and perheaps the
code in C would not compile or it will hang your PC).

> [...]
> Indeed it doesn't makes sense to learn C++ to learn ST then, the
> opposite - if learning C++ at all, but we are not in an idealistic world
> - is much more better IMHO.

Yes, but the idea is to ignore completly C++ and using only C-concept...
For example, casts are so frequently in C....but Smalltalk do not need them!
What I observe is simple: Smalltalk uses only 2-3 concepts for building a
rational view of th language: it is reduced to the minimum!
Pascal is similar, but it has a two-page type compatibilty rule, and some
limitations (no gui at all for example, or no large standard library).

Is Smalltalk simpler than C?....
--
// Giovanni Giorgi           mailto:giovanni.giorgi at mlab.disco.unimib.it
// Master Thesis  at  http://neptune.sal.disco.unimib.it:8080/platone/1
// Student (& exTutor) at Depart. of Computer Science of Milan, Italy.
-------------------------------------------------------------------------






More information about the Squeak-dev mailing list