comp.lang.ada
 help / color / mirror / Atom feed
From: "Jean-Pierre Rosen" <rosen@adalog.fr>
Subject: Re: Naming convention for classes?
Date: Wed, 4 Feb 2004 09:57:06 +0100
Date: 2004-02-04T09:57:06+01:00	[thread overview]
Message-ID: <ngcqvb.2ln.ln@skymaster> (raw)
In-Reply-To: MPG.1a8a2399b416094998968f@news.sover.net

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1942 bytes --]


"Peter C. Chapin" <pchapin@sover.net> a �crit dans le message de > Okay, so in other words either approach is considered acceptable
by the
> community at large. It's a matter of style. At least that's the
> impression I get from your reply. Does that sound like a fair
> assessment?
>
Since you said you were comming from a C++ background, let me explain some things you must understand first.

Ada has a so-called "building blocks" approach. Each feature provides a well-defined functionality, and the user builds the features
he needs by assembling those building blocks. For example, packages provide encapsulation. Derived types provide support for
inheritance. Tagged types provide support for dynamic dispatching.

Ada has no built-in concept of "Class" in the usual sense. If you consider that a class is an encapsulation with dynamic binding,
then a class in Ada is a design pattern where you just declare one tagged type inside a package. *For this design pattern*, it makes
a lot of sense to declare the package with the class name. A full discussion of this has been published in Ada Letters (Vol. XV,
n�2): "A naming convention for classes in Ada 9X". The paper can be downloaded from http://www.adalog.fr/publica2.htm. Note that
this convention works very well with "facets" generics, i.e. generics used to add properties to tagged types.

Now, this is not the only possible design pattern. For example, you can have the equivalent of "friends" in C++ by declaring two
tagged types in the same package. The previous notation is no more applicable to this pattern.

For more sophisticated use of building blocks/design pattern approach, look at "Ada, Interfaces and the Listener Paradigm", a paper
presented at Ada-Europe 2002 which is available from the same web page.

-- 
---------------------------------------------------------
           J-P. Rosen (rosen@adalog.fr)
Visit Adalog's web site at http://www.adalog.fr





  reply	other threads:[~2004-02-04  8:57 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-03 23:52 Naming convention for classes? Peter C. Chapin
2004-02-04  0:27 ` Jeffrey Carter
2004-02-04  2:31   ` Peter C. Chapin
2004-02-04  8:57     ` Jean-Pierre Rosen [this message]
2004-02-04 11:52       ` Peter C. Chapin
2004-02-04 14:02         ` Jean-Pierre Rosen
2004-02-05 12:18           ` Stuart Palin
2004-02-04 14:13         ` Martin Krischik
2004-02-04  9:13     ` Preben Randhol
2004-02-04 14:57     ` Georg Bauhaus
2004-02-04 19:01     ` Jeffrey Carter
2004-02-04  8:06 ` tmoran
2004-02-04 11:49   ` Peter C. Chapin
2004-02-04 12:36     ` Preben Randhol
2004-02-04 12:41       ` Preben Randhol
2004-02-04 14:09       ` Martin Krischik
replies disabled

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