datasheets.com EBN.com EDN.com EETimes.com Embedded.com PlanetAnalog.com TechOnline.com  
Events
UBM Tech
UBM Tech

Design Article

Comment


Mario Blunk

4/3/2012 9:17 AM EDT

Hi there,
I'm about to begin programming in a language other than assembly ...

More...



John Smith

2/7/2012 5:07 AM EST

This is a very valuable post, I found it looking through Google. I believe most ...

More...

High-integrity object-oriented programming with Ada - Part 1

Benjamin M. Brosgol, Senior Software Engineer, AdaCore

7/20/2011 8:11 PM EDT

Operation Overriding
Operation Overriding
Inheritance in object-oriented languages makes possible two kinds of programming errors in connection with operation overriding:

  • Declaring a new or overloaded operation when overriding was intended
  • Overriding an operation when a new one was intended

The first issue typically arises from a misspelling of the name of the operation that is supposed to be overridden. The second issue can arise when an operation is added to a superclass. If a subclass happened to declare an operation with a matching signature, then recompilation of the subclass will cause this declaration to be treated as overriding. In either case, dynamic binding will not give the expected result.

An object-oriented language’s susceptibility to these vulnerabilities depends on whether it provides explicit syntax, to be checked by the compiler, identifying the programmer’s intent as to whether a declaration is to be regarded as overriding.

Multiple Inheritance
Two major vulnerabilities are associated with multiple inheritance. In the case of multiple interface inheritance, if two interfaces contain an identical method signature, a (non-abstract) class that inherits from these interfaces will need to provide a single implementation for both. However, the intent (contracts) of the methods in the two interfaces may be completely unrelated, raising the issue of how one implementation can work for two different purposes. Similarly, and depending on the language’s rules for operation overloading, two interfaces may contain operation signatures such that it is impossible to inherit from both.

In the case of multiple implementation inheritance, several semantic issues complicate traceability analysis and software verification:

  • Name clashes, in which operations with the same signature or fields with the same name are inherited from multiple superclasses.
  • “Diamond inheritance,” in which a root class RC has subclasses C1 and C2 which are in turn superclasses of C3, raising the issue of what C3 inherits indirectly from RC.

These are not necessarily fatal flaws — languages supporting multiple inheritance will define the semantics for these features — but they do add complexity in terms of both human understanding and formal certification.

Other issues
A number of additional language features are often used in conjunction with OOP, so their vulnerabilities and certification-related issues are relevant. These features include parametric polymorphism (generic templates), overloading (using the same name for different program entities, in particular for different operations), type conversion, exception management, and virtualization (use of an intermediate execution platform such as a JVM). These aspects fall outside the scope of this article. For more information, see reference 3.

OOP clearly brings expressive power and flexibility, but can also introduce a range of vulnerabilities. Their impact on the development of high-integrity software depends on the programming language used and the language’s semantics for specific OOP features. Ada offers a distinctive approach, simplifying compliance with the new guidance in DO-178C. The language’s underlying support for reliable, safe, and secure programming fits in smoothly with OOP. Ada’s OOP features are being used in software certified at the highest level of safety criticality, and the upcoming Ada 2012 standard further enhances the language’s OOP support.

Look for Part 2 and Part 3 of this article in coming weeks, discussing Ada semantics and how the language addresses the various OOP vulnerabilities described above.

References
1. RTCA SC-167 / EUROCAE WG-12. DO-178B – Software Considerations in Airborne Systems and Equipment Certification; December 1992.
2. RTCA SC-205. DO-178C – Software Considerations in Airborne Systems and Equipment Certification. Draft IP 50, Rev X; 2011.
3. RTCA SC-205. Object-Oriented Technology Supplement to DO-178C and DO-278A. Draft IP0060_O; 2011.
4. B. Liskov and J. Wing. "A behavorial notion of subtyping," ACM Transactions on Programming Languages and Systems (TOPLAS), Vol. 16, Issue 6 (November 1994), pp. 1811-1841.

Related articles

Automating rule sets for safety-critical HDL coding
Cut the cost of code development with traceability tools
Developing secure code using SPARK
MILS architecture simplifies design of high-assurance systems
Case study: Threat simulation for multi-port radar and electronic warfare systems
HiRel for space
Addressing obsolescence with hardware abstraction layers
Leakage-resistant protocols protect high-security applications
Designing automatic test systems for extended duty
Choosing test equipment for high-speed digital I/O in mil/aero applications
ATML standard simplifies test equipment data exchange
Modular platforms support automated test for mil/aero applications
EMI and transient protection for MIL-compliant systems

About the Author
Benjamin Brosgol is a senior member of the technical staff of AdaCore. He has been involved with programming language design and implementation for more than thirty years, concentrating on languages and technologies for high-integrity systems. He was a distinguished reviewer of the original Ada language specification and a member of the design team for the Ada 95 revision.


Did you find this article of interest? Then visit Military & Aerospace Designline, where we update daily with design, technology, product, and news articles tailored to fit your world. Too busy to go every day? Sign up for our newsletter to get the week's best items delivered to your inbox. Just click here and choose the "Manage Newsletters" tab.





EREBUS

7/21/2011 4:09 PM EDT

It is a shame that more software people did not understand or use the benefits of Ada. I understand the desire to get to the coding quickly, but from my observations over the last 30 years, you get much better software faster with Ada then you will ever get from C or C++.

A major part of this failure lies with managers who want to see instant results rather than see a well thought out software design. If you build code without a good design, you get bad software. Many managers do not understand the true issues involved with software engineering versus coding. Coding is about 5% of the job.

I really liked the real-time support built into Ada. I have seen it implemented for complex real time avionics software and it does a very good job.

Hopefully, we can get some solid Ada compilers for the microcontroller market. The cost to generate good solid firmware would be greatly reduced.

Ada is an excellent way to build software. The problem is that it requires the developers to think before they code. Sadly, most are too undisciplined to take the time to build software correctly.

Oh well, maybe someday.

Thanks

Sign in to Reply



cdhmanning

7/25/2011 10:08 PM EDT

From what I've seen, Ada is just too limited to be completely useful for general embedded development.

Ada might be good for writing some parts of the code, but not all. It is hard to partition many systems into stuff to be written in Ada and stuff that should not.

Ada seems particularly unsuited to writing device drivers, interrupt service routines and such.

You can get GNAT for ARM and even AVR.

Sign in to Reply



UncleFin

7/26/2011 10:58 AM EDT

I am not sure what "general embedded development" is, but the orgainization I belong has used Ada as the primary language for many of our avionic systems - ranging from small high integrity controllers to flight management systems.

Sign in to Reply



cdhmanning

7/27/2011 10:46 PM EDT

I can write a complete system in C, with a few lines of assembler for the start up code etc.

Can you do that in Ada? From what I've seen Ada RTEs are written in C or such because Ada isn't flexible enough.

Sign in to Reply



Powernine

10/24/2011 10:39 AM EDT

About being adequate for general and embedded development you can do in ADA what you can do in C (eg bit manipulation) except that it is safer and cleaner. You can aslo do things you cannot do in C like controlling the address a variable is stored in. In C you have to use pointers and lose all "compiler protection". In Ada you can do like that but haven't to and shouldn't to.

About RTEs the reason is because ADA vendors cut costs by using preexisting libraries and these are, unfortunately because they are a source of bugs, in C.

Sign in to Reply



Aaron451

8/4/2011 5:30 PM EDT

I used Ada '83 for several years do hard-realtime software (motor control) with great success. Now I do the same thing in 'C' and with for the Ada tools. It took a bit of time to learn, but once I got it down coding went fast and debugging was almost an after-thought. AND REAL code reuse was in the 80% range from project to project.

Sign in to Reply



Dixy3

7/21/2011 8:43 PM EDT

EREBUS, I totally agree with you, managers are always looking to cut corners to save on costs rather than have the best quality code for the job. Ada as a lot to offer given time for programmers to develop good code without additional pressure from their managers to complete the programming job like yesterday. May be it is time for someone to write a free Ada IDE for microprocessors like ARM and Arduino so developers and programmers can play at home on development boards and then start to use Ada at work in a more commercial environment? Ada I think would also be ideal for areospace nano satellites like CubeSats given the chance to develop it.

Sign in to Reply



Niklas Holsti

7/24/2011 2:59 PM EDT

Links in reply to Dixy3:

GNATDroid, a version of the GNU Ada compiler GNAT for Android: http://www.dragonlace.net/

AVR-Ada, a version of GNAT for the Atmel AVR chips: http://sourceforge.net/projects/avr-ada.

and the trump: an Ada compiler that generates C code and thus targets any system that has a C compiler: http://www.sofcheck.com/products/adamagic.html

The AdaMagic compiler is being used for a CubeSat project, I believe.

Sign in to Reply



cdhmanning

7/27/2011 11:14 PM EDT

If you really want to play, there's Ada for Lego Mindstorms robots...

http://libre.adacore.com/libre/tools/mindstorms/

Free download.

This runs on a small ARM micro and should be readily portable to other small ARM systems.

The Mindstorms Ada environment seems to use the Lejos code as its underpinnings. That is written in C.



Sign in to Reply




John Smith

2/7/2012 5:07 AM EST

This is a very valuable post, I found it looking through Google. I believe most readers will agree with your views. Finally – a person with common sense!

http://www.zuneauto.com

Sign in to Reply



Mario Blunk

4/3/2012 9:17 AM EDT

Hi there,
I'm about to begin programming in a language other than assembly and shell programming. I'm also used to code hardware designs in Verilog HDL.
So I'm asking myself whether it is useful for me to start right with ADA and ignoring all the C/C++/Java... My mind has not been "spoiled" with this stuff :-) So what do you guys recommend ?

Sign in to Reply



Please sign in to post comment

Navigate to related information

Datasheets.com Parts Search

185 million searchable parts
(please enter a part number or hit search to begin)