From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,75fd0c408a2ec7a9 X-Google-Attributes: gid103376,public From: joconnor@jmpstart.com (James O'Connor) Subject: Re: Difference between Ada and Small talk - Object Oriented Date: 1997/11/02 Message-ID: <345c2e7c.56908457@news-s01.ny.us.ibm.net>#1/1 X-Deja-AN: 286550188 References: <34592A6B.665@ednet.co.uk> <3458C41A.3981@easystreet.com> Organization: JumpStart Systems Inc Reply-To: joconnor@jmpstart.com Newsgroups: comp.lang.ada Date: 1997-11-02T00:00:00+00:00 List-Id: On Thu, 30 Oct 1997 09:30:02 -0800, Al Christians wrote: >David Brown wrote: >> Can any one help me, I have to write an essay on the differences between >> Ada and Smalltalk focusing on there object oriented features. > >Main difference is when the error messages come out. ST gives the "Does >Not Understand" message at run time when the program sends a message >that is not defined for the class of the receiving object. Ada bends >every effort to make sure you figure this all out before it happens. >The similar error in Ada won't and can't compile, so you have to fix it >sooner. Smalltalk programmers say that this doesn't happen very much >and it's no big deal. Ada programmers like to not worry that it might >happen. > >If you can understand and explain all the implications of that one >difference, you've probably got a good paper. > >Al There are more fundamental issues between Ada and Smalltalk then this While this difference is important, it is more symptomatic of other differences between the languages. Probably the most fundamental differences would be: Typing: Smalltalk types variables at run time, Ada enforces types at compile time. "OO"- ness: Smalltalk is pure OO which can be both good and bad, depending on your point of view. In Smalltalk, everything is an object (including classes, metaclasses, messages, etc...). All functionailty must be implemented in terms of sending messages to objects. Ada is more "package" based that allows OO programming, but also allows other styles as well. Syntax: Smalltalk has a very simple, consitant syntax. Smalltalk has no real keywords and only a few reserved object names (nil, true, false, thisContext). Ada has a lagre syntax with many reserved words. Smalltalk implements basic operations in terms of messages to objects, not syntax. Boolean conditions, looping, exception handling, mutithreading, etc.. are all implemented using the same "send a message to an object". Ada has distinct syntax rules and keywords for different situations. Method Dispatching: Smalltalk bases a message dispatch on the object receiving the message, not the class membership of the object. This is a subtle difference. At runtime, the Smalltalk VM will determine if the object to recieve the message implements the proper method. Ada will determine at compile time if the operation to be performed on the object is legitmate based on the type of the object. This is because the Smalltalk compiler does not know the type of the receiving object at compile time. A few side effects of this in Smalltalk include the ability to do multiple-inheriitance of interface and the ability to build messages on-the-fly at runtime. Information Hiding: In Smalltalk, all instance variables are "protected", all methods are "public". Ada allows access control by the separation of package specification from package body and the ability to provide for a "private" section of the package specification. Class Hierarchy Smalltalk "normally"has a single-rooted class hiearchy, with Object being the parent class of all classes as a default. However you can make subclasses of nil instead of Object if you do not wish to inherit from Object. Ada does not use a single root class hiearchy. Smalltalk allows extension of existing classes. Standardization: Ada is a standardized language with a Language Reference Manual that all tools must conform to if they wish to wear the name Ada. Smalltalk is fractured between several major vendors. While the "syntax" of Smalltalk is consitant across implementations, the class hiearchies can be quite different. Ada snd Smalltalk are quite dissimilar languages. They are different in there philosophies and intentions. However, reflecting on how both langauges apporach various issues and solve problems can be valuable, regardless of which you choose to use. A note on "Does Not Understand". Since Smalltalk allows modification to existing classes, The method #doesNotUnderstand: as implemented in Object can be overloaded to trap and handle illegal message sends at runtime. Thank you, take care, Jay O'Connor joconnr@ibm.net http://www.jmpstart.com http://bassace.dyn.ml.org 31 Hertz