Architectural visualization key to code reuse

What can developers of military and avionics software systems do to take advantage of software reuse while ensuring that software is as bug-free and secure as possible?

In all industries, is becoming increasingly ubiquitous. Take Boeing jets as an example. At 6.5 million lines of code, Boeing’s 787 aircraft flight control system has three times more code than the 777[1]. Given this growth trend, it is both unrealistic and impractical to rewrite an entire system from scratch for each new project.

The of code has become a universal software development best practice. It speeds time to market by increasing development efficiencies while minimizing the costs associated with brand-new development. The practice of also enables development organizations to leverage the lessons learned from an existing code base.

However, with code reuse, a balance between risk and reward must be achieved. When legacy software is ported to a new or combined with new code, formerly latent bugs can become active critical defects or high-risk vulnerabilities. In mission-critical military and , software defects can lead to injury, costly malfunctions, and even loss of life.

In fact, improper reuse was the root cause of the Ariane 5 () spacecraft’s self-destruction in 1996. The code operated safely in the aircraft’s previous version, but the execution context changed, transforming what was a latent bug in the Ariane 4 into a critical bug that caused its successor to explode 37 seconds after launch.

The power of architectural analysis

In industries with large and extremely complex code bases, such as military and , one key element in successful reuse of legacy code is the ability to visualize and analyze the software system architecture. Leading () tools provide software system architects, development managers, and individual with a graphical view of the design of their software directly from existing . This graphical view provides a comprehensive understanding of the application’s structure and design, allowing the team to assess interfaces, relationships, and logic flow to determine where and how to reuse existing code. Clearly understanding the systems’ components and their interrelationships and dependencies is critical to improving the quality and security of software. Additionally, the ability to document system architecture is required to achieve compliance with the standard within the avionics space.

When reusing legacy code, a comprehensive view of the system’s architecture can help development teams in the following ways.

Isolate reusable components

When reusing components from a legacy software application for a new application, it is necessary to minimize the dependencies of those components on other parts of the software system. To do so, designers must ensure that the component contains only entities related to the component’s functionality. A complete view of the system’s architecture at all levels enables developers to isolate reusable components and reorganize them for the most efficient reuse of code.

Assess and improve quality of the software system design

The physical design of a software system might bear little resemblance to its high-level logical design. With a detailed view of the system’s architecture, it’s possible to:

  • Navigate the system hierarchy and explore its structure
  • Review a component’s dependencies on other components
  • View relationships between different components in the system

Through this view, inconsistencies between current implementation and design intent can be uncovered, including inappropriate relationships and dependencies and errors duplicated in different levels of the software hierarchy. This level of understanding allows development teams to assess the quality of the physical software system and implement the desired logical design on the system.

Portability to a new platform

Recycled code is frequently used in systems designed for platforms other than those for which the native code was originally developed. Ensuring that the in-house or third-party code will perform as designed on a new platform is challenging. However, a thorough architectural view of the system can help by revealing the application’s dependencies on the external environment. With an accurate understanding of the code and its design, the development team can quickly determine the scope of the porting effort and the actions required.

The architecture of reuse

For military and development teams, comprehensive visibility and analysis of their software system architecture is critical in ensuring high-quality, results when reusing legacy software. Using the architecture capabilities of source tools, the risks associated with code reuse are greatly diminished, productivity gains are made through more comprehensive design planning, and the efforts required to achieve DO-178B compliance are streamlined.

References:

[1] Boeing Faces “Pretty Tight” 787 Delivery Schedule, by Michael Mecham, Aviation Week, Sept. 9, 2007, www.aviationweek.com/aw/generic/story_generic.jsp?channel=awst&id=news/aw091007p2.xml&headline=Boeing%20Faces%20%27%27Pretty%20Tight%27%27%20787%20Delivery%20Schedule

Gwyn Fisher is the chief technology officer at and has more than 20 years of global technology experience. He brings a valuable combination of vision, experience, and direct insight into the software developer’s perspective. At Klocwork, Gwyn returns to his original passion, compiler theory, to move static source code analysis to the next level. He can be contacted at gwyn.fisher@klocwork.com.