Ways to Solve Software Problems

app-1013616_960_720

Many software and hardware producers take pride in the exponential pace of technology change, but for users and consumers of their products and services the rapid technological obsolescence often means increased costs, frustrations, and unfulfilled promises. Corporate America expects to make capital investments in goods and facilities that should last five, ten, even twenty years, but only an eighteen-month lifetime for computer software and hardware investment is not uncommon.

Issues with Imperative Programming

There are many problems with the imperative approach. The sequence of operations critically determines the correctness of the algorithm. Unexpected execution sequences through an algorithm caused by user input actions or real-time events in a multitasking environment may result in subtle or catastrophic algorithm failure. Writing the control logic is the programmer’s responsibility and, therefore, subject to implementation errors. Understanding a program’s algorithm is often difficult for other developers without extensive metadata, or comments, on the code and empirical tracing of the program’s execution with sample data. Verifying program correctness consumes a significant portion of the development effort, but also usually fails to discover a significant number of defects.

Declarative Versus Imperative Programming

There are many advantages to declarative programming over the imperative style. In declarative languages, programmers do not specify sequences of operations, but only definitions or equations specifying relations. Unlike imperative programming, the logic relations in declarative programming are execution order independent, free of side effects of evaluation, and semantically clear to visual inspection.

Using Declarative Strategies in Commercial Software

While declarative programming languages have not received wide-spread commercial usage, the strategy of separating logic, or what, from control, or how, in an algorithm is a powerful, generalized technique for increasing ease of use and extending the longevity of software. Declarative techniques are particularly powerful in user interfaces and application programming interfaces (APIs) that have a rich, complex set of inputs over a relatively small field of execution behaviors.

Traditionally, APIs for data-acquisition devices modeled the characteristics of the hardware design and had a large number of functions of one or more parameters to setup the hardware and control data flow through the system. The ordering of sequences of operations was often critical to correctly programming and controlling the hardware. Upgrading to new data-acquisition hardware was often costly as hardware-necessitated changes in the order of operation sequences to program the hardware required costly software changes.