dyslexic
edit
qrcode
+=-

Skill: Extreme / Edge Cases


Critical Thinking for COS 265

What does it mean to consider "extreme / edge cases"?


This critical thinking skill is method of systematically analyzing a complex problem for subproblems that are not well handled by the proposed solution. An important note: while a general solution is desirable for a given problem, as it would solve problem under all conditions, a general solution may not be obvious or even possible to develop. This critical thinking skill complements the skill of similar problem / fewer variables.

Why should I use it?


When should I use it?


How can this type of thinking help me?


Changing the context under which a complex problem manifests can sometimes over-complicate the process of understanding the problem, thereby making a general solution even more difficult to develop. A solution for a similar but simpler problem might handle the general conditions but leave specific conditions unhandled or handled incorrectly. Understanding the edge cases for the proposed solution will deepen your understanding of the problem in general. Additionally, developing the skill of extreme / edge cases will help in debugging your code or in reporting bugs in other's code.


How do I use it?


  1. Identify the general conditions under which the solution breaks.
  2. Identify the specific parts of the solution that contribute to the conditions of the edge case by systematically removing extraneous, unrelated, or correct sub-solutions.
    • Determining a part does not contribute to the edge case involves carefully proving that the part is correct under the general edge case conditions.
    • Take care when doing this as the parts that lead to the edge case condition may be broken into seemingly unrelated by parts.
    • Also keep in mind that the conditions for the edge case may be caused by nondeterminism.
  3. Find a specific solution to the specific part to handle the edge case.
  4. Make note of the following:
    • the edge case conditions (how to reproduce the edge case)
    • how the initial proposed solution did not solve the problem
    • how the specific solution fits into the original solution
  5. Revisit the set of solutions and attempt to synthesize them into a more general solution.
    • Categorizing the edge cases may help identify patterns and more elegant solutions to the general problem.
    • Note that a more general solution may actually resolve other edge cases that have not been discovered, yet.
  6. Ask a trusted, knowledgeable person (expert) if the generalization seems sound and complete and if there are missing/unhandled edge cases.
  7. Evaluate whether the solution was successful. A good solution should successfully handle any of the specific contexts you identified.

What other critical thinking skills are often used with this skill?


Example


Most data structures are straightforward to implement for the general state, but they can pose challenges in particular configurations. In fact, most of these algorithms can be drawn up easily on a whiteboard.

For example, enqueueing on or dequeueing from a OnePointerQueue using singly-linked list is simple when the queue is nonempty (perhaps has many stored elements), but the algorithms become nontrivial when dealing with nearly empty queues.

Some possible scenarios and inputs could be:

By considering these edge cases, you can create unit tests to ensure that your implementation performs correctly under general input.