Problems Specification and Design - Object-Oriented Programming II | CMSC 132, Study notes of Computer Science

Material Type: Notes; Professor: Padua-Perez; Class: OBJECT-ORIENTED PROG II; Subject: Computer Science; University: University of Maryland; Term: Unknown 1989;

Typology: Study notes

Pre 2010

Uploaded on 02/13/2009

koofers-user-qwr
koofers-user-qwr 🇺🇸

10 documents

1 / 3

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
1
CMSC 132:
Object-Oriented Programming II
Problem Specification & Design
Department of Computer Science
University of Maryland, College Park
Overview
Problem specification
Obstacles
Program design
How to divide w ork
Interface & conditions
Problem Specification
Goal
Create complete, accurate, and unambiguous
statement of problem to be solved
Problems
Description may not be accurate
Description may change over time
Difficult to spec ify behavior for all input s
Natural langua ge description is imprecise
Formal specifica tion languages limited an d difficult
to understand
Problem Specification
Example
Specification of input & output for progra m
Problem Specification Problems
Description may not be accurate
Problem not understood by customer
Description may change over time
Customer changes their mind
Difficult to specify behavior for all inputs
Usually only covers common cases
Hard to conside r all inputs (may be imp ossible)
Example
Most UNIX utilit ies crash with random input s
Problem Specification Problems
Description may be ambiguous
Natural langua ge description is imprecise
Why lawyers use legalese for contracts
Formal specification languages are limited and
may be difficult to understand
Examples
Find sum of all values in N-element list L
between 1 and 100
L
i
(L
i
1) (L
i
100)
Difficult to write specifications that are both
readable and precise
i = 0
N-1
pf3

Partial preview of the text

Download Problems Specification and Design - Object-Oriented Programming II | CMSC 132 and more Study notes Computer Science in PDF only on Docsity!

CMSC 132:

Object-Oriented Programming II

Problem Specification & Design

Department of Computer Science

University of Maryland, College Park

Overview

Problem specification

Obstacles

Program design

How to divide work Interface & conditions

Problem Specification

Goal

Create complete, accurate, and unambiguous statement of problem to be solved

Problems

Description may not be accurate Description may change over time Difficult to specify behavior for all inputs Natural language description is imprecise Formal specification languages limited and difficult to understand

Problem Specification

Example

Specification of input & output for program

Problem Specification Problems

Description may not be accurate

Problem not understood by customer

Description may change over time

Customer changes their mind

Difficult to specify behavior for all inputs

Usually only covers common cases Hard to consider all inputs (may be impossible) Example Most UNIX utilities crash with random inputs

Problem Specification Problems

Description may be ambiguous

Natural language description is imprecise Why lawyers use legalese for contracts Formal specification languages are limited and may be difficult to understand Examples Find sum of all values in N-element list L between 1 and 100

∑ Li ∋ (Li ≥ 1) ∧ (Li ≤ 100)

Difficult to write specifications that are both readable and precise

i = 0

N-

Program Design

Goal

Break software into integrated set of components that work together to solve problem specification

Problems

Methods for decomposing problem How to divide work What work to divide How components work together

Design – How To Divide Work

Decomposing problem

Break large problem into many smaller problems Cannot solve large problems directly Divide and conquer

  1. Break problem up into simpler sub-problems
  2. Repeat for each sub-problem
  3. Stop when sub-problem can be solved easily

Design – How To Divide Work

Functional approach

Treat problem as a collection of functions

Techniques

Top-down design Successively split problem into smaller problems Bottom-up design Start from small tasks and combine

Design – Decomposition Example

Top-down design of banking simulator

Design – How To Divide Work

Object-oriented approach

Treat problem as a collection of data objects Objects Entities that exist in problem Contain data Perform actions associated with data

Design – Comparison Example

Bank simulation

Functional programming Arrivals, departures, transactions

Object-oriented programming Customers, lines, tellers, transactions