Page 168 - ARM 64 Bit Assembly Language
P. 168
CHAPTER 6
Abstract data types
An Abstract Data Type (ADT) is composed of data and the operations that work on that data.
The ADT is one of the cornerstones of structured programming. Proper use of ADTs has
many benefits. Most importantly, abstract data types help to support information hiding. An
ADT hides information by encapsulating the information into a module or other construct,
and providing a well-defined interface. The interface typically consists of the names of data
types provided by the ADT and a set of subroutine definitions, or function prototypes, for op-
erating on the data types. The implementation of the ADT is hidden from the client code that
uses the ADT.
A common use of information hiding is to hide the physical storage layout for data so that if
it is changed, the change is restricted to a small subset of the total program. For example, if a
three-dimensional point (x,y,z) is represented in a program with three floating point scalar
variables and later, the representation is changed to a single array variable of size three, a
module designed with information hiding in mind would protect the remainder of the program
from such a change.
Information hiding reduces software development risk by shifting the code’s dependency
on an uncertain implementation onto a well-defined interface. Clients of the interface per-
form operations purely through the interface, which does not change. If the implementation
changes, the client code does not have to change.
Encapsulating software and data structures behind an interface allows the construction of
objects that mimic the behavior and interactions of objects in the real world. For example,
a simple digital alarm clock is a real-world object that most people can use and understand.
They can understand what the alarm clock does, and how to use it through the provided in-
terface (buttons and display) without having to understand every part inside of the clock. If
the internal circuitry of the clock were to be replaced with a different implementation, people
could continue to use it in the same way, provided that the interface did not change.
6.1 ADTs in assembly language
As with all other structured programming concepts, ADTs can be implemented in assembly
language. In fact, most high level compilers convert structured programming code into assem-
bly during compilation. All that is required is that the programmer define the data structure(s),
ARM 64-Bit Assembly Language
https://doi.org/10.1016/B978-0-12-819221-4.00013-4 155
Copyright © 2020 Elsevier Inc. All rights reserved.

