Pathologies
The Interesting Pathologies
We identified three "sad cases" (the other common term for pathologies) in
add()
. Now,
Let's examine them and determine which ones are interesting. This is where we apply the Judgment Premise, since not every
conceivable failure is interesting.Remember the context: We write TailQueue
(and Tail
) as part of a larger Air Traffic Control system.
In each case below, please indicate whether you deem it 'Interesting' or 'Not Interesting'.
TailQueue runs out of memory while adding a Tail.
add()
receives a Tail that is already queued and returns a tailAlreadyInQueueError
. Commentary
We think this case is interesting, if only because the developer wrote special code
(including a custom enum type!) to handle it. We assume the developer had done the likelihood/impact analysis and decided the pathology needed attention. That said, the code is probably better designed to make this case impossible.
(Reading...)
add()
receives a NULL parameter and and throws memory access violation. Commentary
We think this pathology is not interesting. Its likelihood, if we write good code, should be zero (remember: this is our code,
not an open API that anyone could pass any arguments into). Its impact is also low,
since NULL doesn't refer to any "real" objects.
(Reading...)
(Reading...)
Formatting Hints:
To format... | use this markup: |
---|---|
source code | {source:lang=java|lineNumbers=false}...{source} (Supported languages: java, cpp, csharp, c, python.) |
bold text | __some text__ |
italicized text | ~~some text~~ |
underlined text | @@some text@@ |
a method or class name | ``myMethod(...)`` |
Tail
object), its impact can be catastrophic: not only is an out-of-memory exception traveling through the system risky, a Tail (i.e. an airplane) will go unheeded. Therefore, we think this pathology is interesting. Notice though thatTailQueue
itself doesn't handle this situation if it arises; it merely lets the out-of-memory exception propagate — but if we want to test this, we must ascertain that this exception is in fact thrown and is handled properly.