Mar 09 2010
I like to take pride in the code that I write. I like order and efficiency in general, and specifically in what I create and use. It therefore bothers me to see messy code, which usually includes layers upon layers of patches, each an attempt to fix / work around / cover up bugs in previously written lines of code. My approach is that you should write with the forward vision of changes to come. Any future features / bug fixes should be easy to implement and add, because the code was originally written to be easy to read and easy to understand and was planned to be modifiable and maintainable.
Most importantly, if you reach a point where the existing code does not allow you to do this (either because it was written badly or because the new features require unforeseen overhauls), then scrap it and re-write with your new vision. It will save you much frustration now, as opposed to trying to debug ugly patches, and later on when you encounter the need for even more features and bug fixes.
Naturally (for me, anyway) I expected to use this approach with regards to myself. My attitude towards my own mental processes was that if something isn’t working properly then I should fix it. If this meant learning new behaviour I expected to delete the old behaviour as part of that process. I’ve lately been taught that humans just don’t work that way.
A physiological example is in the development of the nervous system. Babies are born with certain reflexes, for example, which seem to disappear in later age. In fact the ‘circuits’ for these original reflexes aren’t removed, but newer so-called ‘circuits’ (patches in the code) grow and / or mature, which overpower the originals, and effect a new and different behaviour of the system. Again, the original mechanism is still there, underneath the patches. Certain neurological trauma may even disable the overpowering mechanism, exposing the original response as exhibited by newborns.
Our mental faculties are similar.
As children we’re more prone to react immediately to our urges, disregarding or even unaware of the needs of anyone around us or of the limitations of our current environment. Growing up we learn to take into account all of the factors around us and restrain ourselves as necessary. We learn that some urges can be satisfied here and now, some can be satisfied somewhere else and now, some will wait for later, and some will not be satisfied at all. We also learn to differentiate between these cases. In fact it seems that this learning fills up most of growing up.
It’s easy to know this, but not always easy to achieve it (How many adults have you seen behaving like children only today?). The thing is that I had expected this process to include the writing off of the childish urges. I had expected to delete their code and replace it with the clean and efficient code of adult behaviour. But it doesn’t work like that. The urges stay. You just have to write really good patches.