Personal Productivity Stack Exchange is a question and answer site for people wanting to improve their personal productivity. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I asked this earlier but it seems that it was misunderstood, and it looks like this was too, or perhaps I just couldn't explain it, so I'm rewriting this (once again..).

Let me start. When I was a kid (8-9, perhaps), I sometimes used to feel uncomfortable and kept repeating an action so I would feel better. Time went by, I grew up (it's been just 5-6 years, but anyway..), the feelings and thoughts remain, even worse now, actually. I'm always touching my hair, messing with it, or when I'm working (programming) I just check, recheck and rewrite code over and over, eventually running out of time and nothing actually gets done. The feeling of fear, the thoughts about the code I didn't rewrite, it's just.. impossible to control. I feel like just wasting all my time on nothing. I eventually give up of the projects, but I realise that doesn't help me. There are other symptions, but I think these examples are enough. I suspect I suffer from OCD and I've been researching about it and possible treatments, but I'm just 13, so, hm, contacting a psychologist is probably not an option. Another weird feeling I have is that I get that exact same feeling of fear, or whatever may it be, like when I'm coding, when I see a word with some letters like "s", "g", but it depends on which word (e.g. it happens with "string" but not "std", it happens with "google" but not "Google" or "Good"), I can't explain it, just weird - perhaps that actually has to do with the problem when coding.

I started watching the videos from Katie D'Ath a little ago, seems fine:

I was hoping somebody could help me with this, thanks.

share|improve this question
Thinking about this comment might help you -- and it might help you ask the question in a way more likely to get you the answers you want. 1) are you clear on what the big picture is for the project? 2) are you clear on the parts, especially your part? 3) are you breaking the problem down either in a functional or object way? 4) are you having trouble with your environment (locations of files, paths, configuration, tools)? 5) Are you finding that what you have already done is buggy, not extensible, not understandable? 6) Is your understanding of the programming language incomplete? – Arbalest Oct 1 '13 at 4:08
I was going to add more possible places that you might get stuck but you get the idea. Think about the problem you are having until you can articulate it clearly and some of those problems might resolve themselves. If there is more than one of the above (or others) remaining then consider making a separate question for each on the appropriate site. – Arbalest Oct 1 '13 at 4:18
Let us see your code, this way it will be easier to help. – Viclib Oct 1 '13 at 8:45
up vote 1 down vote accepted

You believe that you may suffer from Obsessive compulsive disorder. It is best treated with Cognitive behavioral therapy. In your case, it means subjecting you to the anxiety that results from not rewriting your code. Start with something small, then leave larger parts of your code as is. In this way, you learn that you don’t need the rewriting ritual to get rid of your anxiety.

share|improve this answer
Quite a delay here but.. can you explain a little more the "..leave larger parts of your code as is." part? – ixjf Nov 30 '13 at 22:28
@ijx: The idea with CBT is to subject yourself to ever greater doses of things that irrationally give you anxiety. It is effective for OCD as well as fear of elevators or spiders. Good luck! – Gruber Dec 2 '13 at 13:26
Ah, right. Just what I thought. I've also been watching videos from Katie d'Ath on Youtube (CBT therapist), I'll try my best, although it will be hard to get through it. – ixjf Dec 3 '13 at 19:11

Unless it's a foundational library building project, I think writing perfect code is not fruitful. Since you are asking the question here, you surely agree with me on this.

I used to struggle with similar symptoms. I do have perfectionism, and I love fast yet general code, but at the same time I acknowledge leaky abstraction and the evil premature optimization. In addition, requirement for your software changes all the time, so by definition your code cannot be perfect. I learned to write less-perfect code, and thus became a more productive coder through learning extreme programming. Here are some suggestions:

  1. Do test-driven programming. Once you write your specification, only implement until all test cases pass. Stop improving if you don't have to.
  2. Find someone to work with if you can. Working together can allow you to see the bigger picture.
  3. Do not write general code for something that will only be used once. Use the rule of three.
  4. Commit on a deadline. Tell your friends that you will show them a piece of software with certain functional specification.

If you are really obsessed with perfect code. Perhaps you should write some intentionally not-so perfect looking code, and use it to something as a practice. Also, you might want to check if your tendency is due to fear of failure.

Good luck!

share|improve this answer
+1 for TDD. Spend some time setting up tests for your project (it's fun to set up). Then think of a minimum feature/function that you need to have. Write a minimal test that exercises it. Run it, it should fail. Write the code that implements it. Run the test and fix the code until it succeeds. Repeat. TDD really helps keeping focus on your code goals. – w00t Oct 1 '13 at 21:08

Another possibility is to reduce the scope of the project. Pare the project down to the absolute bare essentials and build that. Remove any embellishment, and bells and whistles and instead concentrate on the core. That way you end up with something simple and elegant - the kind of thing you're trying to achieve by rewriting and restructuring.

share|improve this answer

I am a programmer, I work for others and I have my own products, too.

I think you are passionate about programming, so the other problems can be easily solved.

  1. I recommend you to follow SDLC (software development life cycle) if your project is not too small.
  2. Never start coding right away without a crystal clear understanding of the overall system and what you are going to code. This helps reduce rewriting.
  3. Once you know the system thoroughly, never look at it as a whole. Split the big problem in small chunks and start working on them one at at time. (All the best managers use this formula.)
  4. If you start coding the application from one end to another, you will take at least 5 times more resources (time, effort, money, etc.) Divide and conquer.
  5. If the problem is too big, go with a top-down approach. If it's smaller, start with hello world and expand it.

Hope it helps.

share|improve this answer
Once you know what you are going to create (the application), you will be confused where to begin and how to finish. I have seen people starting to code without having a clear idea of what are they going to do. I think I learned this from Tony Robbins' teachings, that we should split the big picture in to small chunks and then work on one piece at a time. This way, one will not see the big problem, but achievable smaller problems. This is a general idea, applicable everywhere. In computer science, 'divide and conquer' is a similar concept. – pMan Oct 10 '13 at 8:44

That really sounds exactly like OCD, including the "fear" or superstition about certain letters or letter combinations. Do these sorts of problems manifest outside of writing code? Either way, though, I think what you are experiencing goes beyond perfectionism regarding coding. I really urge you to consult a professional, as OCD and anxiety in general (OCD is anxiety based) can manifest themselves in different ways at different periods in your life. I overcame repetitive actions when I was 9 years old (I actually CBT'd myself, without knowing it), realizing much later in life that what I'd had was actually OCD. For a long time I thought I had overcome OCD, but I realize more and more that there are many facets of my personality, ways of thinking, etc, that are related to it, but which manifest differently from how they did in my childhood. I did not have professional help as a child, but I think if I had, I would be better equipped to deal with all its subtle nuances now, which are mostly to do with worry and obsessive thinking about things that worry me.

You say a psychologist (or psychiatrist) isn't an option - have you spoken to your parents about this, or a school guidance counselor? It sounds like the problems aren't too serious, in which case just a few sessions might be enough to give you adequate lifelong skills to deal with your fears.

I don't want to scare you unduly - people can go their whole lives without realizing they have OCD and never having any serious deficits because of it. I myself am not a lost cause, but I think sometimes simple things are more difficult for me than for others. You talk about "fear" and "feeling uncomfortable", and surely you would be better off learning how to allay these feelings and live free of them.

share|improve this answer
These problems do manifest outside of writing code, yeah - designing, even a simple text, this text, I'm always thinking "this word, it looks so bad" and I'm feeling that fear while I write it, although I can handle it, even though I many times rewrite/change it multiple times, but it's harder with code, I have to look at code many times, make changes, etc. I have never spoken to my parents about this since I'm quite sure they would just ignore me, think I'm going crazy. Either way, I don't know how much those sessions cost, but they probably can't afford it. – ixjf Jan 1 '14 at 20:20

Get some professional help. I'm not saying there is something wrong with you, it's just that you don't feel comfortable on several points and you could use help figuring out what is going on. It could be as simple as your hormones all mixed up and the usual feelings of uncertainty, both having to do with your age. Someone (semi-)professional who knows how to listen and ask questions can make all the difference.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.