Programming. I thought that was what Program Design and Development was
all about. However, all I've have been doing was listen to the teacher
talk about what pain is in software development and why unit testing is
important. Furthermore, the programming project that was assigned to us
seemed simple enough. My intentions for this project were to quickly
breeze through it, at least until I immediately tripped over the first few
problems in the project. Luckily, the concepts we read thus far
actually saved me for the first part of this immense project since I
actually read it... with great lamentation. This project we are doing for
class is about making a program for parsing grammar for a nameless
fantasy programming language. Of course, it has a catch; we don't know
exactly what the requirements are. The first of these requirements were
to create a seemingly simple scanner function that we could have taken
out of some C++ library, but first impressions are often wrong. In this
case, I am definitely wrong since it was more upliftingly agitating than
I had previously expected.

My partner and I anxiously waited for the programming assignment to be
put up because we wanted to just get it over with and play some video
games during the weekend. For this very first part of the project, we
had only planned on a general structure of what the scanner should do.
We had no idea where to start, so as in discussion and lecture, we
followed directions and coded some of the simpler aspects of scanner.
We tackled through this part as quickly as it appeared from whence it
came. Over the course of the first few days, we decided to look over
some helper functions that would benefit the scanner function. I took
awhile to understand it, but when I started typing it, I saw that my
partner was already finishing the code for it. Even more, he was
finishing up the main, and also fun, parts of scanner while I sat in
front of my computer updating and trying to understand what he was
trying to do. Add to that, he was also somewhere five thousand miles
away from me in his house cozily coding away while I was frustrated at
figuring out how the repository nonsense worked. In the end, he had a
few test cases along with what I deemed the heart of the scanner
function. During this part of the project, it became apparent that I
was not up to par with his skill at programming in C++ because I was
accustomed to a different language that cared little about pointers and
memory allocation. From this observation, I foresaw a lot of reading up
and practicing on C++ in the future. What was left was what seemed to
be the trivial part of the project and that was what I had to do.

My actual contribution to the first part of the project involved making
the regular expressions. I was going to do some sort of fancy array,
but decided that I was lazy and wanted to just keep it simple. It
seemed trivial and redundant at first, so I started coding maybe five to
ten regexes at once until I realized shortly that I didn't know if it
worked. This grew to an intimidatingly high mountain of code because
when I made test cases for them, I wasn't sure if they were going to
pass, or even work if I had run the tests without testing them. Low and
behold, the testing program couldn't even compile at all as I feared.
After quite some time I warily realized I didn't declare them in the
header file, so I changed some files and I finally was able to run some
tests, albeit some of the first ten test cases didn't work out quite as
planned. After some more time, I guessed and found the correct regular
expressions since I knew my tests were carrying the right results. For
the next one thousand regular expressions, I started to write a test out
for each one and tested immediately to see if they worked. If it
didn't, I rewrote the regular expression, otherwise I moved on to the
next one. Sure, there were a few parts I got stuck on, but I asked
around, asked my partner, and saw the people in the forums talking about
it, and eventually, figured out why I got stuck and fixed it. In the
end, I had a very long, ugly, and repetitive list of regular expressions
that filled the entirety of the scanner function, but it worked properly.

The next part of this first iteration involved making test cases.
Coming up with an idea was easy, but writing was another. I wrote tests
for all the sample files. This was not a very bright idea and it was
pure brute force during this part. I was tempted to use the translator
we wrote but that would defy the purpose of writing the test cases...
wouldn't it? Of course, I manually went through it... and I wished I
hadn't done this part of the assignment. All the tests I wrote were
clean because I didn't want to write anymore tests after this
anti-exhilarating duration of the iteration. There was nothing more I
could say during this time of intense agony.

About four to five hours before the first iteration was due, we decided
to meet up in person and this was either a brilliant plan or a chance to
find and fix some simple mistakes. Instead of writing awesome test
cases for the eve of destruction as we had intended, we found out we had
a lot of hidden surprises to solve. First, we had to make modify the
"Make" file, which compiles our project, so that it worked on our new
test files. Next, we had to tag the current copy of our code into the
repository; however, it didn't come out as we preconceived it out to
be. Another problem, figuring out what happened as to why the tests for
the eve of destruction didn't work was another time consumer. In the
end, instead of having ten beautiful test cases for some delicious extra
credit points, we were lucky to have two working ones.

Looking back, I doubt that this method of casually planning one step
ahead will work in the next iterations of the project, even if it
worked for this one. I guess that as the project becomes more complex,
we would actually need to look into the code and specify what each of us
will do in detail. Also, I certainly don't want to experience that last
haul of the project again even if it was getting some simple task
completed, especially if we aren't getting a second chance to fix our
habits in the future. Additionally, there was the pain of writing tests
I didn't want to realize alone and, thus, I anticipate that I will need
to practice C++ for a little while longer.

Despite all these failings, there were many great moments during the
project. For one, unit testing saved me from having to second guess my
work and saved me plenty of time with the hundreds of regular
expressions. Secondly, I realized that having a partner whose skill
vastly outmatched mine was a great benefit. During the course of the
nine or ten days and even before hand, I have acquired more knowledge
about C++ in a short time than I would have trudging through manuals
alone. Third, it forced me to master the inner workings of the
repository. At first, it seemed pointless and boring but turned out to
be a vital aspect of the project because we shared files over some
database instead of emailing code back and forth.

For the future, we will modify and change our methods of tackling this
project and continue listening to our professor, even though at first it
seemed like useless information. I am guessing that whatever comes next
will probably be as useful as what we have just practiced on in the
project and I am looking forward to practicing the new concepts for the
next iteration.


| No Comments

does this work?


| No Comments


Tag Cloud

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