Over the past few weeks we have been tasked with the design and creation of the first part of our compiler, the scanner.The past two to three weeks have been an interesting introduction to some of the more nuanced or less talked about parts of computer science like unit testing and version control.
One of the most important things that I used throughout iteration 1 was unit testing. Through the use of unit tests I was very easily able to see where I had a problem when I was creating my regular expressions and could go back and change them without much of a problem. While this was useful for creating and checking regular expressions to me the place where these tests shine is when you are creating semi-complex/ complex functions like the scan function. Multiple times throughout the creation of the scan function unit testing saved me what probably would have been hours of debugging by catching the small mistakes before they could escalate into full blown problems.
While working on this iteration I only really encountered 2 problems worth mentioning. The first was with the string literal regular expression. After I had completed my scan method to a point where I wanted to try the provided tests I ran the tests and on the last one it would always hang. After reading over the file it was trying to scan I wouldn't figure out what the problem was and had to start commenting different portions out. About 15 minutes later I had figured out that my problem was that my string literal regex was not designed to pick up punctuation and my lexical error was not set to advance 1 character (the real reason for the hanging). So after I changed my string literal regex to accept a few kinds of punctuation and making the character stream advance 1 character on a lexical error I ran the tests again and everything worked fine.
My second problem was mainly a failure on my part. I was absent from class the day we went over makefiles and had not gone through the slides and readings that pertained to this subject so as I'm sure you can figure out by now I spent a fair bit of time trying to brute force my way into getting the makefile to compile the additional testing suites. In the end this didn't work and I gave up and read the suggested materials and did a little bit of googling and figured out what I needed to do fairly quickly afterward. So all said and done the one thing I will definitively do next iteration is make sure that I have read all of the reading materials before trying to attempt a section of the project I don't know anything about.
In the next iteration I will definately continue to use unit tests, makefiles, and version control(I love version control and I have now begun using it on every one of my other projects).
Note: The reason I did not talk about the experience of working with a partner was because for the bulk of the iteration my partner was away dealing with family issues and was understandably not able to find time to do school work.