Sunday, 15 February 2015

Object Oriented What?

From the standpoint of a non-programmer or even a beginner programmer, the concept of objects and inheritance is by far one of the most confusing things to understand in computer science. We were all there at one point; we all had our struggles with objects and what they were even used for. Personally, I struggled with the entire concept of instances of objects and how they were completely separate from one another, or even how all these methods and attributes worked together. I remember my high school computer science teacher explaining how Windows essentially started the OO (object oriented) revolution, and how "every window you see on your computer looks the same because it inherits from the 'cosmic super-class'". Although most people at the time did not understand what he was talking about, that single statement really does sum up OO programming. Essentially the vague term 'object' is just a way of representing some code that is being re-used, and is basically just a synonym for 'block of code'. Of course there are some rules about what qualifies something as on object, but that is the general idea behind it. The confusing part is when you are first told that you can have as many objects as you want and that they are all independent from each other, despite using the exact same code. Then of course there is the usual bombardment of language where every object is an instance of the original code (i.e. it is an identical copy), which through the process of instantiation gets added to a stack and.........

Basically things are made unnecessarily ambiguous and too many rules are thrown at people right out of the gate. Although I would argue that Python is the easiest OO programming language to learn, it still has its fair share of difficulties. To correct some of the other students' SLOGS, HTML and CSS are not object oriented languages because they are not object based; they are markup languages and you cannot create objects in them. Python with its essentially 'wild-west' book of rules makes it incredibly easy to create and manipulate objects (in comparison to a language like Java or C++ where rules are very strictly defined). In Python you can randomly add methods to your objects after they have been executed, you can modify any variable you can get your hands on etc., but at the end of the day, Python is still a very solid and very capable language to program in. OO programming is one of the most useful pieces of programming we have at our disposal and it is essentially what computers are built upon. Lectures have been useful in showing us how Python deals with inheritance and there has been plenty of examples to show how it is used. For a programmer, inheritance really is the greatest thing since sliced bread as it allows us to only write code once but reuse it countless times. It is really useful and the professors are very good and clearing up this initially confusing topic. We've had lots of practice with OO programming so far, and I bet it is here to stay.


Sunday, 8 February 2015

Recursion(Recursion(Recursion()))

So in week 4 I was first introduced to the concept of recursion using Python. Although I have heard about recursion in the past, I did not really know much about how it worked until now (the only thing I used it for before was factorials). It seems like recursion is somewhat important to know however so far I haven't really seen the need for it. Everything we did in class so far could easily have been done without recursion, and I am not actually sure what it is really used for. Regardless, the concept was not difficult to grasp and it makes you think about what other sorts of 'tricks' computers can be programmed to do.

I found that tracing the recursion on paper made understanding what was going on easier than just being told what was happening. Using the method of tracing that was taught in lecture like a type of rulebook, even the most complicated examples could easily be traced and understood. Although, I still find it odd that every recursive function we made did a list comprehension, despite this not being a requirement whatsoever. In addition, I personally found it a bit confusing when we were told to replace "identical calls" instead of tracing. I was never sure at which point to replace the recursive call, so I had a big inconsistency there. Overall it was relatively straight forward, but again like my last post, I wish we could have done some better examples/questions. Maybe analyzing very large recursive call run-times (10 000+ calls?), or even seeing practical applications for them. Lastly, I never seem to understand why in a computer science class students would be expected to trace code by hand. It honestly baffles me as to why paper even enters that lecture room. Considering that computer science may or may not having something to do with digital machines, it would make too much sense to do the tracing using a computer. It could be that students are not expected to bring computers to school, but then one could have been mentioned for those that do.

Sunday, 1 February 2015

Thoughts on the first few weeks of class

At almost 4 weeks into the course, 1 assignment done, and a test coming up, I think I have enough experience to talk about my feelings towards CSC148 so far. Before I start I should add the disclaimer that I have taken computer science multiple times before this course, which as a result may lead to a bias in some of my opinions.

I suppose a good place to start would be with regards to course difficulty. In all honesty, I do think the course is too easy. Maybe it will get more difficult, but from what I have experienced so far the class seems to be moving at too slow of a pace. Assignment 1 really could have been done without having attended the first few weeks of class and so far really only 2.5 topics have been discussed. Personally I could take a significantly higher level of difficulty (and i'm sure many other people with prior experience could as well), but maybe this is how the course is supposed to be. To be clear, i'm not complaining; more-so just commenting. As a side note, I find it rather surprising how full the lectures are. In CSC108 a very large portion of the class either dropped or stopped showing up by the third week but so far it seems that in this class perseverance has taken a front seat.

When I talk about how things are seemingly too easy so far, please understand that I am in no way insinuating that the professors are inexperienced or incapable; on the contrary, the professors seem very intelligent and very patient. Especially with regards to in-lecture questions, there is a positive atmosphere for people to ask questions and the professors always provide knowledgeable responses. In my opinion, some students ask redundant questions and at times it seems that half of the 50 minute lecture is spent answering them, but at the end of the day people are entitled to ask questions.

Finally I would wish that instead of (seemingly) always learning about the Python syntax (which students are already expected to know anyways) it would be nice if the lectures could teach about more advanced topics but using Python integration. Although a virtual turtle is interesting for a full 2 minutes and 17 seconds, I personally think if people were more interested in the examples they would work harder. Maybe that is just me, but in CSC108 we spent about 10 minutes examining some Python code based on the Collatz Conjecture and I thought it was very interesting. There are plenty of practical examples that could be used that would still fit in nicely with the material such as networking, encryption (ciphers for starters), basic game development etc. I enjoyed making the game for Assignment 1 much more than calculating the area of a triangle like one of the lecture examples, but I digress...