|
Checklists
A Programming Pattern |
|
Prof. David Bernstein
|
| Computer Science Department |
| bernstdh@jmu.edu |
String[] (named checklist)
is very flexibleboolean[] assumes that everything
accomplished is on the checklistString[] (named completed)
is more flexible
done will contain true
if and only if checklist[index] has been completed
checklist:
"Shirts",
"Socks",
"Pants",
"Skirts"
completed for the Inflexible Variant:
"Shirts",
"Socks",
"Pants",
"Dresses",
"Shoes"
"Socks",
"Shirts",
"Skirts",
"Pants"
completed for the Flexible Variant
when needed is 2):
"Shirts",
"Socks",
"Pants",
"Dresses",
"Shoes"
"Dresses",
"Shirts"