What did you do this past week?
This week I worked on the IDB project with my team for my SWE class. I also worked on the Darwin project for my OOP class.
What's in your way?
I have been putting off work recently and as a result I have fallen a bit behind. I also have some exams coming up, so I need to study for those.
What will you do next week?
Since I have fallen a bit behind, this week I will work towards finishing my work. I will continue working on the IDB project for SWE and finish Darwin in OOP. I also plan to study for my tests.
What did you think of Paper #10. Why getter and setter methods are evil?
Getters and setters themselves aren't inherently evil, but they can be misused in ways that undermine good object-oriented design. Here's why they need to be used judiciously:
- Broken Encapsulation: A core principle in object-oriented programming (OOP) is encapsulation, which hides an object's internal data and exposes only controlled ways to interact with it. Getters and setters, if used excessively, can expose everything, breaking this barrier and making your code less secure and maintainable.
- Data Holder Anti-Pattern: Sometimes, programmers create classes that simply hold data with getters and setters for each piece. This approach treats objects like data structures, which goes against the idea of objects having behaviors and responsibilities.
What did you think of std::vector's copy semantics, r-value references, std::move, and std::vector's move semantics?
- When you assign a vector to another vector or pass it by value to a function, the
std::vector's copy constructor is called. This creates a completely new vector, allocating new memory and copying the elements from the original vector. R-valueare temporary objects or objects about to be destroyed. They are denoted by&&.std::movefunction is a utility function that casts anl-value(regular variable reference) to anr-valuereference. This essentially tells the compiler to treat the object as if it's about to be destroyed, even though it might not be.std::vectorsupportsmovesemantics. When you pass an r-value reference to astd::vectorconstructor or assignment operator, themoveconstructor is called instead of the copy constructor. Themoveconstructor steals the resources (memory and elements) from the source vector instead of copying them. This is a much faster operation for large vectors as it avoids unnecessary copying.
What made you happy this week?
This week, I went out with my friends since it was one of my close friend's birthday, and as a result made some good college memories.
What’s your pick-of-the-week or tip-of-the-week?
This week, a malicious backdoor was discovered in the widely used Linux utility xz Utils. The backdoor was inserted by one of the main developers and affected versions 5.6.0 and 5.6.1. It broke SSH authentication by injecting code during the login process. While no major Linux distributions were affected in stable releases, some beta and testing versions were compromised. The backdoor was caught early thanks to a developer investigating performance issues. It could have enabled remote access to systems running the vulnerable versions if not discovered. Backdoor found in widely used Linux utility breaks encrypted SSH connections | Ars Technica