comp.lang.ada
 help / color / mirror / Atom feed
From: jerry@jvdsys.stuyts.nl (Jerry van Dijk)
Subject: Re: ANNOUNCE: Abstract Factory posted to ACM patterns archive
Date: 1999/03/08
Date: 1999-03-08T00:00:00+00:00	[thread overview]
Message-ID: <F8AMEq.C4@jvdsys.stuyts.nl> (raw)
In-Reply-To: m3u2vw1fbx.fsf@mheaney.ni.net

Matthew Heaney (matthew_heaney@acm.org) wrote:

: "Factory" just has its common meaning: an abstraction that you use to
: create other abstractions.  This is why it falls under the rubric of
: "creational patterns."  Different factories create different items.

As I recall from the GoF book, my impression (also stated somewhere,
I believe) was that one of the essentials was using construction instead
of inheritance as the main design principle. The implementation of the
idea seems to be decoupling through dispatching and access types. Looking
at your example, I see:

:   type Root_Hamburger_Type (<>) is abstract tagged limited private;
:   type Hamburger_Access is access all Root_Hamburger_Type'Class;
:   function New_Hamburger return Hamburger_Access;
:   function New_Hamburger return Hamburger_Access;
:   Hamburger : constant Hamburger_Access := Factory.New_Hamburger;

With other words, pointers seem to be the essential tool for using this
design method. Although the thinking behind the pattern idea is powerful by
its rigid application, whenever I try to apply it, I end up with programs
that seem to become impregnable through the heavy use of indirection, 
overloading and dispatching. Gone is the "clear and elegant" (for lack of
better wording) ADT based structure I like so much in Ada. 

Now, it could be that this is indeed true, but I rather suspect that I
made a wrong turn somewhere. Anyone who has been there, and solved this
problem ? 

--
-- Jerry van Dijk | Leiden, Holland
-- Team Ada       | jdijk@acm.org
-- see http://stad.dsl.nl/~jvandyk




  reply	other threads:[~1999-03-08  0:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-03-04  0:00 ANNOUNCE: Abstract Factory posted to ACM patterns archive Matthew Heaney
1999-03-04  0:00 ` dennison
1999-03-04  0:00   ` Peter Milliken
1999-03-08  0:00   ` Matthew Heaney
1999-03-08  0:00     ` Jerry van Dijk [this message]
1999-03-09  0:00       ` fraser
1999-03-09  0:00       ` Matthew Heaney
2011-10-14 18:51 ` Rego, P.
2011-10-14 19:29   ` Simon Wright
2011-10-14 19:56     ` Rego, P.
replies disabled

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