CS371P Spring 2021: Samantha Tuapen
Hi all! This is my eleventh blog post for CS371P: Object-Oriented Programming
What did you do this past week?
This pas week, I worked on the Darwin project with my partner. We were slightly disoriented with the project requirement of not using getters or setters in the beginning, but after writing out our design and discussing it with a TA, we had a better understanding of how our classes can better communicate with each other to solve this problem. I found this assignment to be very interesting, because it really challenged me to build a truly object-oriented design between the Creature, Darwin, and Species class. My partner and I figured out an efficient solution that passed all the HackerRank tests and some students’ acceptance tests, so we’ll continue to clean and refine as we finish writing our test harnesses this week.
What’s in your way?
Currently, nothing is in my way.
What will you do next week?
Next week, my partner and I will finish writing our unit and acceptance tests as well as make our UML diagram.
What did you think of the Why getter and setter methods are evil?
I found this article very intriguing and informative. I had to read it several times in order to get a better understanding of why we should minimize the user of accessors and how to create a design that utilizes communication by passing ‘messages’ between instances. I’ve been conditioned since I first began programming to use accessors in OOP for accessing private instance variables, so it’s taking a while to deconstruct that idea in my head and instead consider what needs to be done and asking others to complete the task rather than demanding the information and doing it myself.
What was your experience of vector, move constructor, move assignment, and allocator?
After working on the Allocator project and all the HackerRank exercises with vectors, I have a better understanding of these two mechanisms. I find that allocators are better to use than new/delete because it allows us to decouple the space allocation from the object initialization. With the vector exercises, I’ve learned a lot about the utility of allocator templates and default constructors as well as the explicit keyword and the initializer lists.
I’ve never worked with move constructors or assignments before until I was introduced to them in these past lectures. It seems to be more space efficient than creating a copy since all the contents of an object are moved to its new container through the use of swap(). I will keep this functionality in mind for future projects where it may come in handy.
What made you happy this week?
In the middle of this very busy week, I was able to meet with young kids from the Blank Center for Stuttering Education and Research and hear about who they are and how their stuttering doesn’t hold them back, but rather helps them express who they are even more. It was so heartwarming and inspiring to see such intelligent kids who were bold enough to present and speak in front of a full Zoom room of college students: I know for a fact I couldn’t have done that when I was 7 years old. I hope that when I get back on campus, I can volunteer at this center and get to know more kids through this empowering community.
What’s your pick-of-the-week or tip-of-the-week?
I’m sure a lot of you already know this, but take the time to plan out and design your solution before actually coding it out! It can be difficult to back out of a dead end especially when you feel the escalating commitment, but if you have a plan already laid out, it can be easier to avoid tricky logic errors or to adjust the design according to errors you find on the job.
Thanks for reading my blog post! Hope you have a good week ahead of you.