Upload
quamar-phillips
View
26
Download
0
Embed Size (px)
DESCRIPTION
Keeping Secrets Within a Family: Rediscovering Parnas. H. Conrad Cunningham Computer & Information Science, University of Mississippi Cuihua Zhang Computer & Information Systems, Northwest Vista College Yi Liu Computer & Information Science, University of Mississippi. Program Family. - PowerPoint PPT Presentation
Citation preview
Keeping Secrets Within a Family: Keeping Secrets Within a Family: Rediscovering ParnasRediscovering Parnas
H. Conrad CunninghamH. Conrad CunninghamComputer & Information Science, University of MississippiComputer & Information Science, University of Mississippi
Cuihua ZhangCuihua ZhangComputer & Information Systems, Northwest Vista CollegeComputer & Information Systems, Northwest Vista College
Yi LiuYi LiuComputer & Information Science, University of MississippiComputer & Information Science, University of Mississippi
22
Program FamilyProgram Family
Set of programsSet of programs sharing many common propertiessharing many common properties worthwhile to study as a group before each worthwhile to study as a group before each
individuallyindividually
David Parnas:David Parnas:““If you are developing a family of programs, you If you are developing a family of programs, you must do that consciously, or you will incur must do that consciously, or you will incur unnecessary long-term costs.”unnecessary long-term costs.”
33
Our ViewpointOur Viewpoint
Students shouldStudents should:: learn to design program familieslearn to design program families
– also known as software frameworks or product linesalso known as software frameworks or product lines be taught appropriate development principles and be taught appropriate development principles and
techniquestechniques see examples of both good and bad designssee examples of both good and bad designs apply what they are taught on relevant exercises apply what they are taught on relevant exercises
Parnas and others articulated many elegant and Parnas and others articulated many elegant and useful ideas in the 1970’s and 1980’s.useful ideas in the 1970’s and 1980’s.
44
How Much Progress?How Much Progress?
In 1976, Parnas published the seminal article In 1976, Parnas published the seminal article “On the Design and Development of Program “On the Design and Development of Program Families.”Families.”
In 2001, Parnas wrote:In 2001, Parnas wrote:““Although there is now growing … interest and Although there is now growing … interest and some evidence of … success in applying the some evidence of … success in applying the idea, the majority of industrial programmers idea, the majority of industrial programmers seem to ignore it in their rush to produce code.”seem to ignore it in their rush to produce code.”
55
Parnas PrinciplesParnas Principles
Information hiding modulesInformation hiding modules
Abstract interfacesAbstract interfaces
Program familiesProgram families
66
Parnas Principle:Parnas Principle:Information-Hiding ModulesInformation-Hiding Modules
Module Module Work assignment given to a programmer or Work assignment given to a programmer or
group of programmersgroup of programmers
Information hidingInformation hiding Design modules around assumptions that are Design modules around assumptions that are
likely to changelikely to change Hide a design decision within a moduleHide a design decision within a module
– as itsas its secret secret
77
Table Framework ExampleTable Framework Example
Table ADTTable ADT collection of recordscollection of records
– each a finite sequence of data fieldseach a finite sequence of data fields
– keykey field value uniquely identifies record within field value uniquely identifies record within collection collection
OperationsOperations– insertinsert
– deletedelete
– retrieveretrieve
– etc.etc.
key1key1 data1data1
key2key2 data2data2
key3key3 data3data3
key4key4 data4data4
88
Table Framework RequirementsTable Framework Requirements
Provide Table ADT functionality (in Java)Provide Table ADT functionality (in Java) Support large domain of client-definable Support large domain of client-definable
records and keysrecords and keys Enable many possible implementations of Enable many possible implementations of
Table ADTTable ADT Separate key-based record access Separate key-based record access
mechanisms from storage mechanismsmechanisms from storage mechanisms
99
Table Framework ModulesTable Framework Modules
Table AccessTable Access– enables key-based access to recordsenables key-based access to recordsSecretSecret:: set of data structures and algorithms used in set of data structures and algorithms used in
accessing recordsaccessing records Record StorageRecord Storage
– manages physical storagemanages physical storageSecret:Secret: detailed nature of storage medium detailed nature of storage medium
Client RecordClient Record– provides key and record data typesprovides key and record data typesSecret:Secret: structure of the client’s record structure of the client’s record
1010
Teaching Perspective: Teaching Perspective: Information HidingInformation Hiding
What Parnas says:What Parnas says: ““consider it the most important and basic software consider it the most important and basic software
design principle” design principle” ““mentioned in very many textbooks, but it is treated in a mentioned in very many textbooks, but it is treated in a
very shallow manner”very shallow manner” ““can be explained in 40 minutes”can be explained in 40 minutes” ““takes at least a semester of practice to learn how to use” takes at least a semester of practice to learn how to use”
Thus explain thoroughly, give illustrative Thus explain thoroughly, give illustrative examples, assign meaningful exercises, and examples, assign meaningful exercises, and evaluate student work rigorouslyevaluate student work rigorously
1111
Parnas Principle: Parnas Principle: Abstract InterfacesAbstract Interfaces
InterfaceInterface set of assumptions a programmer needs to set of assumptions a programmer needs to
make about another program to demonstrate make about another program to demonstrate correctness of his programcorrectness of his program
Abstract InterfaceAbstract Interface module interface that does not change when module interface that does not change when
one module implementation is substituted for one module implementation is substituted for anotheranother
1212
Abstract Interface DesignAbstract Interface Design
Parnas two-phase approachParnas two-phase approach
List assumptions common to all implementations List assumptions common to all implementations of the module—in precise Englishof the module—in precise English
Give specific operations and describe syntax and Give specific operations and describe syntax and semantics of each operation—in programming semantics of each operation—in programming notationnotation
1313
Table Framework Design: Table Framework Design: Client Record Module InterfaceClient Record Module Interface
Assumption listAssumption list
1.1. Records are objects from which the keys can Records are objects from which the keys can be extracted and compared using a total be extracted and compared using a total ordering.ordering.
2.2. As needed, records can be converted to and As needed, records can be converted to and from a sequence of bytes. It is possible to from a sequence of bytes. It is possible to determine the number of bytes in the record.determine the number of bytes in the record.
1414
Table Framework Design: Table Framework Design: Client Record Module InterfaceClient Record Module Interface
Programming interfaceProgramming interface
interface interface ComparableComparable to represent totally ordered keys to represent totally ordered keysint compareTo(Object key) int compareTo(Object key) from Java APIfrom Java API
interface interface Keyed Keyed to represent records for table accessto represent records for table accessComparable getKey()Comparable getKey()
interface interface Record Record to represent storable recordsto represent storable recordsvoid writeRecord(DataOutput)void writeRecord(DataOutput)void readRecord(DataInput)void readRecord(DataInput)int getLength()int getLength()
1515
Teaching Perspective:Teaching Perspective:Abstract InterfacesAbstract Interfaces Concept not difficult to introduce, but takes Concept not difficult to introduce, but takes
much practice to learn to use wellmuch practice to learn to use well– use case studies to illustrateuse case studies to illustrate– give design guidelinesgive design guidelines– assign relevant exercisesassign relevant exercises– evaluate student designs rigorouslyevaluate student designs rigorously
Little-used two-phase procedure is good Little-used two-phase procedure is good approach for educationapproach for education– no new notations or technologies to learnno new notations or technologies to learn– students consider explicit assumptions about module students consider explicit assumptions about module
in design of programming interfacein design of programming interface
1616
Parnas Principle: Parnas Principle: Program FamiliesProgram Families
Set of programsSet of programs sharing many common propertiessharing many common properties worthwhile to study as a group before each individuallyworthwhile to study as a group before each individually
Specification approachSpecification approach Identify “design decisions which Identify “design decisions which cannotcannot be common be common
properties of the family”properties of the family” Hide each decision as the secret of a moduleHide each decision as the secret of a module Define an abstract interface suitable for all likely Define an abstract interface suitable for all likely
variants of modulevariants of module
1717
Table Framework DesignTable Framework Design
Table Access module implementationsTable Access module implementations– Simple in-memory index Simple in-memory index – Hashed indexHashed index
Record Storage module implementationsRecord Storage module implementations– In-memory arrayIn-memory array– Random-access file on diskRandom-access file on disk
ChallengeChallenge– Design of abstract interface for Record Storage with Design of abstract interface for Record Storage with
sufficient capability for Table Access but realizable sufficient capability for Table Access but realizable on multiple mediaon multiple media
1818
Teaching Perspective:Teaching Perspective:Program FamiliesProgram Families Give strong foundation in design of information-Give strong foundation in design of information-
hiding modules with abstract interfaceshiding modules with abstract interfaces– build on capabilities of OOP languagebuild on capabilities of OOP language
Teach to recognize and define scope of possible Teach to recognize and define scope of possible familiesfamilies
Introduce techniques for commonality/variability Introduce techniques for commonality/variability analysis of familiesanalysis of families
Start by using software frameworksStart by using software frameworks– hotspot analysis and systematic generalization hotspot analysis and systematic generalization
techniquestechniques
1919
ConclusionConclusion
Students should learn to design program familiesStudents should learn to design program families
Design principles publicized by Parnas 30 years Design principles publicized by Parnas 30 years ago are still valuableago are still valuable
Good software design is hard work requiring Good software design is hard work requiring understanding and practiceunderstanding and practice
The approach to design of software families can The approach to design of software families can be stated as be stated as keeping secrets within a familykeeping secrets within a family
2020
References: Information-HidingReferences: Information-Hiding
D. L. Parnas. “On the Criteria to Be Used in D. L. Parnas. “On the Criteria to Be Used in Decomposing Systems into Modules,” Decomposing Systems into Modules,” Communications of the ACM, Communications of the ACM, Vol. 15, No.12, Vol. 15, No.12, pp.1053-1058, 1972.pp.1053-1058, 1972.
2121
References: Abstract InterfacesReferences: Abstract Interfaces
K. H. Britton, R. A. Parker, and D. L. Parnas. K. H. Britton, R. A. Parker, and D. L. Parnas. “A Procedure for Designing Abstract Interfaces “A Procedure for Designing Abstract Interfaces for Device Interface Modules,” In for Device Interface Modules,” In Proceedings Proceedings of the 5of the 5thth International Conference on Software International Conference on Software EngineeringEngineering, pp. 195-204, March 1981., pp. 195-204, March 1981.
2222
References: Program FamiliesReferences: Program Families
D. L. Parnas. “On the Design and Development D. L. Parnas. “On the Design and Development of Program Families,” of Program Families,” IEEE Transactions onIEEE Transactions on Software EngineeringSoftware Engineering, Vol. SE-2, No. 1, pp. 1-9, , Vol. SE-2, No. 1, pp. 1-9, March 1976.March 1976.
2323
AcknowledgementsAcknowledgements
Acxiom Corporation grant: Acxiom Corporation grant: – The Acxiom Laboratory for Software The Acxiom Laboratory for Software
Architecture and Component Engineering Architecture and Component Engineering (ALSACE).(ALSACE).
Students in ENGR 660 Software Students in ENGR 660 Software Engineering class in Fall 2003Engineering class in Fall 2003