This week we learned
about the basis of inheritance and how to reuse the superclass's initialization
method and also its methods that do not need to be changed. I've already
studied Java extensively and inheritance seems pretty similar in python, too,
so this was pretty easy to understand. However, I wonder if there is interface
in python. I've seen abstract classes in python but not interface yet. Then I
searched it up online and found out that python does not have an interface. I
thought about the use of interface in Java and realized that it was there
solely to ensure that a subclass can inherit multiple interfaces. However
python inheritance already covers multiple inheritance so an interface is
unnecessary. This improved my understanding of how dynamic python is and how
flexible its structure could be. Our exercise this week asks us to write test
cases for the classes of quadrilaterals we need to write using the unitttest
class, which does not exist in java. So I looked at the documentation and the
examples posted on the course webpage, and the professor gave some introduction
about what it does so I pretty much get how to write it. This is such a useful
tool for testing our code. I should use it more often in the future. The lab
this week is also pretty easy; we simply had to write a Motorized and a
HumanPowered class and other classes that extend them. I teamed up with Trevor
and Charlene this week to work on the assignment and I spent at least 15 hours
to finish it. The tour and solving controller part proved to be challenging,
but after I realized how to use recursion to call the toah method everything
else just flows smoothly. I'm really proud of myself.
No comments:
Post a Comment