Class:
This week was a bit more pleasant than the last, partly because I
remember a lot of it from object oriented programming from a while back. This
week we really got to see what separates C++ from the rest of the programming
languages and got an insight as to why its so damn fast. The key is passing by
reference. By simply passing the memory location of what you want the other
function to access you eliminate the need to copy large data structures. You
can also iterate over arrays of any type simply by iterating over the locations
in memory where the data is stored. As the week finished up we got to talk more
about how to prevent other developers from misusing this flexibility that C++
provides. By using special types of pointers to specially marked memory
locations we can limit the damage that can be done by accident or even by
malicious intent.
Project:
Australian Voting turned out to be more challenging than I had
anticipated. This was my own mistake. Having seen how easy Collatz was to
complete the day it was due, I underestimated Australian Voting drastically and
as a result I started very late since I was completely focused on Netflix. I
spent several hours trying to get the reading of the input and the formatting
of the output correct. I knew that this was a key part of the project. After
spending a bit of time modifying the skeleton code over from Collatz I quickly
focused on getting the input output tests to succeed without issues. As per the
requirements I then knocked out a non-cache version and passed all my tests.
However I was faced with a problem because UVa indicated a runtime error was at
play. All the tests that I had written were passing and so naturally I was
confused. Luckily some students had already posted acceptance tests. After running
several of them successfully I finally ran one that generated a cryptic error
in my program. I analyzed the particular election that had failed and added it
to my test suite. I was able to fix the bug and got UVa to accept my solution.
The only problem was that it was now 7:30PM on Thursday and I still needed to
generate acceptance tests and write a non-cache solution. Needless to say I
didn’t get the project in by the deadline. Several hours later I finished it
and was able to turn it in. Even though I lost 20 points on a project that
truly wasn’t much more difficult than Collatz, I learned a valuable lesson:
Don’t bother working to get bonus points for any project until AFTER you have
finished the minimum requirements for ALL of them. Lesson learned.
On to week 4 :)
No comments:
Post a Comment