Leave everything clean when you leave

I have already told you what I have been doing these two months, but I want to say goodbye to this experience by adding some final thoughts that are not so obvious.
Most of us students have always worked for ourselves. Sometimes we have had group work, or we have had to present our work, but always in a totally controlled environment, and always with rather small and simple things. What happens when you are part of a gigantic project? When you have to touch something that has been touched by dozens of people before you, and that will still be used by many others after you are gone?
If there is one thing we have all done, myself included, in these two months, it is programming. And when you program in code that belongs to other people and will be used by others, that comes with a certain responsibility. You can’t just go in and do things any way you want, leave something a mess because it works anyway, or use whatever programming style you like, without thinking about how the rest of the code is written.
These two months I have been working on modifying the iPIC3D code, a code, as I said, for plasma simulations. In my previous post I explained what I programmed, but I didn’t tell you how I did it. And that is just as important.
Imagine if I had arrived, got into one of the many modules of the code, and started to define variables and write routines. I might have ended up with similar results. Why not? It’s not so different from doing it on your own. My post-processing routines need little more than knowing what shape your inputs are in and where to get the information you need. I could have done it all fast and furious and it would have worked.
But then those routines would have been inefficient, which would have been a problem in the future. And even worse: they would have been almost impossible to modify and improve by other people. How many of you, if you have ever programmed, have written code that only you could understand and use? We have all sinned at it, especially in personal programs that will never be used by other people. But, when you work with something beyond yourself, this becomes important.
My post-processing routines are written in the same style as the rest of the code, commented according to the same rules, and make use of everything possible to avoid unnecessary calculations that might have resulted from not studying the code properly before starting work. If now someone, who neither knows me nor has contacted me nor knows what I have done in the code, wants to modify my routines, they will be able to do so without any problems. They have all the information and facilities they need in the code.
And part of working on a collaborative code is to hide in it, leave everything as tidy and clean as possible, and, when you leave, nobody needs you for anything, because the code you have written is not yours, it belongs to the programme.
If you ever work on a programming project, never forget this. Your colleagues, the ones that are there now and the ones who will come when you are no longer there, will thank you for it.
Leave a Reply