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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 Path: border1.nntp.dca3.giganews.com!border2.nntp.dca3.giganews.com!border4.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!feeder02.blueworldhosting.com!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!aioe.org!.POSTED!not-for-mail From: =?utf-8?Q?Yannick_Duch=C3=AAne_=28Hibou57?= =?utf-8?Q?=29?= Newsgroups: comp.lang.ada Subject: Re: Vocabulary matter: Component vs Element vs Item Date: Thu, 25 Jul 2013 22:12:12 +0200 Organization: Ada @ Home Message-ID: References: NNTP-Posting-Host: ds8m8HfAx594C0h4s/JFyA.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes Content-Transfer-Encoding: Quoted-Printable X-Complaints-To: abuse@aioe.org User-Agent: Opera Mail/12.16 (Linux) X-Notice: Filtered by postfilter v. 0.8.2 X-Original-Bytes: 3730 Xref: number.nntp.dca.giganews.com comp.lang.ada:182676 Date: 2013-07-25T22:12:12+02:00 List-Id: Le Thu, 25 Jul 2013 21:01:38 +0200, Simon Wright a = = =C3=A9crit: > "Yannick Duch=C3=AAne (Hibou57)" writes: > >> All three words "component", "element" and "item" could be seen as >> interchangeable in plain English (or am I wrong?). > > I have a feeling that in English (BrE) "component" and "element" are > more-or-less synonymous, but "item" isn't. "The solution to the proble= m > has five Xs" - X could be component or element, but not item; an item = is > a thing on its own, whereas a component or an element is one of many. Sounds correct. > So I think that the Ada Containers match this notion: a container can > have elements (of element_type, eeew), and you replace one of them by = an > item. > > I see that the Booch Components have this the other way round: > > procedure Insert (C : in out Abstract_Collection; Elem : Item) > is abstract; After your note above, I now less feel it's an issue to mix both in a sa= me = domain (or package, to speak Ada). Remains the case you point with the = swapped choice made in the Booch Components. May be a way to solve it, is to have an Element_Type which is a subtype = = (as a type aliasing) of Item_Type. This would allow to have both mixed = case while having consistency between an argument name and its type (the= re = are cases where it's better to simply name a thing after its type). Would look like this sample: type Instance_Type is =E2=80=A6; type Index_Type is =E2=80=A6; type Item_Type is =E2=80=A6; subtype Element_Type is Item_Type; -- Item_Type is defined first and -- Element_Type is a subtype of it, -- because Item_Type is defined -- independently of what will hold -- it. It exists as an item before -- it can become an element. procedure Append (Target : in out Instance_Type; Element : Element_Type); -- To the object receiving it, -- and which will hold it, -- it's an element. function Item (This : Instance_Type; I : Index_Type) return Item_Type; -- To the client receiving it, -- and which will hold it, -- it's first an item (may -- become an element later -- to it too). Looks OK to me as I look at it. I believe I will opt for this convention= . Thanks for your not Simon. And Jeffrey too :-P (for the idea to look = somewhere else) -- = =E2=80=9CSyntactic sugar causes cancer of the semi-colons.=E2=80=9D [1] =E2=80=9CStructured Programming supports the law of the excluded muddle.= =E2=80=9D [1] [1]: Epigrams on Programming =E2=80=94 Alan J. =E2=80=94 P. Yale Univers= ity