Usually I code in phases, figuring out the solution, which requires a lot of thinking and expermenting and trials and errors, but once I find what I think is a promising solution I might end up writing lots of code; in this phase I sort of feel that the code comes out of me without a clear conscious effort. This phase might last a few hours or a few days and I'm often limited by my typing speed and the responsiveness of my editor; in a away the code on the screen becomes part of my mental process (similarly sometimes I have to scribble on a piece of paper just to get my mental processes runnin). After that, I snap out and start compiling the code (I program in c++, so 10s of thousands of lines of errors are routine), clean it up and usually end up deleting large chunks of code. Note I'm fully aware of the code I have written but have little recollection of the actual act of writing. After this I might switch to write tests (which Is a much more conscious activity) or move back to phase one.
I'm fully aware that's not how most developers work, according to my boss, when I tell him I haven't compiled my code in a few days, I'm just strange.