Here's the thing. Programming is incredibly complicated. Unless you're a robot or at least a lot more intelligent than me, there's no way you can think through all the bazillions of subproblems (many of them rather trivial) when thinking about how to solve a programming problem. You have to be able to solve those subproblems as they come up while coding. In order to be able to do that, you have to have a lot of routine. Writing a lot of code helps you get that routine.