Keeping Secrets Within a Family: Rediscovering Parnas
Total Page:16
File Type:pdf, Size:1020Kb
Keeping Secrets within a Family: Rediscovering Parnas H. Conrad Cunningham Cuihua Zhang Yi Liu Computer Science Computer & Information Systems Computer Science University of Mississippi Northwest Vista College University of Mississippi University, MS, 38677 San Antonio, TX 78251 University, MS 38677 Abstract of related programs. The motivation for product lines and frameworks is to take advantage of the David Parnas wrote several papers in the 1970’s commonalities among the members of the product line and 1980’s that are now considered classics. The to lower the overall cost of producing and maintaining concepts he advocated such as information hiding and a group of related software systems. use of abstract interfaces are generally accepted as Since the foundation of software product lines and the appropriate way to design nontrivial software frameworks is what Parnas proposed in his papers, an systems. However, not all of what he proposed has examination of the concepts in these papers (collected been fully appreciated and assimilated into our in [5]) can still reveal much of value to current-day practices. Many of his simple, elegant ideas have software developers and researchers. Many of the been lost amongst the hype surrounding the lessons taught in these works should also be technologies and methods that have arisen in the past incorporated into our college-level teaching. two decades. This paper examines Parnas’s ideas, This paper examines several of the lessons on the especially his emphasis on program families, and design of program families taught by Parnas that are proposes that college-level computing science and still important for contemporary students to learn. software engineering curricula should renew their Many of his simple, elegant ideas have been lost attention to these very important principles and amongst the hype surrounding the technologies and techniques and present them in the context of methods that have arisen in the past two decades. The contemporary software development. paper reviews Parnas and his colleagues’ concepts of modularization, information hiding, abstract interfaces, Keywords: program family, information hiding, and program families. An example Table framework abstract interface, module, software product line. from [3], designed and implemented with the Java programming language, is used to illustrate the 1. Introduction concepts. After each topic is reviewed, a discussion of part of the example is provided to enhance the Software product lines and frameworks are understanding of the topic. increasing in importance among software developers and researchers; however, many of the key ideas 2. Table framework example behind them were first published in the 1970’s and 1980’s in classic papers by David Parnas and his The Table Abstract Data Type (ADT) represents a colleagues [8]. Parnas argues that a “software designer collection of records, each of which consists of a finite should be aware that he is not designing a single sequence of data fields. The value of one (or a program but a family of programs.” [10] Computing composite of several) of these fields uniquely identifies science and software engineering students should a record within the collection; this field is called the develop such awareness early in their studies. key. The values of the keys are elements from a totally A software product line is often defined as “a ordered set. The operations provided by the Table family of products that share common features to meet ADT allow a record to be inserted, retrieved, updated, the needs of a market area.” [1] A software framework and deleted using its key to identify it within the is a special case of a software product line. In the collection. context of an object-oriented language, a framework is For the purposes of this paper, we consider the a reusable design captured by a set of interrelated design of the Table framework to have the following abstract classes that define the shared features of a set requirements [3]: 1. It must provide the functionality of the Table particular, the designer should choose to hide within a ADT for a large domain of client-defined records module an aspect of the system that is likely to change and keys. as the program evolves. If two aspects are likely to 2. It must support many possible representations of change independently, they should be secrets of the Table ADT, including both in-memory and separate modules. The aspects that are unlikely to on-disk structures and a variety of indexing change are represented in the design of the interactions mechanisms. (i.e. connections) among the modules. This approach 3. It must separate the key-based record access supports the goal of changeability (goal 2). When care mechanisms from the mechanisms for storing is taken to design the modules as clean abstractions records physically. with well-defined and documented interfaces, the We approach the design of the Table framework using approach also supports the goals of independent Parnas’s modular specification techniques. development (goal 1) and comprehensibility (goal 3). 3. Information-hiding modules 3.2 Table framework design Students commonly consider a module to be a unit Consider the Table framework example. At the top of code such as a subroutine or a class. When they level, there seems to be three primary dimensions of approach the design of a system, a common tendency change in the system. We can make each of these the is to break the system into several processing steps like secret of an information-hiding module. The modules steps in a flowchart and to define each step to be a and their secrets are as follows: module. Parnas presents a more general view of Table Access. This module provides key-based modules and a different approach to decomposing a access to the collection of records stored in the table. system into modules. The secret of the module is the set of data structures and algorithms used to provide the index for access to 3.1 Parnas principles the records. For example, this might be a simple index maintained in a sorted array, a hash table, or a tree- Parnas defines a module as “a work assignment structured index. given to a programmer or group of programmers” due Record Storage. This module manages the physical to the nature of software engineering, which is multi- storage for the records in the table. The secret of the person, multi-version [9]. It is desirable for module is the detailed nature of the storage medium. programming environments and languages to support For example, the storage medium might be a structure the programmers' work on modules, but it is not in the computer’s main memory or a random-access essential. file on disk. In Parnas's view, the goals of a modularization are Client Record. This module provides the key and to [7]: record data types needed by the other modules; the 1. shorten development time by minimizing the client of the Table framework must provide an required communication among the groups, implementation of the module appropriate for the 2. make the system flexible by limiting the number of particular application. The secret of the module is the modules affected by significant changes, structure of the client’s record, including the 3. enable programmers to understand the system by identification of the key field, its data type and focusing on one module at a time. ordering relation and identification of the non-key To accomplish these goals, it is important that modules fields and their data types. be cohesive units of functionality that are independent of one another. 3.3 Perspective Parnas advocates the use of a principle called information hiding to guide decomposition of a system Classes and modules can be easily confused since into appropriate modules, i.e. work assignments. He they are both self-contained units, and they do share points out that the connections among the modules some of the same goals and characteristics. The should have as few information requirements as difference is, however, that a typical work assignment, possible [7]. or a module, that needs to support change is often Information hiding means that each module should larger than a single class; it may contain several related hide a design decision from the rest of the modules. classes, and these classes should be designed and This is often called the secret of the module. In maintained as a unit. Information hiding has, of course, been absorbed by an interface (i.e. set of assumptions) that does not into the dogma of object-oriented programming. change when one module implementation is substituted However, information hiding is often oversimplified as for another. Parnas and his colleagues call this an merely hiding the data and their representations [15]. abstract interface because it is an interface that The secret of a well-designed module may be much represents the assumptions that are common to all more than that. It may include such knowledge as a implementations of the module [2,9]. As an specific functional requirement stated in the abstraction, it concentrates on the essential nature of requirements document, the processing algorithm used, the module and obscures the incidental aspects that the nature of external devices accessed, or even the vary among implementations. presence or absence of other modules or programs in Parnas and his colleagues take an interesting two- the system [7, 10, 11]. These are important aspects phase approach to the design of abstract interfaces, one that may change as the system evolves. that they argue is especially important in the design of Information hiding is one of the most important interfaces to “devices” in the environment. The principles in software engineering. At first glance, it method constructs two partially redundant descriptions seems to be an obvious technique.