Construct a Problem Specification
What Is a Problem Specification?
Problem specification is the process of clearly defining a problem to ensure the development of an effective solution.
A well-structured problem specification outlines the problem’s scope, constraints, and expected outcomes.
Key Components of a Problem Specification
| Component | Description | Avoid | Better Practice |
|---|---|---|---|
| Problem Statement | A concise description of the issue to solve and who it’s for. | “Make it better.” | “Given a list of words, return those that read the same forwards and backwards.” |
| Constraints & Limitations | Operational limits (time, memory, data rules, platforms). | “Do it fast.” | “≤ 1 second for 1000 words; letters A–Z only; word length ≤ 50; case-insensitive.” |
| Objectives & Goals | Measurable outcomes that define success. | “Be accurate.” | “Return palindromes in original order; 100% correct on provided tests.” |
| Input Specifications | Exact types, formats, and examples of inputs. | “Takes a list.” | “List[str]; e.g. ["racecar", "hello", "Level"].” |
| Output Specifications | Exact type/format of outputs and edge-case behaviour. | “Shows results.” | “List[str] of palindromes; if none, print ‘No palindromes’.” |
| Evaluation Criteria | How you will verify correctness, performance, and UX. Use numbering, not bullets, for these. | “Works as expected.” | “Prompts user; validates non-empty input; ignores case; passes tests for empty list / no matches; early-exit on first match for search.” |
Examples: Lists & Strings
Problem Statement
Given a list of words, identify which ones read the same forwards and backwards.
Constraints & Limitations
- Words contain only alphabetic characters.
- Comparison is case-insensitive.
- Maximum list length: 1000 words; maximum word length: 50 characters.
Objectives & Goals
- Return a list of palindromic words in their original order.
Input Specifications
- A list or array of strings, e.g.
["racecar", "hello", "Level"].
Output Specifications
- A new list containing only palindromic words, e.g.
["racecar", "Level"].
Evaluation Criteria
- System prompts the user to enter a list of words.
- Validates that the list is not empty; displays an error if it is.
- Ignores casing when checking for palindromes.
- Preserves original order of palindromes in output.
- Displays “No palindromes” when none are found.
Problem Statement
Determine whether a given target word appears in a list of vocabulary words.
Constraints & Limitations
- Comparison is case-sensitive.
- Maximum list length: 5000 words.
Objectives & Goals
- Return a Boolean value indicating presence (
true/false).
Input Specifications
- A list or array of strings, e.g.
["apple", "banana", "cherry"]. - A target string, e.g.
"banana".
Output Specifications
- A Boolean:
trueif the target is found; otherwisefalse.
Evaluation Criteria
- System prompts the user to enter both the list and the target word.
- Validates that the target word is not empty; shows an error if it is.
- Stops searching immediately once a match is found.
- Returns a clear Boolean result.
- Displays “Found” or “Not found” to the user.
Key Takeaways
- A problem specification defines the scope, constraints, and goals of a solution.
- Core components include problem statement, constraints, objectives, input/output specs, and evaluation criteria.
- Clear specifications ensure that development teams and stakeholders share the same understanding.