Always Carry Map

10 Dec 2020

Blog first, then code more–if i’m still awake enough.

Today, i showed my passing specs to Micah. I felt good that I’d gotten them all to pass, but I cannot say that I felt good about my product and thus the code I’d written. The next step was to organize my thoughts with Micah and describe how i wanted the code to flow.

We worked together to build a flow chart type thing, labelling all dependencies, implementations, core functions, and classes. I’m actually glad that I was then told to write it again from scratch based on this flow chart. It should come out a lot better the second time around since it will be more about organization opposed to rushing to learn and make it all work.

It’s funny, now that I have maps pretty well established in java, I am experiencing real deja-vu. If you recall, months ago while I was writing tic-tac-toe, i wrote about an epiphany in which, I’d realized that I could just created one big game map and pass that from function to function. I recall saying i kind of wanted to start all over with ttt in order to do it right and to start with one big game function.

In some sense I got to do that when i re-organized my gui game to be like the terminal game by passing one map from main all the way through the game. Well, recall last night, I turned the whole request message into one big map and started passing it around the whole server, so the same exact same thing happened! I wrote the program, made it work, then cleaned it up by putting everything that was being passed from place to place into a map.

Maps are the best! They can take you from place to place or class to class as long as you carry them along with you.

Next time i begin on a project, I need to remember this, and just start from the get-go with a map. I’m doing that now during this re-write. It should make things go a lot smoother I think.