DEV Community

Discussion on: What's the dumbest bug you caused yourself

Collapse
 
bgadrian profile image
Adrian B.G. • Edited

Every big bug/issue I wrote changed the way I think&code, to avoid them in the future, examples:

  • I don't use negation operator, I'm always explicit if (a == false)
  • I use verbose variables after I've spent many hours on a bug like:
//big event loop, within a huge 2D grid game system
//..lots of code
for (x=0; ..; x++) {
    for(y=0;...;y++{
       //lots of code

       //search for a neighbour
       for(x=...;x..){
        }

    }
}//spend many hours to find out why the map was not rendered correctly

I don't remember the specifics, I think it was a shadowing and not declaring var mix of issue, nevertheless now I will try explicitly to avoid i,j,x,y in loops, and ofc I use linters in big projects and static typed languages :))