8 - Software Engineering with Spark
Published online by Cambridge University Press: 05 October 2015
Summary
In the preceding chapters we have concentrated on the details of the Spark language. In this chapter, we look at a broader picture of how Spark might be used in the context of a software engineering process. The Spark 2014 Toolset User's Guide (Spark Team, 2014b) lists three common usage scenarios:
Conversion of existing software developed in Spark 2005 to Spark 2014
Analysis and/or conversion of legacy Ada software
Development of new Spark 2014 code from scratch
We start by examining each of these scenarios in more detail, discussing the interplay between proof and testing, and then presenting a case study to illustrate some issues arising when developing new Spark 2014 code from scratch.
Conversion of Spark 2005
Converting a working Spark 2005 program to Spark 2014 makes sense when that program is still undergoing active maintenance for enhanced functionality. The larger language and the enhanced set of analysis tools provided by Spark 2014 offer a potential savings in development time when adding functionality to an existing Spark 2005 program.
As Spark 2014 is a superset of Spark 2005, the conversion is straight forward. Section 7.2 of the Spark 2014 Toolset User's Guide (Spark Team, 2014b) provides a short introduction to this conversion. Appendix A of the Spark 2014 Reference Manual (Spark Team, 2014a) has information and a wealth of examples for converting Spark 2005 constructs to Spark 2014. Explanations and examples are provided for converting subprograms, type (ADT) packages, variable (ASM) packages, external subsystems, proofs, and more. Should you need to constrain your code to the Spark 2005 constructs but wish to use the cleaner syntax of Spark 2014, you may use pragma Restrictions (Spark 05) to have the analysis tools flag Spark 2014 constructs that are not available in Spark 2005.
Dross et al. (2014) discuss their experiences with converting Spark 2005 to Spark 2014 in three different domains. AdaCore has a Spark 2005 to Spark 2014 translator to assist with the translation process. At the time of this writing, this tool is available only to those using the pro versions of their GNAT and Spark products.
We illustrate a simple example of converting a Spark 2005 package to Spark 2014. The package encapsulates a circular buffer holding temperature data, for example, from an analog to digital converter.
- Type
- Chapter
- Information
- Building High Integrity Applications with SPARK , pp. 286 - 325Publisher: Cambridge University PressPrint publication year: 2015