Iteration 1

| No Comments | No TrackBacks

In iteration 1, we were writing a scanner program which takes in a text file and recognizes all the tokens and keywords. While scanning, the program also stores data found in each iteration in a linked list of tokens and the string of texts matched. There is no main() function in the program though we run the program through test cases to make sure the program does what it's supposed to do.

We used the iteration process for our project. We started off by studying and analyzing the test cases to make sure we understand the requirements of the program. It seemed to us that the test cases started of pretty basics and getting more complex each time. As iteration process is to develop a software based on the functionality, we started to write the code based on the first test case. Soon enough, We had discovered that the scanner program need a linked list to store data and a function that would make it easy for us to store the data to the linked list. So, we decided that I should write the function while my partner worked on the scanner program which was writing the regular expression for each tokens and keywords. When our tasks were done, we added the linked list and the function that I wrote to the scanner program. Of course, it didn't work. We kept getting segmentation fault when tried to add data to the linked list. Further researching on linked list for c++, I found that we need to allocate a memory space for each list we created using "new" operator (for C++, same as "malloc" in C). The new requirement was discovered. We need a function that would extract the texts matched by the program and store it in a string variable. So, we wrote another function call "getLexeme" which takes in the texts input and the number of characters matched by the scanner. The program then returns a string contains only the exact word that is used to matched the regular expression in the scanner.

We tested our program every time we added new features, if passed, we then move on and work on another test case and make sure it passes the test before we move on. The part of the process that work well would be the maintenance part after the program works as expected, the part where we only need to clean up our messy codes and make it more readable. The part that we struggled with the most would be the first part where we try to understand the requirements of the program. We found a new requirement almost every time we test the program and when there's compiler errors(the one that's not syntax error). Working in pairs actually helped a lot with this project because there's always a part where we know exactly what to do but in the process of completing it, takes a lot of time. So, we can have one person work on that part and another work on the next part. For example, writing a regular expression for each tokens and keywords.

The thing that I would change in iteration 2 is that I would start earlier and spend more time on trying to understand the requirements. It can be very frustrating sometimes when you have to completely give up a piece of code you wrote that doesn't at all meet the requirement of the program. When I wrote the first function to add data to the linked list trying to just add the token name to the list, then the next test case require also a words matched. My function wasn't design to take in another argument of string. Even I tried, I eventually had to give up and wrote a new one.

My partner and I will continue using the iteration process for our second project because we had experienced that the requirements are always changing and we think it make more sense to work on a small part at a time than spend a lot of time trying to understand the requirement clearly and wrote the whole program just to find out it doesn't work at the end.

Recent Entries

Find recent content on the main index or look in the archives to find all content.