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=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,9b75d36fda92b3ba X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!130.59.10.21.MISMATCH!kanaga.switch.ch!news-zh.switch.ch!switch.ch!cernne03.cern.ch!cern.ch!news From: Maciej Sobczak Newsgroups: comp.lang.ada Subject: Re: Using Ada (or SPARK) in Ada-unaware environment Date: Thu, 19 Jan 2006 16:45:48 +0100 Organization: CERN - European Laboratory for Particle Physics Message-ID: References: NNTP-Posting-Host: abpc10883.cern.ch Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sunnews.cern.ch 1137685547 17935 (None) 137.138.37.241 X-Complaints-To: news@sunnews.cern.ch User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20050922 Red Hat/1.7.12-1.1.3.2.SL3 X-Accept-Language: en-us, en In-Reply-To: Xref: g2news1.google.com comp.lang.ada:2537 Date: 2006-01-19T16:45:48+01:00 List-Id: Steve wrote: >>2. Write separate programs in C (or C++) that will be responsible only for >>talking to the devices via their C access libraries. Write the main >>controller in Ada, as another separate program, and use some form of >>interprocess communication to have all those components talk. >> >>The advantage of the second option is that the controller part can be >>easily tested in isolation or in a fake environment. > > Please explain why it is easier to test the the control part in isolation or > in a > fake environment in C than in Ada. > This is not obvious to me. I wrote that the control part would be written in Ada, not in C. The "isolation" means that the control part would not be in any way dependent on the device-related libraries or interfaces, so that it could be possible to just take the control program to some other machine (where the devices are not available) and run it there with fake stubs, without the need to recompile nor relink anything. > BTW: Tools are available to assist in creating Ada interfaces to C > libraries. The controller is not likely to need everything that the driver library provides, which means that it makes sense to wrap the whole thing into something that exposes simpler and safer abstractions - those which are actually needed. This means that automated conversion of C interfaces to Ada interfaces might not be optimal. This wrapper for the device library can be either a module or a separate program. Separate program makes sense, because can be accessed also by other controllers, which do not even need to be written in Ada (think about scripting tools). This total breaking of the system into independent processes can allow me to easily exchange parts, test them in separation and reuse in different environments (including script tools) - that's why I would lean toward this solution, but I wanted to know your opinions on the subject. -- Maciej Sobczak : http://www.msobczak.com/ Programming : http://www.msobczak.com/prog/