AeroCoder
Open the tools

DO-178C HANDBOOK · CONTENTS

DO-178C HANDBOOK

/

Tools & Other Supplements

Object-Oriented Technology (DO-332)

Inheritance, dynamic dispatch, memory management and the vulnerabilities DO-332 targets.

Desk summary

  • 01DO-332 is the supplement for object-oriented technology and related techniques (OOT&RT). It adds to DO-178C; it never replaces it.
  • 02The “related techniques” — overloading, type conversion, exception management, dynamic memory, generics and virtualization — appear in non-OO code too, so DO-332 can apply even to a C or Ada project.
  • 03Its central idea is type safety via the Liskov Substitution Principle: any subclass must be usable wherever its parent is expected, so verification of the parent still holds.
  • 04Two new verification objectives: verify local type consistency and verify that dynamic memory management is robust (Table OO.A-7).
  • 05Annex OO.D lists vulnerabilities for each key feature; your plans and standards must show how each one is avoided or verified.

Intuition

Think of it like a spare-parts catalogue

A pump that fits the same mounting, takes the same input and delivers at least the same flow can replace the original without re-certifying the whole engine. That is what a proper subclass is: a drop-in replacement for its parent. The danger in OO software is a subclass that looks like a drop-in part but quietly behaves differently, so code that was verified against the parent misbehaves when the child turns up at run time. DO-332 is mostly about proving your parts really are interchangeable, and about the hidden machinery (heaps, exceptions, implicit conversions) that OO languages bring along.

Why OO needed its own supplement

OO languages bring strong tooling, a large talent pool and reuse potential, but several features undermine the things DO-178C relies on: predictable control flow (dynamic dispatch decides at run time which method runs), traceability (a requirement implemented in a base class is silently inherited by subclasses), structural coverage (covering a call site once does not cover every method it may dispatch to), and resource predictability (heap allocation and exceptions). Industry and the FAA studied these for over a decade — the OOTiA Handbook (2004), FAA research on OO coverage and data/control coupling, CAST papers — and DO-332 (2011) consolidated the result.

DO-332 key features, the risk each brings, and the usual mitigation

FeatureWhat can go wrongTypical mitigation
Inheritance (single / multiple)Subclass weakens parent behaviour; requirements silently inherited or overridden; diamond ambiguity with multiple inheritanceLSP-based type consistency; trace requirements to overriding methods; restrict multiple inheritance to interfaces
Dynamic dispatch (polymorphism)Call site can run any of several methods; coverage and timing analysis must consider all of themLocal type consistency verification; bounded class hierarchies; flattened dispatch tables analysed for WCET
Parametric polymorphism (generics/templates)Each instantiation is different object code; code verified for one type may not hold for anotherVerify each instantiation, or show the template is verified for all types it is used with
OverloadingWrong overload chosen by implicit resolution rules; reviewers misread intentCoding standard limits; explicit types; reviews focused on resolution
Type conversionImplicit narrowing, loss of precision, unchecked downcastsForbid implicit narrowing; checked downcasts only; static analysis
Exception managementUnhandled exceptions, exceptions escaping across components, hidden control flowDocumented exception strategy in the architecture; verify every raise has a handler
Dynamic memory managementLeaks, fragmentation, dangling references, unbounded allocation timeAllocate only at initialisation, pools, or a verified memory manager (objective OO11)
VirtualizationInterpreted or virtual-machine code is really data for another program; hypervisors share hardwareTreat interpreted code as software with its own level; apply DO-332 and partitioning guidance

Inheritance, LSP and local type consistency

DO-332 adopts the Liskov Substitution Principle: if a property can be proven for objects of a type, it must also hold for objects of every subtype. In requirements terms, a subclass must satisfy all the requirements of its parent class. For each method it redefines, a subclass may not strengthen preconditions (demand more of the caller), may not weaken postconditions (promise less), and may not weaken invariants.

Worked example

An air data class that breaks LSP

A base class AirspeedSource has a method getCas() whose requirement says it returns calibrated airspeed in knots, valid from 30 to 450 kt, and never blocks. A subclass SyntheticAirspeed estimates airspeed from GPS and attitude for a degraded mode. Its getCas() only works above 60 kt (a stronger precondition) and may take several frames to converge (a weaker timing postcondition). Every caller that was verified against AirspeedSource can now receive a SyntheticAirspeed through dynamic dispatch. The subclass is not a proper subtype, and the hierarchy is not type-consistent. Either the design changes (make it a separate interface) or every caller must be re-verified with the subclass in mind.

Local type consistency (objective OO10) asks you to show that at every point where dispatch can happen, every class that could actually appear there is substitutable for the declared type. DO-332 allows several routes, and projects often mix them:

  • —Formal verification of LSP — prove that each overriding method honours its parent’s contract (pre/postconditions, invariants). Fits well with formal methods.
  • —Inherited requirements-based tests — run the parent class’s requirements-based tests against every subclass; a proper subclass must pass them all.
  • —Pessimistic testing — at each dispatching call, test with every method that could be dispatched to. Simple to reason about, but expensive in large hierarchies.

Practitioner tip

Trace to methods, not classes

Classes are architecture; methods and attributes implement requirements. DO-332 expects requirements to trace to the methods that implement them, and when a subclass overrides a method, the parent’s requirement should also trace to the override — in addition to any subclass-specific requirements.

Dynamic memory and exceptions

Objective OO11 requires the dynamic memory scheme to be shown robust. DO-332 lists the classic failure modes your memory management design must address: ambiguous references (two owners of one object), fragmentation starvation (enough free memory, but not contiguous), deallocation starvation (garbage not reclaimed fast enough), heap exhaustion, premature deallocation (dangling pointers), lost updates and stale references (e.g. an object moved by a compacting collector), and unbounded allocation or deallocation time. Each must be prevented by design or detected by verification.

Two common strategies

Static-after-start

▸Allocate all objects during initialisation, then lock the allocator.
▸No frees in flight, so no leaks or fragmentation.
▸Easy to argue; most level A OO projects do this.
▸Must still verify that initialisation cannot exhaust memory.

Managed heap in operation

▸Pools of fixed-size blocks, region allocation or a real-time garbage collector.
▸Needs a verified bound on allocation time and memory use.
▸The memory manager itself becomes software at the highest level it serves.
▸Expect close authority scrutiny.

For exceptions, DO-332 wants an explicit strategy in the architecture: which exceptions can be raised, where each is handled, and what the system does when one occurs. Verification must show the code follows the strategy — no exception can propagate out of a component unhandled, and handlers leave objects in a consistent state. Exception paths are control flow, so they count for coverage.

Vulnerabilities, coverage and planning

Annex OO.D is the heart of the supplement. For each key feature (inheritance, parametric polymorphism, overloading, type conversion, exception management, dynamic memory, virtualization) and for general issues (traceability, structural coverage, component usage, resource analysis) it lists vulnerabilities and points to the guidance that addresses them. DO-332 planning additions: describe in the plans how each applicable vulnerability is handled, describe any virtualization, and for reused components describe type consistency, requirements mapping and exception strategy across the boundary. Verification additions include checking class hierarchy against requirements and testing that constructors initialise objects to a state consistent with the class requirements.

Pitfall

Coverage that looks complete but is not

Statement and MC/DC coverage measured on source can look complete after one call through a dispatching site, even though half the possible target methods never ran there. Similarly, compilers generate hidden code for constructors, destructors, dispatch tables and template instances. Plan coverage so it accounts for dispatch targets and for compiler-generated code, and at level A include them in the source-to-object analysis.

Model-based development

OO inside generated code

Most model-based projects generate procedural C, so DO-332 rarely applies to the generated application. It becomes relevant when the generator emits C++ classes, when hand-written OO code is integrated with generated code, or when the tools themselves are OO (tool developers then apply DO-332 under DO-330). Check the generator’s output options: inheritance, virtual methods and dynamic allocation can sometimes be disabled in the code-generation configuration, which keeps the generated code out of DO-332’s scope.

What the auditor looks for

What the reviewer will ask

Where is your mapping from each Annex OO.D vulnerability to the standard, design rule or verification activity that handles it? How do you show local type consistency at each dispatch point? What does your coding standard allow — multiple inheritance, templates, exceptions, heap after start-up? How did coverage account for dispatch targets? Applicants new to OO are advised to start on a lower-level project and coordinate closely with the authority.

Self-check

A subclass overrides a method and accepts a narrower input range than its parent. Which LSP rule does this break?

Sources & further reading

  • DO-332, Object-Oriented Technology and Related Techniques Supplement to DO-178C and DO-278A (2011) — OO.5, OO.6.7, OO.6.8, Annex OO.D
  • Rierson, Developing Safety-Critical Software (2013), ch. 15
  • FAA, Handbook for Object-Oriented Technology in Aviation (OOTiA), 2004
  • FAA research reports DOT/FAA/AR-07/52 and AR-07/20 (OO data/control coupling and structural coverage)
  • FAA AC 20-115D / EASA AMC 20-115D (use of the supplements with DO-178C)

← Previous

Tool Qualification (DO-330)

Tools & Other Supplements

Next →

Formal Methods (DO-333)

Tools & Other Supplements

On this page

Why OO needed its own supplementInheritance, LSP and local type consistencyDynamic memory and exceptionsVulnerabilities, coverage and planning