Sunday, 15 February 2015

Object-Oriented Programming

This week I need to write a post about Object-Oriented Programming. Although I am not really sure what I should write about it, I will try to express here whatever I know about this paradigm. Object-Oriented  Programming is a concept in computer science that views computer program as a combination of data structures. So far in this course we have mostly worked with classes, their attributes and methods. 

In the first two weeks of the course we have studied the concept of inheritance which allowed us to create subclasses, and format or create in them new methods, which were not implemented in the super class. Basically, methods that are specific to a certain subclass, when written in a superclass, can only raise a “NotImplementedError”. This happens because super class does not contain methods for specific subclasses, but only indicates methods and attributes common to all the subclasses. When we write the subclass, the general information will be inherited from the super class, and we won’t need to implement this part of the code again. However, if we want to add some more specific methods to the subclass, we are free to do so without changing the super class. 

Designing classes and subclasses is not very difficult - you just need to know what is the purpose of your code, what it should do when executed, and which methods and attributes you will use for it. Also, making up proper names for your methods and writing clear docstrings can be very helpful. 


I had a couple of problems with with class design in the beginning of the course, but the first two labs and writing assignment were very helpful in clarifying these concepts.

Sunday, 8 February 2015

The new week has come to an end, and it is the time for a new blog entry. The last two weeks of my programming course have been mostly dedicated to the term test preparation. I’ve spent a big deal of time solving the additional lab exercises and going through all the lecture slides. Now I really hope that all my effort will eventually pay off. As for the test itself, I think that this midterm was well written and fair enough, albeit I felt a little short on time at the end, and the tables in the room were very unstable. I also cannot help wondering when we are supposed to complete test review exercise, that will give us a bonus mark for each test.

Another important thing that happened in this course during the last two weeks was the introduction of recursion. This seems as not very complicated concept, although pretty irritating when it comes to extremely nested lists. During our 3rd and 4th labs I have also discovered that putting recursion into the code can be a rather tricky task, demanding a big deal of intellectual effort. However, recursion is an important tool for creating an intricate code, and I hope that with the practice I will get used to applying recursion to program writing and my skills with this concept will somehow improve. In the meantime, I would rather get ready for another midterms and start looking forward for the reading week.

Sunday, 1 February 2015


In this part of my blog I would like to share my impressions about the first weeks of my computer science course. All in all, the course is going well so far. This course seemed pretty tricky at first, as I have almost forgotten everything that I learned about python in CSC108 last year. However, doing exercises in the lab was very helpful, and now, when my knowledge is restored I start to feel more confident about this class. This week I have also finished and submitted my first assignment. I worry about my grade a big deal and I'm pretty anxious about how they are going to evaluate it, but at the same time I feel that my understanding of classes, subclasses and built-in methods improved significantly due to this work. While working on this program I faced a number of challenges, and the most irritating of them was, quite unexpectedly, the class design. I didn’t have a lot of problems making a generic class for the game state and a more specific one for subtract square. Nonetheless, the two classes for computer strategy have become a real headache for me. First of all, I couldn’t understand how specific each of them should be and although I knew exactly which function to include in this class, I still couldn’t use it properly in the program body. Yet, I managed to write the program which worked properly and coped with all the bugs my initial code used to generate. Now, when the assignment is finally submitted, I even feel a little proud for doing all this work by myself. However, next week we are having the first midterm, so at the current moment I try to invest all my intellectual resources into acing this test.