Most people don't know about programming and don't know what goes on inside a true programmer. Well, we programmers have true happiness. One of them is this.

First you get a complex logic to code, you don't have a clue about it. Then you ponder about it, you get some kind of logic and test it against real world, it fails, then you rephrase your logic, adding more variables and blah blah, and after many many many iterations you have got the solution.

Your not in your lab when you think and refine your code, its your mind that acts as a lab, finding the solution you want to implement, and it takes just 15 minutes to do it. But you don't code now as you know how to solve it and the thrill of solving it is gone.

That moment when all refinements are over and the logic becomes perfect in your mind is a true moment of happiness for a programmer.