comp.lang.ada
 help / color / mirror / Atom feed
From: fraser@sinopsis.com
Subject: Re: ANNOUNCE: Abstract Factory posted to ACM patterns archive
Date: 1999/03/09
Date: 1999-03-09T00:00:00+00:00	[thread overview]
Message-ID: <7c3mq2$ns$1@remarQ.com> (raw)
In-Reply-To: F8AMEq.C4@jvdsys.stuyts.nl

paene lacrimavi postquam jerry@jvdsys.stuyts.nl (Jerry van Dijk) scribavit:

>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. 

I had no idea I was using a factory when I designed a symbol table class,
but there you go.  I have a root class, with abstract versions of Insert,
First, Next, Exists, that sort of thing.  Actually, there's another
hierarchy of constraint objects that let you search for more specific
things, but anyway.  Currently, there are two derived types; one for
a hashed symbol table, and one for a linked list table.  Once you've
created a table using the appropriate function in the child package,
you don't need to worry about which version you're using, which makes
using it much nicer.

Certainly, they're implemented as access types, but I found that Ada 95's
support for this paradigm made that practically invisible.  In fact, it
*is* invisible.  Consider:

   T  : Table := Tables.Hashed.New_Table ( ... );
   E  : Table_Entry;
   Insert (T, E);
   E := First (T, "x");
   E := Next (T, "x");

Sure, there's a "type Table is access all Root_Table_Type'Class" in one
of the specs, but the only thing you have to know is that Table is
declared somewhere.

Dispatching is obviously essential to the way this works, but I don't
see how you use the Factory pattern without it.

Fraser.
(change the i's to y's to get my real email address)




  parent reply	other threads:[~1999-03-09  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
1999-03-09  0:00       ` Matthew Heaney
1999-03-09  0:00       ` fraser [this message]
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