CS 371p Fall 2024: Rob Mayoff

Rob Mayoff

Blog #10

Your blog entry must explicitly answer the following questions about the class (mark the questions in bold in your post):

I passed the HackerRank challenge for the Darwin project first (except for Prof. Downing). I also finished the Vector 3 exercise first.

I have a lot of programming experience and a lot of C++ experience. I have also been competing in Advent of Code for a few years, and the Darwin project is much like an Advent of Code problem.

I helped write the CTD spec for the Darwin project. I also helped Zeeshan with the Vector 3 exercise.

I do not like it (Sam-I-am). I prefer the functional style of value types and functions. I also prefer languages that support computed properties, so you don’t have to write getters and setters for stored properties to be resilient to future changes.

Here is one of the comments I left on Perusall:

You’re in trouble regardless of whether you provided a getter.

If you have 1,000 calls to getX, then presumably you have 1,000 places where you need to do some work that involves the value of X, and a lot of those places probably involve combining the value of X with some other values Y, Z, and W. So either you pull X out of its object using getX, or you move the computations into the object and now you have to pass Y, Z, or W into the computations. But what if the type of Y or Z or W changes?

The fact is that programs are about manipulating data, and at some point you have to commit to some representation of that data, either as a concrete type (like int or long or double) or as a specific interface, and if you want to replace the type or the interface, you’re going to have to modify the program accordingly.

I didn’t have any trouble with it.

It was fine. I forgot to use the allocator to deallocate in my destructor, which Rodrigo pointed out to me. I pointed out that the tests passed regardless. I fixed it before submitting anyway.

I stopped writing C++ in 2010, before these were added to the language, so I learned some new C++.

I arrived early for class on Wednesday and so I had time to read about the Darwin assignment before class. It is much like a typical Advent of Code problem, so I was happy to have something fun to work on.

Then I remembered all the bureaucratic overhead we’re required to do for each project in this class, and I was sad.

Then I went to class and heard that we’d be required to write an over-engineered, “object-oriented” solution, and I was even sadder.

This week’s tip comes from William Strunk, Jr., author of the most popular English style guide in history, The Elements of Style. You can apply it when writing your blog posts for this class:

Omit needless words.

See you next week!