TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy

TEAM-ADA@LISTSERV.ACM.ORG

Options: Use Forum View

Use Monospaced Font
Show Text Part by Default
Condense Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Sender:
"Team Ada: Ada Advocacy Issues (83 & 95)" <[log in to unmask]>
Subject:
From:
Matthew Heaney <[log in to unmask]>
Date:
Sat, 6 Mar 1999 12:55:24 -0800
X-To:
Reply-To:
Matthew Heaney <[log in to unmask]>
Parts/Attachments:
text/plain (50 lines)
The following message is a courtesy copy of an article
that has been posted to comp.lang.ada,comp.object as well.

I have prepared a short article on how to implement the (virtual) proxy
pattern in Ada95, and posted it to the ACM patterns archive.  The
introduction of the article appears below.

<http://www.acm.org/archives/patterns.html>

I've been slowly converting the C++ examples in the book Design Patterns
to Ada95.  In each article I discuss the pattern, explain how to
implement it in Ada, and explore various idioms and language features.
A complete, working example with all the code is included.

You can subscribe to the patterns list (which is really growing these
days!) by sending a message with the body:

subscribe patterns <your full name>

to the ACM mailing-list server.

<mailto:[log in to unmask]>

Matt


Virtual Proxy Pattern

In this article I discuss how to implement the virtual proxy pattern in
Ada95.

Discussion

We'd like to optimize the amount of time it takes to open an image-rich
document.  The problem now is that every image in the file is getting
streamed in from disk and converted to its in-memory representation, and
this processing takes too long.

We can save start-up time by postponing initialization of an image until
it comes time to actually render it.  This technique is probably
familiar to those of you who have done X Windows programming.  Creating
every single dialog in the application up front can take a while, so you
wait until the user issues a pop-up request and just create the dialog
on-the-fly.

We perform this optimization by inserting image proxies in our document
instead of images.  An image proxy caches the information necessary to
initialize the image, but delays actual initialization until it receives
a request that can only be handled by the image itself.

ATOM RSS1 RSS2