



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Paper; Class: Software Engineering; Subject: Computer Science; University: University of Texas - San Antonio; Term: Unknown 1989;
Typology: Papers
1 / 5
This page cannot be seen from the preview
Don't miss anything!




UTSA CS
¾^ We want to specify interfaces of components to facilitatesystem decomposition ¾^ We need to specify interesting data types sometimes– Sets
-^ Arrays -^ Records -^ New data types with operations ¾^ We want to avoid making design decisions, such as how a datatype is implemented (algorithm and data structure) UTSA CS
¾^ Strategy #1: write a prose specification A stack of integers supports three operations: push, pop, andsize. Pushing adds an element. Popping returns the most recentlyadded element. Size returns the number of elements. ¾^ Problems: it is ambiguous– What happens when you pop an empty stack?
-^ Does “return” imply removes as well or just peeks? -^ How to add elements? -^ What are the precise signatures of the operations? UTSA CS
¾^ Strategy #2: write a careful and structured prose ¾^ That is what most specifications look like ¾^ Problems–^ Suffers from the same problem as prose
UTSA CS
¾^ Strategy #3: give an operational specification, i.e., writesome code as the specification– Formal
-^ Lots of supporting tools, such as compilers ¾^ Problems– Over constraining -^ Committing to representation and algorithm strategy z^ Java ints are 4 bytes z^ … -^ Too much inessential detail UTSA CS
¾^ ADT = Abstract Data Type–^ Sort: set of values (an abstract view of data)
-^ Description: informal specification which is easy to understand -^ Literals: constants of the data type -^ Signature: operators’ names, domains, and ranges ¾^ Algebraic specification = ADT + axioms ¾^ Algebraic specification describes–^ Name of the sort -^ Signatures of operators -^ Properties of the operators as relationships between operators UTSA CS
UTSA CS
¾^ All stacks start out empty, and then have various operationsperformed on them ¾^ What is returned after a sequence of function calls on theIntStack ADT–^ new; push 5; push 8; topapplying axiom #4top (push (8, push (5, ES))) =?
-^ new; push 3; push 7; push 9; pop; popapplying axiom #2pop (pop (push (9, push (7, push (3, ES))))) =?
UTSA CS
¾^ Algebraic specification are hard to read and write ¾^ Algebraic specification are hard to change ¾^ It is hard to tell if your algebraic specification is– Correct
-^ Complete -^ Consistent UTSA CS
¾^ Determine what operations and literals you need ¾^ Categorize operations and literals into three groups–^ Generators
-^ Manipulators -^ Inspectors ¾^ Define result of applying non-generator operations aftereach generator operation UTSA CS
UTSA CS
UTSA CS
UTSA CS
UTSA CS
A queue of integers supports four operations: enQ, deQ,front and isEmpty. enQ adds an element to a the end ofthe queue. deQ returns the queue without the frontelement. front returns the element at the front of thequeue. isEmpty returns true if the queue is empty. UTSA CS
Sommerville’s Book–^ Chapter 10, “Formal Specification”10.2 Sub-system interface specification