Day 4, data structures 2

There are two sprints for data structures, with two days per sprint. My pair and I finished the first data structure sprint yesterday and started to work on the second data structure sprint today. We implemented LinkedList, Tree and Set today.

One thing that really slowed us down was debugging the contains function for Tree. Because the contains function needs to search recursively, the function was written as a recursive search. However, when we passed the result around as a parameter of the function, we override results from our previous round. This creates enormous confusion and it takes us a good two hours to find the bug. I swear that from now on, when possible, I will try to avoid pass results in recursive function. Using a global variable is less clean, but much easier to read and debug.

Something important for today:

– Testing. During testing, only test the interface, and nothing else.

– Coding convention about capitalized function names. A capitalized function is supposed to be run with the new key word. For example, we should run: new Tree() or makeTree().

– Constructors in JS is only referred to the psedoclassical style(?) maker function.


Yes. There are so much to learn about Git such that we could have a lecture for it everyday. Marcus did a fantastic job today on Git and my understanding is getting much better.

First, I realized that pull request is a GitHub feature, not a Git feature.

Second, I realized that SHA is the unique ID associated with each state, and all the other stuff (branch names, tag names, HEAD) are variable names referring to SHA. As long as I accept the fact that Git will point those variable names to different SHA automatically in the background, life is not that complicated.

Third, HEAD is almost the same as the “you are here” star in the maps.

Fourth, I am guessing that the difference between fast-forward merge and none-fast-forward merge is whether a new SHA has been created or not, but I am not 100% sure.