CS371p Fall 2020: Barrett Schonefeld

Barrett J Schonefeld
3 min readOct 31, 2020

What did you do this past week?

This past week, my teammate and I implemented the initial Darwin algorithm. We implemented the core algorithm but had some complications with vector resizing invalidating pointers and inefficiencies comparing strings, which we dealt with throughout the way. Initially, we did not consider the problem of pushing back a Creature object to a vector and then using a pointer to the creature in that vector. We had problems with segmentation faults, and as soon as Professor Downing started touching on the subject in lecture, it clicked that we needed to reserve enough space for the Creatures before we started pushing Creatures into the vector. Once we resolved this, we optimized our simplest solution to use enumerated types for each of the possible actions, which improved upon our string representations for each action. We have started working on some of the logistical tasks related to the project and should finish up the project soon.

What’s in your way?

Nothing is in the way. My teammate and I need to finish up some of the logistical items for Darwin, which will be straightforward.

What will you do next week?

Next week, my Darwin teammate and I will tidy up the Darwin repository to get it ready for grading. Then I will get started with the final project once it is released. I have secured a partner for the final project, so we will likely meet next week to do the initial setup for the project.

If you read it, what did you think of The Interface Segregation Principle?

The Interface Segregation Principle outlines rules for building hierarchies and relationships of objects. I found some of the initial examples of bad design to be obvious, but as I stated in my annotations on the paper, the challenges of designing good interfaces are likely magnified at scale (large code bases over the course of years). Still, I thought the overarching principle that a class should only inherit an interface it uses is a good model for keeping project dependencies simple.

What was your experience of continuing to implement std::vector?

I enjoyed the vector discussion, and I thought Professor Downing highlighted intriguing cases of both C++ and general software design problems. For example, Professor Downing discussed the possibility of a user to assign an object to itself. The standard and obvious behavior of assignment deletes the data in the current object and replaces it with the data from the argument, but in self-assignment, the argument’s data would be deleted first. Hence, we need to ensure the “this” object and the “other” object are different.

What made you happy this week?

It was a good week!

What’s your pick-of-the-week or tip-of-the-week?

I found this article on maximizing the utility of Leetcode. For anyone preparing for interviews, this may be a useful resource on organizing and maximizing time spent on interview preparation.

--

--