TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy


Options: Use Forum View

Use Monospaced Font
Show Text Part by Default
Condense Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
"Team Ada: Ada Advocacy Issues (83 & 95)" <[log in to unmask]>
Nasser Abbasi <[log in to unmask]>
Sun, 15 Nov 1998 23:53:55 -0800
text/plain; charset=us-ascii
Nasser Abbasi <[log in to unmask]>
text/plain (55 lines)
At Sun, 15 Nov 1998 17:36:29 +0100
>What is the advantage of the above syntax over the Ada one?

it is more than just "synatx".

The C++/Java syntax (refered to as above, above) for a class is more
natural to me becuase it allows one to write

Obj.message(  message_parameters );

instead of the Ada way, where one writes

message( some_parameters, the_object_is_hidden_here ,

You see, in the Ada way, the object whose the message is being send to
is hidden among the message parameters being send to it!

Using a function/procedure call to send a message to an object, and
having the object the message being send to sit among the parameters of
the message is not a natural way to express what I think of when I think
of objects and messages being send between them. .

Not only that, it is visually harder in Ada to find the stuff that makes
what is contained in a "class", since there is no one enclosing
construct the contains the data+methods in one place. There is nothing
to stop anyone of having methods (functions, procedures) that do not
belong to the "class"  from being spread all over the package and in
between the primitive methods of other tagged records.

It is harder becuase you have to look at the profile of each function or
procedure to determine that that method belongs to what tagged record,
by visually inspecting the arguments to find if one of them is of tagged
record type, or even what the return type of the function is.

this loose organization is what bothers me about how Ada handles OO. I
like to see all the stuff that belongs to one class encapulated in a
clear construct, something like

 class class_name
   // everything here belongs to this class.

now I am happy, I dont have to scan the code visually to decide what
belongs and what does not belong to the class 'class_name'.

Offcourse, everyone is free to prefer different styles, I just find the
OO style of Java and C++ more natural, even though I like all the other
Ada language stuff more, except for its OO.