comp.lang.ada
 help / color / mirror / Atom feed
From: tmoran@acm.org
Subject: Re: Naming conventions
Date: Thu, 25 Jul 2002 03:11:24 GMT
Date: 2002-07-25T03:11:24+00:00	[thread overview]
Message-ID: <w%J%8.28494$mz5.80266478@newssvr14.news.prodigy.com> (raw)
In-Reply-To: 3D3F58F4.9050305@hotmail.com

> Coming from C++, what I used to think of as a class (a type and its
> associated methods) is now roughly equivalent to a package.
  No no!  Abjure such incorrect ideas!  An Ada "type ...  is ..."
and its associated ("primitive") methods is indeed a type.  A package
is at a higher level.  It may have no types at all (consider a
trigonometry function library), just one type, a couple of highly
related types, or even private types for internal use only.  Thus a
single package might contain a root bitmap type as well as child
Monochrome, VGA, Truecolor, etc types.  Or it might have both Socket
and Server types.

> I've been appending '_Type' to the package names, making names like
> Vector_Type, but I don't think that is the Right Thing(TM).
  Definitely not the Right Thing.  Try a package named Sound with
a type named Clip_Type and procedures
Play(X : in Clip_Type)
Record(X : out Clip_Type; Time : in Duration);
  Perhaps you also have a second package named Video with its own
Clip_Type, Play, and Record.
  Then when you use the packages you will have things like
Oh_Tannenbaum,
Noise_In_The_Night : Sound.Clip_Type;
Ghost_Picture : Video.Clip_Type;
  ...
Sound.Play(Oh_Tannenbaum);
  ...
if Motion_Detected then
  Sound.Record(Noise_In_The_Night, 60.0);
  Video.Record(Ghost_Picture, 60.0);
end if;

> and I've seen a little bit of calling the type simply Instance or Object.
  An instance or object is a single manifestation of a particular type.
eg, Apple_Count, Orange_Count, Back_Camera, or Front_Camera in
Apple_Count,
Orange_Count : Integer;
Back_Camera, Front_Camera : Security_Camera_Type;

>http://www.informatik.uni-stuttgart.de/ifi/ps/ada-doc/style_guide/cover.html
I think that's the "Ada Quality and Style" guide, which is good, and
which will not, I think, lead you astray (although I can't seem to
connect to the web site at the moment).



  parent reply	other threads:[~2002-07-25  3:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-25  1:48 Naming conventions Ryan Tarpine
2002-07-25  2:51 ` Ted Dennison
2002-07-25  3:11 ` tmoran [this message]
2002-07-25  4:28 ` SteveD
2002-07-25 11:50 ` David C. Hoos, Sr.
2002-07-25 15:20 ` Stephen Leake
2002-07-25 16:24   ` Jean-Pierre Rosen
  -- strict thread matches above, loose matches on Subject: below --
1987-11-13 23:10 Michael.Rissman
replies disabled

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