I just finished the readings for this week on the Liskov
Substitution Principle. It is a simple concept but it is certainly important in Object Oriented Design. One of the
provided examples in the paper was of a Square class inheriting from a Rectangle parent. Logically, at least
initially, it makes sense. All squares are rectangles. However, the actual implementation of it would not
make much sense. Rectangles have heights and widths but for squares, you only need to set a side length.
It is wasteful to have width and height attributes for squares. That, however, is a subtle problem compared to
many of the other problems that arise when Sqaures inherit from Rectangles. If a method changes a width to a
and then changes a height to b, it expects that at the end the width will be a and the height will be b. Those
are perfectly reasonable assumptions for Rectangles but the Square does not work that way. Squares behave completely
differently and therefore, cannot be subclasses of Rectangles. The paper is an interesting read with several other
examples but it makes you think deeper about design. Sometimes, a certain design seems logical but it is a bad
design in practice.
I had my first midterm of the semester in Algo on Monday. I have been working on a number of assignments for other classes. I have a group for Project 3. Overall, it has not been a very busy week.
I need to start studying for the exam. I think I have a good understanding of the content that we have covered in class. I might need to review the XP readings though. If the questions on the readings on the exam are anywhere close to being as specific as they were on the quizzes, I will need to go over some of the chapters again.What will you do next week?
I am going to start by reviewing the lecture files on GitHub. Following that, I'll re-read some of the previous readings. I will also need to come up with some meeting plan with my Project 3 group. We have some time before the project begins but with such a large group, having deadlines, organization, and some structure is vital. Just as companies use kanban boards to have coordination in engineering teams, we will need to do something similar.What’s my experience of the class?
I like the recent hands-on approach where we implement whatever we are talking about in class. That way, we can get a much firmer grasp and we know immediately if we misunderstand something. For example, I might not have realized that generator classes returned themselves in their __iter__ method if we had not had to dive into the details. I would not have thought about how generator classes can be used using the same code as generator functions if the __iter__ method is written properly.What's my pick-of-the-week or tip-of-the-week?
If you are looking for datasets for machine learning or modeling, try Kaggle. There are some really interesting ones there dor you to work on your skills. There are a number of competitions as well and you can learn quite a lot just by playing around.