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 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: "Jeffrey R. Carter" Newsgroups: comp.lang.ada Subject: Re: accessibility check failed Date: Sun, 29 Nov 2015 19:04:20 -0700 Organization: Also freenews.netfront.net; news.tornevall.net; news.eternal-september.org Message-ID: References: <3d45e3ed-16ca-4018-bf7b-62830acaca03@googlegroups.com> <44e20a95-703c-4316-8dda-aa2c8d07dfb1@googlegroups.com> <29d3244c-1769-4cb7-8af3-e1b20eb2e1e2@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Injection-Date: Mon, 30 Nov 2015 02:01:58 -0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="caa759af2a9c666aec02942f6fe5abd6"; logging-data="26083"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+GhejXT6ltYXx4c7igocD6ELnc698AbB0=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 In-Reply-To: <29d3244c-1769-4cb7-8af3-e1b20eb2e1e2@googlegroups.com> X-Mozilla-News-Host: news://freenews.netfront.net Cancel-Lock: sha1:XuTdwu6vUesJ9IOXeSKELk3aBoQ= Xref: news.eternal-september.org comp.lang.ada:28601 Date: 2015-11-29T19:04:20-07:00 List-Id: 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