Thursday, 28 January 2016


Week #3

This is my third week since I enrolled in CSC148 and honestly speaking, it has not been a cup of cake! Danny started by introducing us the idea of exceptions and special methods (i.e getter, setter, init methods and so on). He then went on to introduce inheritance and composition and later on, this week, we worked more on inheritance and abstract data types.

Special methods.
The various special methods like __init__, __eq__ and __Str__ were pretty easy as we covered those in CSC108. What has been confusing me though is the getter and setter methods; I cannot comment on those for now since I am still seeking clarification but I will be mentioning them in my next blog. On __init__, __eq__ and __str__ methods, these are the most basic and important methods that should at least appear in every class. The__init__ is supposed to initialize your attributes, the __eq__ method compare whether one item is equal to another and the __str__ method enable us to give a user-friendly representation of the class.

Type contract
I learned a new way of writing the type contract.

@param Square self: this Square object
@param list[Point] corners: corners that define this Square 
@rtype: None

 I think this is a more effective way of writing the type contract since, besides mentioning the type of the various parameters, we get to comment on what they are and what they do.

 Classes
As opposed to how CSC108 used to break a question into chunks of fewer understandable functions, it is now different. It was fun looking at this big paragraph and thinking about the possible class name, attributes and methods. The major noun becomes the class name, minor nouns become the attributes and the verbs give you a clue of what methods you will write. We later on dealt with exceptions and honestly speaking, I had no idea of what was going on. This is because the exceptions are related to the setter method. Since last weeks` lab was focused on setting our CDF accounts, I am going to fully utilize this weeks` lab by asking what I have not understood yet and hopefully, I will be back to talk about them.

Inheritance
Class inheritance seemed like the easiest topic for the week in my opinion. It was all about creating a major class then writing some sub-classes that are related to it.  For example, for a class like class Animal, it makes sense to include the class Dog as a sub-class other than writing the two classes separately. The subclasses automatically inherit everything from the super-class.

I hope to better my skills as days pass by.
Enjoy the rest of the week!


Wednesday, 27 January 2016

The beauty of computer science is that you can create stuff from scratch to things that people take for granted, such as mobile apps, databases, games and social media websites. The ordeal of programming involves frustrations(codes that are not working to your expectation), hope, failure(after a whole night of coding), pride and happiness( after successfully commanding the computer to do what you want and finally succeeding). I a working code is the epitome of my happiness. I always feel am a winner and this is what has made me love programming even more. Also, I believe programming enforces logical behaviour because it is necessary to think in a logical manner.
Since I am a complete beginner in coding, well started the coding journey in CSC108, I hope that my blog will give hope to someone somewhere who feels like they are the worst.

Enjoy!