If I just deleted the code by itself, I absolutely would get in trouble. Instead, I try to write small bits of code that allows us to replace very large bits of code. As an example, since our program simulates a box full of atoms, a very common task is going through every possible pair of atoms and checking how they act together. If you just have three atoms (H, C, and O), then you have three possible pairs (HC, HO, and CO). When you have a million atoms, you have almost half a trillion different pairs.
There’s a lot of busywork involved in keeping track of all of the pairs and this was done at about forty different places in the program. I wrote a small bit of code that could do all of the busy work in a general way. I then went through and deleted the forty different places we had the busywork and replaced them with a single line of my new, general way.
Since there might be half a trillion different pairs to look at, this is usually a very slow process. Every time I make my single, general method faster, I now make the program faster in forty different places, instead of have to make forty different changes.
That’s part of why deleting code is so exciting for me – it’s usually a good sign that the code everything will be faster and more stable in the future. Whenever I delete the code, I also get to delete all the bugs in that code!
That’s a good question! Always, always and always! If it’s my own code, I can only be angry at myself and most of the time it means I have to repeat some work. If, however, I happen (for some unknown reason) mistakenly delete someone else’s code or file, oh dear – that’s a bit of a problem too. Luckily, most of the server also do have a strong supporting IT team that helps to recover lost files (sometimes even pieces of code) so this can be fixed!
Being a theorist, I essentially work on my own and so the code is mine and anything stupid I do with just makes more work for me. Anyway, I always regularly back up my code and so if anything does happen and can always recover a more-or-less up-to-date version.
Comments
Tereza commented on :
That’s a good question! Always, always and always! If it’s my own code, I can only be angry at myself and most of the time it means I have to repeat some work. If, however, I happen (for some unknown reason) mistakenly delete someone else’s code or file, oh dear – that’s a bit of a problem too. Luckily, most of the server also do have a strong supporting IT team that helps to recover lost files (sometimes even pieces of code) so this can be fixed!
Philip commented on :
Being a theorist, I essentially work on my own and so the code is mine and anything stupid I do with just makes more work for me. Anyway, I always regularly back up my code and so if anything does happen and can always recover a more-or-less up-to-date version.