I'm not an expert programmer so this may be why, but I've come to notice that whenever I create complex code (like a Chess game I recently made), I am able to write the correct code to get the program working, although I find that later on- or even a few seconds after!- I often have to pause, and think, how does this work?
Not only that, but I also tend to not think about the code, and instead I just type away. For example, in my Chess game, I decided to use a five dimensional array for processing moves, and I found I could do this without too much conscious thinking. However, when I stopped and read over it, I found it challenging to get my head round the whole five-dimensional concept, and it did take me a few a minutes to fully understand what I did, and how the code itself works.
Is it normal for programmers when writing complex code to not understand what they are doing half of the time?