Sunday, July 1, 2018
OCD and programming
OCD and programming
I never really thought of myself as somebody with OCD. If you read the Wikipedia article youll see its a pretty serious mental state. Im not calling it a disease. Its as bad as it could be and much as its neglected. In my case I always thought its just the massive time Im having privately with my brain. Like two bohemian lovers.
I guess the first signs appeared the very first time I have memories from. I remember as a 5 - 6 year old kid was watching the door and tiles for long times - and I was thinking what would be the best angle to turn the door in order to make the perfect angle with the tiles. There were good and bad doors. Bad doors couldnt make it right. The worst doors could almost make it right, but their shadow ruined everything. Just to give one more hint - its also important to check if the ratio of the tile edges - the part under the bottom of the door and the rest - they make a fifty fifty or even better a golden ratio.
You may ask why all the fuzz? Its about the environment and justice. You want everything to have an equal share of the global transformation. It took me ages to accept you can build unsymmetrical constructions from Lego. I had quite a lot, and all had the unsymmetrical way of creation - I was so mad. It feels like it wouldnt survive the first night in my room.
Many of you probably heard about OCD from Rain Man. Its a brilliant masterpiece. However Raymonds story is a bit more serious. Ive heard about other families from friends where child custody was revoked due to the mental state of a parent.
I also have many friends presenting light symptoms of OCD. And I think in general thats a nice little habit. In general it doesnt harm you. You feel a bit frustrated when a layout is messed up - or even worse, "almost" perfect. I have huge problems with art. I can be stressed out by the tiniest detail on a painting. I guess thats why its so outstanding when a piece of art seems to be complete and great. Usually OCD people highly appreciate balance over.
All right, its not that romantic all the time. I remember when I was using Adobe Reader on Windows. The app had a pointing hand icon where the bottom part wasnt closed. So I was trying to fit that on all the circular fonts, like U, O, H or R - just to make it stable. I guess on OS-X its even worse. It has a really handy zoom feature. Since Im on a mac I use it to make all artificial alignments pixel perfect. Trust me its a magical relief when 2 floating windows are on the same height, or some lines from different panels can be connected perfectly. I even have problem with the world famous OS-X font pixel hinting algorithm. You know, black is not black, its a bit red, its a black and a bit blue. And seeing those extra edge pixels can make life so hard.
If you dont have OCD then this might give you a little view on whats happening in some folks head. And the best - these issues we see are everywhere and every time. Mixing it with a little ADD and years are running by so quickly you wont even notice.
But then I realized I can use it in my work. That tendency to aim balance lets you to find deviation much sooner. Im quite sensitive to code quality and coding conventions. Typos and bad naming conventions are also really easy to spot. I started following a special naming convention - an important rule is to prioritize the grouping elements in the name. You know in function and variable names you have prefixes, subjects, objects, verbs and nouns and many semantical items. When youre using a IDE or Vim or grep - and youre doing file lookup youll find things faster - simply because its better sorted.
It might be only me, but I guess OCD helps when you refactor code as well. Keeping the balance also plays an important role in transformation. So eventually you accomplish a complete change and more likely you wont leave anything out.
I think its also pretty obvious that OCD doesnt let you to miss any function header comment block, right separation of logical elements through files and many many useful coding practices.
Im wondering what other mental issues could affect on your code quality. Probably depression could help you in your singleton skills or memory problems supporting you in using talkative code.
---
Im super interested if you know you have strange habits and would share some stories.
Peter