Thursday 23 January 2014

Week 3: Inheritance, compositions and exceptions

    In the week 3 lecture, we got an introduction to the concept of inheritance as well as superclasses and subclasses. Prior to this course, I already knew some things about inheritance as well as the basic idea of superclasses and subclasses. I find it quite convenient that parent methods are called with super().<insert method name here>(args).
    We also learned (I had an idea what exceptions are and what they're used for already) exceptions in lecture. The idea of exceptions is to, when things go awry or something weird happens, is to say "Stop. You've done something stupid!" and/or to fix the problem by instead running code that 'solves the problem' in some way. Or that's how I think of it. It tries whatever code is in the try block and if something is wrong, throw an exception and do whatever is in the except block (for whatever exception type accompanies the except line). I am already familiar with the try/catch concept.
    However, in the tutorial, I was unable to understand the method of speeding up the queue so that the push/pop time is constant rather than linear.