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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,4de6b22b920689,start X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!postnews.google.com!50g2000hsm.googlegroups.com!not-for-mail From: Anh Vo Newsgroups: comp.lang.ada Subject: Abstraction - How detail should it be Date: Mon, 08 Oct 2007 23:23:49 -0000 Organization: http://groups.google.com Message-ID: <1191885829.472181.229950@50g2000hsm.googlegroups.com> NNTP-Posting-Host: 209.225.224.254 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1191885829 749 127.0.0.1 (8 Oct 2007 23:23:49 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 8 Oct 2007 23:23:49 +0000 (UTC) User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.1.4322; InfoPath.1),gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: 50g2000hsm.googlegroups.com; posting-host=209.225.224.254; posting-account=ps2QrAMAAAA6_jCuRt2JEIpn5Otqf_w0 Xref: g2news2.google.com comp.lang.ada:2367 Date: 2007-10-08T23:23:49+00:00 List-Id: I have been reading "Concurrent and Real-Time Programming in Ada" by Alan Burns and Andy Wellings. By the way, I ordered it about little more than two months ago. When reading Semaphores on chapter 11 section 2 (11.2) I have noticed that semaphore abstraction seems too low level than it should be. In addition, it treats Signal and Wait as two separate abstractions as shown in the code below. type Signal_Interface is synchronized interface; procedure Signal (Sem : in out Signal_Interface) is abstract; type Any_Signal_Interface is access all Signal_Interface'Class; type Wait_Interface is synchronized interface; procedure Wait (Sem : in out Wait_Interface) is abstract; type Any_Wait_Interface is access all Wait_Interface'Class; type Semaphore_Interface is synchronized interface and Signal_Interface and Wait_Interface; type Any_Semaphore_Interface is access all Semaphore_Interface'Class; However, I think that semaphore abstraction is low enough, while operations Signal and Wait should operation on Semaphore Interface as demonstrated below. type Semaphore_Interface is synchronized interface; procedure Signal (Sem : in out Semaphore_Interface) is abstract; procedure Wait (Sem : in out Semaphore_Interface) is abstract; type Any_Semaphore_Interface is access all Semaphore_Interface'Class; I would like to know which of these two abstractions is preferred and why? Thanks. AV