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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,901038687c38f61c X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news.glorb.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!elnk-atl-nf1!newsfeed.earthlink.net!stamper.news.atl.earthlink.net!newsread3.news.atl.earthlink.net.POSTED!d9c68f36!not-for-mail From: Marin David Condic User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Idiom for a class and an object in Ada References: In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: Date: Tue, 19 Oct 2004 13:06:29 GMT NNTP-Posting-Host: 209.165.3.210 X-Complaints-To: abuse@earthlink.net X-Trace: newsread3.news.atl.earthlink.net 1098191189 209.165.3.210 (Tue, 19 Oct 2004 06:06:29 PDT) NNTP-Posting-Date: Tue, 19 Oct 2004 06:06:29 PDT Organization: EarthLink Inc. -- http://www.EarthLink.net Xref: g2news1.google.com comp.lang.ada:5451 Date: 2004-10-19T13:06:29+00:00 List-Id: Interesting, but I think it misses my question. In your first package: General_Classes - if you had 5 specific objects of type Class and they are totally static (something that exists from the moment you hit the first instruction to the moment the power goes down and you *really* need them to be in global memory) - where would you declare the five objects of type "Class" as you've defined it? How to do it is simple: Object_1 : General_Classes.Class ; Object_2 : General_Classes.Class ; Object_3 : General_Classes.Class ; Object_4 : General_Classes.Class ; Object_5 : General_Classes.Class ; In what context would you put those objects? MDC Martin Dowie wrote: >>Does anybody have an opinion or experience with doing this? I know >>what I've done in the past, but I'm curious if there is any preferred >>method or idiom for this in the OO paradigm as applied to Ada? > > > I tend to use Ward-Mellor RTSA/OOD as a method which leaves me with a number > of "project specific" processes on static data. But the data type also leads > to project specific classes (or ADT) which may be based on more general > classes (e.g. containers). e.g. > > package General_Classes is -- Most re-usable > type Class is private; > end General_Classes; > > with General_Classes; > package Project_Classes is -- Less re-usable > type Class is private; > procedure Process_1 (C : in out Class); > procedure Process_2 (C : in out Class; I : Integer); > private > type Class is new General_Classes.Class with ...; > end Project_Classes; > > package Project_Objects is -- Least re-usable > procedure Process_1; -- Each process maps to a RTSA process (or a UML > use-case) > procedure Process_2; > end Project_Objects; > > with Project_Classes; > package body Project_Objects is > Objects : Project_Classes.Class; -- Safely hidden data... > procedure Process_1 is ... > procedure Process_2 is ... > end Project_Objects; > > It maps requirements to design to code very well. > > $0.02 > > -- Martin > > > > --- > Outgoing mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.778 / Virus Database: 525 - Release Date: 15/10/2004 > > -- ====================================================================== Marin David Condic I work for: http://www.belcan.com/ My project is: http://www.jsf.mil/NSFrames.htm Send Replies To: m o d c @ a m o g c n i c . r "Power corrupts. Absolute power is kind of neat" -- John Lehman, Secretary of the Navy 1981-1987 ======================================================================