Wutthichai Luemuang | Dreamstime.com

Enforced Coding Using Ada Contracts

May 12, 2021
This multipart article series examines how Ada contracts provide SPARK with the ability to prove software correctness.

This article series is in theEmbedded Softwaretopic within ourSeries Library

This article series is also in theTechXchange:Developing High Quality Software

Safe and secure software requires code to meet specifications. These are often written documents that have to be translated into applications by programmers. Unfortunately, the contract between the specifications and implementation can be tenuous and even ignored, which can lead to problems. It would be great if the specifications could be enforced by the compiler.

Contracts are a technology added to Ada 2012 and based on SPARK, a provable subset of Ada. A programmer can annotate aspects of the software, such as the pre- and post-conditions. This allows the compiler to prove that the code does what is specified by the developer. This includes code that may call a function, allowing many validity checks to be removed since the compiler makes sure arguments meet the specified requirements.

These articles provide examples and insights into contract-based programming:

An Intro to Sparkis another good resource. It is an interactive website where you can try out contracts.

    Latest

    Murata — IRA IRA-S210ST01 Pyroelectric Infrared Sensor

    March 31, 2022
    The Murata IRA-S210ST01 is a leaded pyroelectric infrared sensor which provides a good signal-to-noise ratio and reliable performance.. In smart light…

    Nexperia — PMEGxxxTx Trench Schottky Rectifiers

    March 31, 2022
    Nexperia has extended its portfolio of trench Schottky rectifiers with devices rated at up to 100 V and 20 A. The new parts feature excellent switchi…

    Women in Engineering – Inspiring Creative Growth in Our Field

    March 8, 2022
    Over the last few years, the number of women in the technology or engineering profession has risen. The number of women enrolled in post-secondary en…

    The Future of Automotive Wheel Sensing with GMR

    Feb. 23, 2022
    下载PDF版本。快速的微系统。磁铁ic sensors are used extensively in modern vehicles, serving to measure the position of moving parts,…
    Baidu