Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

2
  • 7
    +1 for encapsulation. The worst off-by-one bugs I have ever seen are when part of the program is 1-based and part is 0-based, and every single function it is used, you have to remember which one it was and whether you have to do the conversion or not and which direction to go. A couple months ago I had to track down a difficult off-by-2 error because poor encapsulation meant someone made off-by-1 errors in two separate compounding places. There were conversions all over the place that were impossible to follow and I was able to get it down to one conversion in one method. Commented Feb 2, 2011 at 19:26
  • 2
    I'd love to learn more about the science of this if anyone has more info. I also think this is why programatic styling, like CSS, is so frustrating where everything is edges... Commented Aug 12, 2016 at 1:48