I take a multi-pronged aproach to coding.
I usually make a few seperate study projects to get an idea of how things work and then combine them.
I might create the logic for game flow or ai etc, and experiment with them using a text based program, when it works well I have something to go on.
then i'll compile different elements together and see how the work.
I find the process of making a lot of smaller study programs helps to finalize logic in a way that allows things to be combined easily, rather than doing something one way, putting heaps of work into it and then realizing that to do something else requires massive recoding or inefficient processes.
I just find compatable methods of doing things and string them together as functions or subroutines.
Just like being able to see the next 20 tetris pieces before they come down, things just fit better.
I go for a lot of walks between coding bursts so i can stretch my legs and think about logic, having 1-2 hours to walk home before i can code out an idea allows me to develope the idea further, so when I get home im set to go and blast it out.
I also physically write down conceptual ideas, coding ideas, art ideas
I make todo checklists and mark them off as I go, the unfinished ones make for walk time puzzles.
I guess long story short,
I puzzle over it mentally until I find a certain logical methode of creating something.
then I explore options with coding studies.
then I click the studies together like lego
I compile a lot and add in temporary subroutines to tweak variables to get things behaving well. I write em down on paper and then fix em in the code.
Sometimes I like to use words out of contents