comp.lang.ada
 help / color / mirror / Atom feed
From: Maciej Sobczak <no.spam@no.spam.com>
Subject: Re: Using Ada (or SPARK) in Ada-unaware environment
Date: Thu, 19 Jan 2006 16:45:48 +0100
Date: 2006-01-19T16:45:48+01:00	[thread overview]
Message-ID: <dqoc7b$hgf$1@sunnews.cern.ch> (raw)
In-Reply-To: <HoydnbihfPkmNVLenZ2dnUVZ_v6dnZ2d@comcast.com>

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/



  reply	other threads:[~2006-01-19 15:45 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-19  9:05 Using Ada (or SPARK) in Ada-unaware environment Maciej Sobczak
2006-01-19 10:16 ` Niklas Holsti
2006-01-19 10:21 ` Peter Amey
2006-01-19 20:05   ` Jeffrey R. Carter
2006-01-20  5:08   ` tmoran
2006-01-19 15:00 ` Steve
2006-01-19 15:45   ` Maciej Sobczak [this message]
2006-01-19 20:26     ` Simon Wright
2006-01-20  0:50 ` John
replies disabled

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