comp.lang.ada
 help / color / mirror / Atom feed
From: "Matthew Heaney" <matthew_heaney@acm.org>
Subject: Re: Hi all. Novice question.
Date: 1999/09/04
Date: 1999-09-04T00:00:00+00:00	[thread overview]
Message-ID: <37d0f836@news1.us.ibm.net> (raw)
In-Reply-To: 37D0D701.90F1B6F0@interact.net.au

In article <37D0D701.90F1B6F0@interact.net.au> , G <Dizzy@interact.net.au>
wrote:

> I am interested in designing simulations.  I have a philosophical
> interest in ontology (the study of being and existence) ...

Me too.  I also have an interest in the philosophy of science, especially
now because of those creationist pinheads in Kansas.

> ... and I believe that this relates to entities and objects in programming.

Indeed it does.

Actually, biology relates to programming too.  The study of evolution of
natural systems (Darwinian theory) can be most helpful in understanding the
evolution of artificial systems, especially large, complex software systems.
Manny Lehman wrote a whole book on the subject.

But the programmers who grow up in Kansas will never know this, because
those idiots on the Kansas State Board of Education decided that Darwinian
evolutionary theory doesn't need to be taught!

> I am a novice... so please do not shoot me down in flames for doing something
> completely anathema to ada principles.

I'll be nice.  ;^)

>    package M1A2_Abrams is
>
>       private type M1A2_Abrams;

This should be

   type M1A2_Abrams_Type is private;
   -- if you want assignment, i.e. Tank_1 := Tank_2

or

   type M1A2_Abrams_Type is limited private;
   -- if you don't want assignment

or

   package Tanks is

      type Root_Tank_Type is abstract tagged limited private;

   end Tanks;

   package Tanks.M1A2_Abram is

      type Tank_Type is new Root_Tank_Type with private;


However, you're going to have declare the full view of the type in the
private region of the spec:

   package M1A2_Abrams is

      type Tank_Type is limited private;

      <tank ops = "things you can tell a tank to do">

   private

      type Tank_Type is
         limited record
            <tank attributes>
         end record;

   end M1A2_Abrams;


>    end M1A2_Abrams;
>
> -------------------------------
>
> package body M1a2_Abrams is
>
>    type Physical_Specification is new Float;
>
>    type Weapon_Specification is (M256_120_00mm_Smooth_Bore_Cannon,
>       M240_7_62mm_Machine_Gun, M240_7_62mm_Machine_Gun_Skate_Mount,
>       M2_0_50mm_Machine_Gun);
>
>    type Mobility_Specification is new Float;
>
>    type Engine is (Gas_Turbine);
>
>    type Transmission is (Hydro_Kinetic);
>
>    type Misc_Parameters is (Nbc_System);
>
>    type Crew is new Integer;

All these supplementary types should probably go in the somewhere in the
spec.

>    -- Type => M1a2 Abrams
>    type M1a2_Abrams is
>    record
>       -- Type => Physical_Specification.
>       Weight : Physical_Specification := 69.54;             -- tons
>       Length_Gun_Forward : Physical_Specification := 387.0; -- inches
>       Turret_Height : Physical_Specification := 93.5;       --
>       Width : Physical_Specification := 144.0;              --
>       Ground_Pressure : Physical_Specification := 15.4;     -- PSI
>       Power_Weight_Ratio : Physical_Specification := 21.6;  -- hp/ton
>
>       -- Type => Weapon_Specification.
>       Main_Armament : Weapon_Specification :=
> M256_120_00mm_Smooth_Bore_Cannon; -- 120 mm
>       Coaxial_Weapon : Weapon_Specification :=
> M240_7_62mm_Machine_Gun;         -- 7.62 mm
>       Loaders_Weapon : Weapon_Specification :=
> M240_7_62mm_Machine_Gun_Skate_Mount;
>       Commanders_Weapon : Weapon_Specification :=
> M2_0_50mm_Machine_Gun;        -- .50 mm
>
>       -- Type => Mobility_Specification.
>       -- Conversion to metric pending.
>       Maximum_Speed : Mobility_Specification := 42.0;        -- 42.0 mph
> (Governed)
>       Cross_Country_Speed : Mobility_Specification := 30.0;  -- mph
>       Speed_10pc_Slope : Mobility_Specification := 17.0;     -- mph
>       Speed_60pc_Slope : Mobility_Specification := 4.1;      -- mph
>       Acceleration_0_To_20 : Mobility_Specification := 7.2;  -- seconds
>       Cruising_Range : Mobility_Specification := 265.0;      -- miles
>       Obstacle_Crossing : Mobility_Specification := 42.0;    -- inches
>       Vertical_Trench : Mobility_Specification := 9.0;       -- feet
>
>       -- Type => Engine.
>       M1a2_Engine : Engine := Gas_Turbine;
>
>
>       -- Type => Transmission.
>       M1a2_Transmission : Transmission := Hydro_Kinetic;
>
>       -- Type => Misc_Parameters.
>       M1a2_Air_Control : Misc_Parameters := Nbc_System;  -- Clean,
> cooled air
>
>       -- Type => Crew.
>       M1a2_Crew : Crew := 4;
>
>    end record;


This looks like it should go in the private part of the spec.

> end M1a2_Abrams;

> I am teaching myself this stuff, so understand that before you grill me.
> Any feedback is useful.  Can an object be defined as a record like this and --
> does it make sense to do so (?).

You should probably spend a few hours with an Ada tutorial.  Try Lovelace,
or some other one.  They're all available at the adahome and adapower pages;
just follow the tutorial links.

<http://www.adahome.com/>
<http://www.adapower.com/>

--
Matt

It is impossible to feel great confidence in a negative theory which has
always rested its main support on the weak points of its opponent.

Joseph Needham, "A Mechanistic Criticism of Vitalism"




  reply	other threads:[~1999-09-04  0:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-09-04  0:00 Hi all. Novice question G
1999-09-04  0:00 ` Matthew Heaney [this message]
1999-09-07  0:00   ` Idiots (was Re: Hi all. Novice question.) Mark Lundquist
1999-09-08  0:00     ` Marin David Condic
1999-09-07  0:00 ` Hi all. Novice question Nick Roberts
1999-09-08  0:00   ` Hi all. Novice question. from an idiot G
1999-09-08  0:00     ` Preben Randhol
replies disabled

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