comp.lang.ada
 help / color / mirror / Atom feed
* OO dot notation
@ 2002-08-14 20:35 Hyman Rosen
  2002-08-15  4:03 ` Pat Rogers
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Hyman Rosen @ 2002-08-14 20:35 UTC (permalink / raw)


For all those who have been arguing that Ada would be much
more successful if it allowed the object.method() syntax,
it might be interesting to check out some of the goings on
in comp.lang.c++.moderated, in the 'Guru of the Week #84'
threads. Many of the C++ cognoscenti are coming to the
conclusion that the method(object) notation is superior,
and indeed that as few functions as possible should be made
methods of a class.




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: OO dot notation
  2002-08-14 20:35 OO dot notation Hyman Rosen
@ 2002-08-15  4:03 ` Pat Rogers
  2002-08-15 16:05 ` Ingo Marks
  2002-08-16 19:44 ` Jim Rogers
  2 siblings, 0 replies; 6+ messages in thread
From: Pat Rogers @ 2002-08-15  4:03 UTC (permalink / raw)


"Hyman Rosen" <hyrosen@mail.com> wrote in message
news:1029357303.33848@master.nyc.kbcfp.com...
> For all those who have been arguing that Ada would be much
> more successful if it allowed the object.method() syntax,
> it might be interesting to check out some of the goings on
> in comp.lang.c++.moderated, in the 'Guru of the Week #84'
> threads. Many of the C++ cognoscenti are coming to the
> conclusion that the method(object) notation is superior,
> and indeed that as few functions as possible should be made
> methods of a class.

Interesting article (I only read the first).  A few comments...

1) I take your meaning in the above, I think. You're saying that
the distinguished receiver syntax is not so big a selling point
because there are good reasons (at least, according to the
article) not to make every function a member of a class and in
those cases the notation will not be available anyway.  Right?

As you know, the Ada syntax doesn't affect in any way whether or
not a procedure or function is a "member function".  It's all a
matter of where the subprograms are declared and with what
parameter and result types.  But the article is not discussing
syntax anyway.

2) I would argue that the article is really about abstract data
type programming.  ADT's have, of course, been around for a long
time and have always been fundamental to Ada.  So the design
choices described by the article and the position taken by the
author are not new to the Ada crowd.  (I hope that does not come
across as condescending; it is not meant to be.)  Booch's first
Ada (83) book discussed this years ago, when Ada only had ADTs
and a limited form of inheritance: you only made subprograms
primitive if they required direct access to the representation.

3) The design decision certainly applies to OOP objects as well
as to ADT objects, since they are the same thing in so many ways.
In Ada, this is especially so because the language has explicit
class-wide types and class-wide subprograms.  The decision of
what subprograms should be class-wide instead of primitive to a
specific type is based on the criterion described in the article:
can we reasonably write this subprogram in terms of the existing
primitive operations (using dynamic dispatching)?  If so, we do
indeed make a much more flexible subprogram and increase
encapsulation without loss of performance.

4) OK, I cannot entirely resist the temptation to say that the
article indicates there may yet be hope for those class-oriented
language guys!  :-) :-)

Thanks for pointing out the thread!

Best regards,

--
Patrick Rogers                       Consulting and Training in:
http://www.classwide.com          Real-Time/OO Languages
progers@classwide.com               Hard Deadline Schedulability
Analysis
(281)648-3165                                 Software Fault
Tolerance





^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: OO dot notation
  2002-08-14 20:35 OO dot notation Hyman Rosen
  2002-08-15  4:03 ` Pat Rogers
@ 2002-08-15 16:05 ` Ingo Marks
  2002-08-16 16:00   ` Warren W. Gay VE3WWG
  2002-08-16 19:44 ` Jim Rogers
  2 siblings, 1 reply; 6+ messages in thread
From: Ingo Marks @ 2002-08-15 16:05 UTC (permalink / raw)


Hyman Rosen wrote:

> For all those who have been arguing that Ada would be much
> more successful if it allowed the object.method() syntax,
> it might be interesting to check out some of the goings on
> in comp.lang.c++.moderated, in the 'Guru of the Week #84'
> threads. Many of the C++ cognoscenti are coming to the
> conclusion that the method(object) notation is superior,
> and indeed that as few functions as possible should be made
> methods of a class.

It seems to me that the world isn't "mature" for Ada yet like Unix wasn't 
mature for the masses years ago until the first affordable powerful PCs 
came up. Maybe in the future Ada will enjoy a "revival" when people demand 
more powerful languages and discover the advantages of Ada.

Could be!
Ingo




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: OO dot notation
  2002-08-15 16:05 ` Ingo Marks
@ 2002-08-16 16:00   ` Warren W. Gay VE3WWG
  0 siblings, 0 replies; 6+ messages in thread
From: Warren W. Gay VE3WWG @ 2002-08-16 16:00 UTC (permalink / raw)


Ingo Marks wrote:
> Hyman Rosen wrote:
>>For all those who have been arguing that Ada would be much
>>more successful if it allowed the object.method() syntax,
>>it might be interesting to check out some of the goings on
>>in comp.lang.c++.moderated, in the 'Guru of the Week #84'
>>threads. Many of the C++ cognoscenti are coming to the
>>conclusion that the method(object) notation is superior,
>>and indeed that as few functions as possible should be made
>>methods of a class.
> 
> It seems to me that the world isn't "mature" for Ada yet like Unix wasn't 
> mature for the masses years ago until the first affordable powerful PCs 
> came up. Maybe in the future Ada will enjoy a "revival" when people demand 
> more powerful languages and discover the advantages of Ada.

I like this answer. Additionally, people used to cite the
compiler speed and cost. Now with faster CPUs and GNAT being
freely available, both of these objections are now irrelevant
(except maybe for the Alpha (FreeBSD) platform where I cannot
get GNAT bootstrapped for :-( )

Now Ada must wait for the C/C++ world to humble themselves to
the fact that Ada was ahead of its time in most ways ;-)
-- 
Warren W. Gay VE3WWG
http://home.cogeco.ca/~ve3wwg




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: OO dot notation
  2002-08-14 20:35 OO dot notation Hyman Rosen
  2002-08-15  4:03 ` Pat Rogers
  2002-08-15 16:05 ` Ingo Marks
@ 2002-08-16 19:44 ` Jim Rogers
  2002-08-16 20:09   ` Hyman Rosen
  2 siblings, 1 reply; 6+ messages in thread
From: Jim Rogers @ 2002-08-16 19:44 UTC (permalink / raw)


Hyman Rosen wrote:

> For all those who have been arguing that Ada would be much
> more successful if it allowed the object.method() syntax,
> it might be interesting to check out some of the goings on
> in comp.lang.c++.moderated, in the 'Guru of the Week #84'
> threads. Many of the C++ cognoscenti are coming to the
> conclusion that the method(object) notation is superior,
> and indeed that as few functions as possible should be made
> methods of a class.
> 

I had been following this thread a while back.
It seems that one of the big issues in C++ is the use of
functions inherited from a template parameter. If the function
is part of a class the object.method() syntax is required while
the method(object) syntax is required if the function is not
part of a class. This causes genuine problems for C++.

The cognoscenti mentioned above have determined that the
method(object) syntax is the most general, and this leads to
the conclusion that functions should not be made members of
a class unless absolutely necessary.

My guess is that the C++ language will not be changed for this.
Instead, people will simply be advised to limit their use of
functions defined within a class.

I assume that this tends to weaken a design's OO nature. It will
result in a lot of basically global functions. This can result in
weaker encapsulation of data within classes, and many other such
problems.

Jim Rogers




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: OO dot notation
  2002-08-16 19:44 ` Jim Rogers
@ 2002-08-16 20:09   ` Hyman Rosen
  0 siblings, 0 replies; 6+ messages in thread
From: Hyman Rosen @ 2002-08-16 20:09 UTC (permalink / raw)


Jim Rogers wrote:
> I assume that this tends to weaken a design's OO nature.

Yes. But that's not a bad thing. OO is just a programming technique.

> It will result in a lot of basically global functions.

Yes, but with at least one parameter which is of a type whose
interface it is a part of. This ties it uniquely to that type
(or types) even if it's not a member. And you can choose to
put it in a namespace, and argument-dependent lookup will still
find it.

 > This can result in weaker encapsulation of data within classes,
 > and many other such problems.

No, because such global functions are written to the public interface
of the class, or are its friends. No data is exposed.




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2002-08-16 20:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-14 20:35 OO dot notation Hyman Rosen
2002-08-15  4:03 ` Pat Rogers
2002-08-15 16:05 ` Ingo Marks
2002-08-16 16:00   ` Warren W. Gay VE3WWG
2002-08-16 19:44 ` Jim Rogers
2002-08-16 20:09   ` Hyman Rosen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox