Week 3
For my first SLOG, I was asked to
write about Object-Oriented Programming. This was our first topic in
the course, and it was also the last topic from CSC 108, the course I
took last semester. What was covered in the first few weeks was a
combination of what I learned last semester along with some new,
extra details. This week focused on raising exceptions, inheritance,
and some methods that could be added to a class (like __eq__ and
__repr__).
So far, I think I understand what is
going on. The thing that I thought was the most interesting was
raising exceptions. When I was doing my assignments in CSC 108, some
the handouts said that our code did not need to handle exceptions.
Reading that made me curious on how it was actually done. When it was
demonstrated in class this week, I was surprised that it did not
take that many lines to do it, and that in order to raise an
exception, a class had to be created specifically for it. The other
topic, inheritance, seemed straightforward to me. The word
inheritance in programming is like its real world definition. For
example, the child receives what initially belonged to the parent
(like methods in programming), but that child is free to do what
he/she wants with those possessions (like overriding). (One of the
readings compares using inheritance to entering a “dark forest”,
but when this was talked about in class, the professor did not treat
it as if it were a bad thing.)
Although I think I understand the
material, I think I need to do some additional practice outside of
the class and lab in order to make sure that I really do understand
it. In addition to the in class examples and lab questions, there are
also some questions at the ends of the readings that would be good to
try.
No comments:
Post a Comment