- Why use other techniques?
- Structured English
- Prototypes and Mockups
- First-order predicate logic
- Decision tables and trees
- Algebraic specifications

- UML is a union of many notations, so it supports many techniques, but not all.
- Not all problems and pojects are the same.
- Not all techniques are applicable to all problems.
- Some techniques take more work than others.
- Some techniques require special skills

- You need to choose the right notation for the problem at hand.

- You can specify any idea in plain English.
- It is hard to start with a blank page: what should you write? what are the important questions to ask? how can you specify things precisely?
- Structured English approaches use templates that ask the right questions. They reduce some writing tasks to very short sentences or just multiple-choice filling in blanks.
- Structured English templates can be reused and enhanced across projects
- Skillset: They require some training to write, usually no training to read. Many stakeholders can author and review.
- Example: ReadySET templates

- Show me how the system will look.
- User interface mockups: do not actually work, they are just pictures.
- Prototypes: partly
**work**to some degree. Throw-away prototypes are set aside after SRS and design questions are answered. Evolutionary prototypes are gradually changed to eventually full work. - Skillset: Must be skilled to build mockup or prototypes. Must keep purpose in mind. Many stakeholders can review prototypes.
- Example: HTML mockup methodology

- First-order predicate logic is just conditional expressions:
- Boolean variables
- AND, OR, NOT, EQUALS
- IMPLIES

- Example: (standing = senior) OR (honors) IMPLIES priority-enrollment
- Conditions are very precise. Simple conditions are concise, but complex conditions can be very hard to understand.
- Given a list of conditions, it is hard to tell if something is missing
- Skillset: They require training and practice to read and write.

- Start with a logical condition in mind.
- Select one variable
- Write down all important values or ranges
- Now, consider the condition, assuming that variable is bound to that value
- If the remaining condition is simple, write it down now
- Else repeat whole loop with another variable

- At each step, you can make a new node in a tree, or choose rows and columns in a table.
- Skillset: Decision trees can be just as precise as first-order predicate logic, but they are easier for more people to read and write.
- It is easier to catch missing cases, because they appear as a blank cell in the table
- Example: priority enrollment

- Specify the precise operations on a data structure using mathematical equations.
- Each equation says that two expressions are equal. Usually the left-hand-side has the operation you are trying to define, and the right-hand-side breaks it down into simpler parts.
- Algebraic specifications can be very precise and concise. They can precisely state exactly what the system is supposed to do.
- Skillset: They require a lot of training to author and review.
- It is possible to use Algebraic specifications to prove claims about a program, but difficult. More practically, the concept of Algebraic specifications will you help write good automated unit tests (covered in week 8).
- Consider the following operations on a String datatype:
- New() -> String
- Append(String, String) -> String
- Add(String, Char) -> String
- Length(String) -> Integer
- Equal(String, String) -> Boolean

- And these operation semantics:
- Append(New(), s) = s
- Append(s, New()) = s
- Append(s1, Append(s2, s3)) = Append(Append(s1, s2), s3)
- Append(s1, Add(s2, c)) = Add(Append(s1,s2), c)
- Length(New()) = 0
- Length(Add(s, c)) = Length(s) + 1
- Length(Append(s1, s2)) = Length(s1) + Length(s2)
- Equal(New(), New()) = True
- Equal(New(), Add(s, c)) = False
- Equal(Add(s1, c), Add(s2, c)) = Equal(s1, s2)