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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,3987b6b9a0fadf2c X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1995-03-11 23:00:56 PST Path: bga.com!news.sprintlink.net!howland.reston.ans.net!swrinde!news.uh.edu!uuneo.neosoft.com!Starbase.NeoSoft.COM!not-for-mail From: smize@Starbase.NeoSoft.COM (Samuel Mize) Newsgroups: comp.lang.ada Subject: Re: HELP-Information hiding/Abstraction (explain difference please) Date: 12 Mar 1995 00:50:10 -0600 Organization: NeoSoft Internet Services +1 713 968 5800 Message-ID: <3ju5j2$73q@Starbase.NeoSoft.COM> References: NNTP-Posting-Host: starbase.neosoft.com Date: 1995-03-12T00:50:10-06:00 List-Id: In article , Jacky wrote: >Could someone please explain the difference between >information hiding and data abstraction - Is there one? > >I would be grateful for any simple small pieces of code that >help show the difference. ----------------------------------------------------------- Data abstraction: package Abstractions is type Stoplight_Color is (Red, Yellow, Green); type Person is record Age: integer; -- Lots more fields full of data -- but you can handle -- a person as a single, higher-level item. -- -- The concept "person" is abstracted. -- -- The information is NOT hidden -- a end record; end Abstractions; ----------------------------------------------------------- Information hiding: package Hidden_Info is type Person is private; -- specs for procedures and functions on Person given here private type Person is record Age: integer; -- Lots more fields full of data -- but you can handle -- a person as a single, higher-level item. -- -- The concept "person" is abstracted. -- -- The information is HIDDEN -- someone using this package -- CANNOT access the record fields. The user MUST user -- the provided procedures and functions. end record; end Abstractions; ----------------------------------------------------------- As a rule of thumb, information hiding is used to enforce data abstractions. Any time you create a user-defined type, you are defining a data abstraction. Any time you avoid putting implementation details into the visible specification of a package, you are using information hiding. Samuel Mize - smize@starbase.neosoft.com