What I do is make lists:
- Have a laid out plan of “core” absolutely required features
- A second list of features I think should be added, but aren’t required for basic core game play.
- A third list of features I don’t need, but would be cool to add.
From there, I start coding the core game. I do tons and tons of refactoring as I go, including just code optimizing and general cleanup. Usually this is how I work on something new:
First: Get it working, even if it’s rough and coded poorly.
Second: Optimize the hell out of it, make it run as fast as humanly possible.
Third: Refactoring the hell out of it so it’s easy to read and makes sense.
After that, if down the road I discover a way to do it better, I go back and play with it again when I’m bored. (or when I’m bored is when I start playing with adding fun side-features from my cool-to-add list) But it’s no longer a priority because the current working model is “good enough”. But I’m constantly trying to improve things. For example, I’ve discovered an interesting way to speed off my off screen rendering in my lighting engine, I haven’t tried it yet because my lighting works really well anyway. But if I need a break from writing new code I’ll go back and play with it.
Usually the only time I head into a 100% functional/completed class is if I either am forced to due to adding a feature elsewhere that requires me to modify it or if I come up with a way to improve performance. But after the initial code cleanup, I seldom return to clean up some more just for the sake of cleaning and reorganizing.
Really though, since you’re fairly new, I actually do recommend rewriting your code 500 times every single time you discover a new way to do something. Reason being, the first 10 times you do it will probably suck. Once you become a skilled coder you’ll get that “warm fuzzy” knowing you did it the best way you feel is possible. Right now though the best way to learn is to do exactly what you’re doing. Write it, write it again, put it aside, learn something else, come back to it and rewrite it again, over and over. You’ll take 20 times as long to complete a game, but you’ll learn so much more that way and it’ll make the game you make after it that much better, faster and easier to develop.