9.6 Comparison of Procedural and Object-Oriented Designs

At the end of Chapter 8, we used the implementation of List ADT algorithms to describe the process of value-returning and non-value-returning subprograms. The implementation of the List ADT was a record variable list, which contained an array values and a length field, that was passed to the List algorithms to be acted upon. The calling program defined the implementation of the list and wrote the algorithms to manipulate it. The subprograms were tasks of the program that needed a list.

In an object-oriented design, the List data structure and subprograms would be bound together in a class as follows:

Get Computer Science Illuminated, 7th Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.