Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

What is the difference between a corner case and edge case?

by FamousLongAgo (Friar)
on Jan 13, 2003 at 12:49 UTC ( [id://226444]=perlquestion: print w/replies, xml ) Need Help??

FamousLongAgo has asked for the wisdom of the Perl Monks concerning the following question:

Fellow monks,

Please forgive a generic terminology question, but I suspect other monks may benefit from the answer as much as I will. I can't find anything relevant on Google.

I have seen the terms "corner case" and "edge case" used on several occasions in discussions about testing. I understand the general concept - points at which fencepost and overrun errors are especially likely, but is there a rigorous definition? And is there a difference between the two?

Perhaps someone has a Perl example illustrating that difference?

  • Comment on What is the difference between a corner case and edge case?

Replies are listed 'Best First'.
Re: What is the difference between a corner case and edge case? (boundary count)
by tye (Sage) on Jan 13, 2003 at 16:28 UTC

    An edge case is where the program logic meets a boundary condition. A corner case is where you meet more than one boundary condition at once.

    Edge cases are things you should test for in your unit tests because they are a very common place for bugs to be. Corner cases are usually talked about in terms of "I found a bug, but it is a bit of a corner case so it might not be worth fixing", that is, it will be encountered very rarely.

                    - tye
      Based on this first paragraph:

      An edge case is where the program logic meets a boundary condition. A corner case is where you meet more than one boundary condition at once.

      I'm tempted to supplement the second paragraph with:

      Corner cases may also be ones that seem impossible when they actually are encountered, which in turn consumes a lot more time in the fixing (due to a larger number of false-starts and irrelevant quadruple checks when debugging), and ultimately causes the hardest forehead-slapping once they are finally solved, as in "who would have thought that these two simple, unrelated conditions could have produced such a bizarre result???"

      Thanks! I had been using "corner case" to mean "edge case" so far without even knowing about the latter. Terminology is very important to me, so your excellent clarification is much appreciated.

      Makeshifts last the longest.

Re: What is the difference between a corner case and edge case?
by jmcnamara (Monsignor) on Jan 13, 2003 at 12:56 UTC

    A corner case contains two or more edge cases. :-)

    Seriously, it is loose terminology. Probably like the way people often use stress and strain to mean the same thing.

    --
    John.

      That's a good example. Within an engineering community, stress and strain have an exact meaning (stress => compression, strain => tension), and people who misuse the terms brand themselves as weenies. Or, at least, non-engineers. I'm worried there's an equally sharp (and useful) distinction I'm missing here.

        I offer this nitpick about non-computer issues to the monestary in the interests of academic completeness.
        Within an engineering community, stress and strain have an exact meaning (stress => compression, strain => tension), and people who misuse the terms brand themselves as weenies. Or, at least, non-engineers.

        Non-engineer, definitely. :) Strain can be thought of as a measure of movement, and stress as a measure of force. Your example sounds to me like you're saying "I weigh 17 inches." - nonsense. So here's a mini-tutorial on stress, strain, and the like, because I know you're dying to learn about solid mechanics today.

        Stress is essentially a measure of how much force exists in a unit area of something - a basic expresion is s=p/a (though stress should be written sigma - σ). Stress can be thought of as pressure. Take a pencil, put the point down on your desk, and press on the eraser head - it doesn't hurt. Would it hurt if you had the eraser head on the desk and your palm was pressing against the pencil lead? There is less pencil area for the force of your hand to act on, so the stress is higher. (BTW, if you really want me to, I can explain bending stresses (s=M*c/I) as well.)

        Strain is a measure of the change of length of something - expressed as e=change/length (and e should be written epsilon - ε). If I have a spring which is an inch long, and I compress it, it may change length .5 inches. If I take a spring which is 10 inches long, but otherwise identical, and I compress it, I'll get much more length change than .5 inches. Strain is a ratio measure of length change.

        A reason that lay-people often use the terms interchangably is that the two are related. Hook's law is an empirical relationship which states that stress and strain are directly related : s=e*E (or σ=ε*E for those browsers which support HTML entities). The constant 'E' is Young's Modulus, also called the Modulus of Elasticity; you can think of it as a measure of how much force it takes to compress a spring, the two concepts are very close.

        I don't know what jmcnamara meant when he offered up his example - I'll assume that he knew what stress and strain are. So now you know a little about solid mechanics.

Re: What is the difference between a corner case and edge case?
by scain (Curate) on Jan 13, 2003 at 13:36 UTC
    I believe it comes from numerical methods, specifically for solving multidimentional differential equations. In order to solve a 2D differential equation, you need initial conditions at the boundaries; along the sides, you have one condition that must be met. At the corners, you have two conditions that must met, and frequently, that is where the problems happen.

    Minor update: I should more properly have referred to those conditions as boundary conditions, that have to true all the time. In order to solve a 2d differential equation, you also need initial conditions describing the state of the surface initially (at t=0).

    Scott
    Project coordinator of the Generic Model Organism Database Project

Re: What is the difference between a corner case and edge case?
by mydoghasworms (Initiate) on Oct 15, 2019 at 10:13 UTC
    After recently taking up the Rubik's cube, I have come to the conclusion that the terms "corner case" and "edge case" originate from there. Perhaps I'm wrong. But it's nice to think so. Because there are lots of corner and edge cases (literally) when solving a cube.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://226444]
Approved by gjb
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2024-06-19 21:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.