The problem of automatic code merging

In the past two weeks I have been ‘frantically merging two bases of code‘. However, the widely used method of automatic merge turned out to be a dangerous practice. I’m writing this post to illustrate some of the problems (of either totally trusting the automatic merge, or a combination of our specific code modding practice combined with automatic merging).

Penn State’s Amazing Race, The Customizable Version

I needed a break in a long code merging session, so I improved the Penn State’s Amazing Race by separating its code and data, so faculty can now easily change the question set for their specific use. I also fixed a few things so now it can run on any local machines (note that Google Earth still requires internet access to read its earth data).

What I did was extract the section of the hard-coded questions, replace that with a synchronous Ajax call to read in a JSON data set, so now all the questions are laid out in a separate text file, with JSON format. JSON is a simple and clean format for both users and coders.
I learned a few things that are not apparent in any documents I found:
1. JSON does not support comments, so the compromise is to use a variable called “_comment”. I use an array to include multi-line comments.
2. JSON does not support raw TAB in its data, i.e. within the quotation marks, there should not be any TABs. I replaced them with spelled out spaces.