CS 371p Spring 2022: Blog #7

What did you do this past week?
This past week in class, I learned more about consts, casting, arrays in C++, and how to compare arrays using equal(). On my own time, I finished and submitted Project #2 with my partner.
What’s in your way?
Nothing really.
What will you do next week?
Next week, I’ll look at the next project if it’s out and find a partner. I’ll also start annotating the next paper earlier so that I can submit my blog earlier.
If you read it, what did you think of the Paper #7: Liskov Substitution Principle?
I thought it was interesting to learn about and I like how the principles we’ve been learning are connected to each other in some way. I understood the Liskov Substitution Principle better when it was connected to the Open-Closed Principle in that if there is a function that does not conform to LSP, then the function uses a reference to a base class and also knows all the derivatives of that base class. This violates the OCP since the function has to be modified whenever a new derivative of the base class is created.
What was your experience of consts, arrays, and equal?
It was interesting to learn about how to cast in C++, arrays in C++, and how to compare arrays using equal(). We went through several examples which helped solidify my understanding. Some of my takeaways are that C++ casts with ‘const_cast’ and we can use it to cast a const int* to a int*. Additionally, arrays are like pointers (int* const) and we can compare arrays of different elements if we use a template.
What made you happy this week?
I had a productive week and found new study spots on campus.
What’s your pick-of-the-week or tip-of-the-week?
My tip-of-the-week is to add code little by little to your repo as you pass each Hackerrank test and make modifications to your code in Hackerrank so that you can make meaningful commits.