|
|
|
|
|
by Pfhreak
2490 days ago
|
|
I usually sketch out what I'm going to write with comments and/or function names. It gives me the sort of 'blocks' of how data is going to flow, where responsibility is divided, etc. Then I go back in and fill the details of the block. Five or six comments becomes five or six chunks of code. I don't usually try to maintain an entire state in my head, but I do try to make sure each of those blocks is something that I can reason about and hold the entire state of. If I'm finding it hard to figure out what each block does with data, I subdivide and write two comments. For example, I might write something like: // Iterate over every transform and do the matrix math and realize that there's too much for me to hold mentally, so I'll do this: // Iterate over every transform // Invert each matrix // Get the position vector // Multiply by the character's scalar ... etc. After that all scans, then I'll start writing the actual code. |
|