SLOG-Week
Three
During week three, I have gained some programing
experiences from learning inheritance and exception. So, what is inheritance
all about? It is part of object-oriented programming (OOP) languages that
allows a subclass to have all the properties from its superclass. Here is the
question, “Why is inheritance so importance in writing programs.” It is
importance because it lets the programmer to reuse methods from superclass
without duplicating the same code in subclass again and again. Also, the
property of inheritance gives a programmer an opportunity to extend the
superclass method, so the programmer does not need to write an new method in
the subclass, instead, just extend what the superclass’ method does.
When running a program, it is not surprise to see a
runtime error. Whenever this happen, the program creates an exception object.
It is helpful because it tells the user what rule he/she violates. If exception
does not exist, user of the program will never know what they did wrong.
In week three, I got a chance to practice both
inheritance and exception during the lab. Although my partner and I finished
the queue program, we cannot figure out why our queue.py took so much time to
complete the timequeue.py test. However, I will not give up and will try to
think of someway to improve the queue.py code.
Feel free to leave a comment with your respond or
question. I will reply every comment I can!
No comments:
Post a Comment