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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.