I got a good amount done on the Connect! refactor last night and this morning. It has gone from a single source file with 523 lines to 10 source files with 509 lines.
I am reminded of numerous new developers I’ve seen over the years. Typically one of the hallmarks of new developers is the “one big honking source file”, which I found myself doing here until yesterday, when I got fed up and was reminded of why it is a bad idea to do that.
One, things were getting hard to find. Where was the function that creates the buttons again? Oh! There it is, stuck amidst the code that animates and hides the cheerleader.
Now I simply look in buttons.js.
The likely next step is to split out the rendering stuff into a boardView class.
I also need to change the general layout. Right now, everything gets placed into a single <div>, which would make it a pain to resize and move stuff around when it comes time to change the size of the board. The next idea for that is to put <div>s inside of the big <div>, and move the little <div>s around, which means the stuff *INSIDE* the <div>s don’t have to worry about the positions of things outside of their <div>.
(Basically, I’m implementing subframes).