if(!IsOK())Do you see the problem?
OkDoIt();
else
NoWait();
Yes, only one character ruined the whole process.
It should be like this:
if(IsOK()) // if(!IsOK())If the function containing this problem is rarely called, it's a time bomb inside a briefcase. Even after you recognize something is wrong, it's very hard to find this kind of mistakes because it's such a small one like off-by-one error. almost invisible. That's why small mistakes can be much more disastrous than big ones which are obviously more visible.
OkDoIt();
else
NoWait();
Since code like the above is usually written very quickly and unconsciously without thinking, if you don't have right habits, you will make a mistake. It brings me the idea I loved but, apparently, forgot.
Good programmers have good programming habits.I will never use ! in if statement. ever.
One more thing to remember.
Test every changes you made.Every single line.Of course, I tested my changes before I checked in it. However, there were many changes and I just quickly checked a normal flow without checking all the changes I made. I was focusing on bigger and more complicated changes. I should have kept my changes small and checked in them more frequently.
Anyway, it's absolutely my fault and I will never forget it.
I really don't think anything I do is a mistake. It could be if I didn't learn from it.- Fiona Apple