comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeffrey R. Carter" <spam.jrcarter.not@spam.not.acm.org>
Subject: Re: accessibility check failed
Date: Sun, 29 Nov 2015 19:04:20 -0700
Date: 2015-11-29T19:04:20-07:00	[thread overview]
Message-ID: <n3gamk$pf3$1@dont-email.me> (raw)
In-Reply-To: <29d3244c-1769-4cb7-8af3-e1b20eb2e1e2@googlegroups.com>

On 11/29/2015 03:53 PM, Serge Robyns wrote:
> 
> In my case I'm trying to build an interface to hide implementation details.
> The code provided is using containers as a store but should also be able to
> use any kind of (R)DBMS for all or part of the data.  And hence this is where
> the beauty of OO comes but does indeed require to use access type to "keep"
> track of things.

There's nothing beautiful about code that is harder to understand than it has to
be. And little is uglier than pkgs that force their clients to use access types.

My rules for access types:

1. Don't use them
2. If you think you need them, think again
3. If you still think you need them, see if you can use an existing abstraction
(such as containers) to avoid them
4. If you still think you need them, encapsulate and hide them

> I admit I'm trying to implement some patterns that typically relies on
> "references".  What would be the alternative to a Bridge pattern.

Some of the gnag-of-4 design patters are ways to work around the limitation of
the languages used. An example is the singleton pattern, which is a work around
for the lack of modules. In Ada, it's simply a pkg. I'm not familiar with the
bridge pattern, but Wikipedia says it's for decoupling an abstraction from its
implementation. Such decoupling allows the implementation to change without
impacting the rest of the system, and is the reason for information hiding. In
Ada, information hiding is provided by pkgs. The abstraction is represented by a
pkg spec and its implementation is in the body. The body can change without
impacting the rest of the system. For example, the implementation can change
from storing things in a container to storing them in a disk-based DBMS.

References are often needed, but they often need not be access values.

-- 
Jeff Carter
"Ah, go away or I'll kill ya."
Never Give a Sucker an Even Break
100

  reply	other threads:[~2015-11-30  2:04 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-29 18:03 accessibility check failed Serge Robyns
2015-11-29 18:37 ` Jeffrey R. Carter
2015-11-29 19:00   ` Serge Robyns
2015-11-29 22:32     ` Jeffrey R. Carter
2015-11-29 22:53       ` Serge Robyns
2015-11-30  2:04         ` Jeffrey R. Carter [this message]
2015-11-30 23:22         ` Randy Brukardt
2015-12-01  9:38           ` Serge Robyns
2015-11-29 19:15 ` Dmitry A. Kazakov
2015-11-29 22:40 ` Serge Robyns
2015-12-01 20:17 ` sbelmont700
  -- strict thread matches above, loose matches on Subject: below --
2014-08-11  2:12 Accessibility " hreba
2014-08-11  5:32 ` Jeffrey Carter
2014-08-11 16:45   ` hreba
2014-08-11 16:55     ` Jeffrey Carter
2014-08-12 11:57       ` hreba
2014-08-11 19:56 ` sbelmont700
2014-08-11 20:17   ` Jeffrey Carter
2014-08-11 20:28     ` sbelmont700
2014-08-11 21:14       ` Jeffrey Carter
replies disabled

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