Wednesday, March 30, 2011

How do you call those little annoying cases you have to check all the time?

How do you call those little annoying cases that has to be checked , like "it's the first time someone entered a record / delete the last record in a linked list (in c implementation) / ... " ?

The only term I know translates not-very-nicely to "end-cases" . Does it have a better name?

From stackoverflow
  • Edge cases.

  • I call it work ;-).

    Because they pay me for it.

    But edge cases (as mentioned before) is probably a more correct name.

  • Corner cases

  • Ever prof I have ever had has referred to them as boundary cases or special cases.

  • I call them "nigglies". But, to be honest, I don't care about the linked list one any more.

    Because memory is cheap, I always implement lists so that an empty list contains two special nodes, first and last.

    When searching, I iterate from first->next to last->prev inclusively (so I'm not looking at the sentinel first/last nodes).

    When I insert, I use this same limit to find the insertion point - that guarantees that I'm never inserting before first or after last, so I only ever have to use the "insert-in-the-middle" case.

    When I delete, it's similar. Because you can't delete the first or last node, the deletion code only has to use the "insert-in-the-middle" case as well.

    Granted, that's just me being lazy. In addition, I don't do a lot of C work any more anyway, and I have a huge code library to draw on, so my days of implementing new linked lists are long gone.

  • I use the term special cases

0 comments:

Post a Comment