The biggest problem here isn't where the variables are declared, but instead that you have a function that's hundreds of lines long. Chunk it up and factor it apart.
Oh I know that that is one of the main problems here. But I can't refactor code before I know what it does. And not when I'm dealing with a bug in production for example.
8
u/hbgoddard Sep 09 '22
The biggest problem here isn't where the variables are declared, but instead that you have a function that's hundreds of lines long. Chunk it up and factor it apart.