See this page as a slide show
- Homework assignments come with requirements.
- Requirements are not written in legalese.
- Rather, you are required to extrapolate from what is given.
- Recognize ambiguity. Ask for a resolution.
Consider the requirements for a homework assignment:
Read two integers. If the first isn’t divisible by the second,
You might reason:
All numbers are divisible by all other numbers, just not evenly
(you forgot about zero). Therefore, I never have to print “Oops!”
Or, you might think:
The assignment doesn’t say what to do if it is divisible.
I’ll print “Oops!” unconditionally!
You might get away with that sort of reasoning in court, but not here.
Use Your Head
- Assume that I’m not an idiot—the requirement must be there for a reason.
- If the requirement makes no sense to you, then you need to seek
- The requirement might be deliberately ambiguous:
- I might just want an error message, but not particularly care
about the wording, as long as it makes sense.
- It might be there as a test.
- I might have just screwed up.
- This isn’t a holy book written centuries ago. Ask!
- Of course, if you first read the assignment a half-hour before it’s due,
asking is more difficult.
- In the REAL WORLD, requirements are quite informal.
- Your boss might say, “Notify us if too
many invalid web page fetches are attempted.”
- You might respond:
You would then sit back, cross your arms, and smirk, because you won.
- “Sorry, but your specification is totally imprecise!”
- “What should the text of the error messages be?”
- “Precisely how do you define ‘invalid’?”
- “How many is ‘too many’?”
- Your next task includes cleaning toilets.
- Instead, the boss expects you to use your brain,
and resolve ambiguities.
- You should return to your boss with your interpretation of the assignment:
- “I’ll write a program that scans web sever logs.”
- “It’ll run daily, from cron.”
- “It’ll react to HTTP/HTTPS GETs that aren’t response 200.”
- “It’ll react to more than ten bad accesses in a minute.”
- Your boss will either say “Yeah, that’s fine” or correct you.
- Happiness ensues!