This week we got our test and SLOG marks back. The test went okay, although not exactly great--I corrected one of my answers into a wrong one before handing it in thinking it's a better way to answer the problem, which doesn't end up being a smart move.
The mark I received for the SLOG is also pretty bad. I'm starting to get confused about the whole rubric for SLOG, so I'd appreciate it if the TA who marked my SLOG would give me a bit more feedback than "be more consistent" and "put more insight into problems or concepts encountered in the course" as that is pretty vague.
We've been learning about trees, which is another type of object based on queues that exists and becomes useful thanks to the idea of recursion. Assignment 2 is also posted.
We are supposed to talk about object-oriented programming this week.
During the first few weeks of this course, we investigated deeper into classes, which is python's version of object-oriented programming.
The concept of classes lets us define types of objects with whatever attributes we want them to have. Obviously this simplifies our code for programs, as functionally similar objects can be grouped into the same class which allows for reuse of code, and it's much easier to work with a class of objects defined as "dictionary with keys as strings and corresponding values as tuples of strings and lists and integers" than to define the abomination as such every time one encounters it. This also allows for simultaneously having multiple objects of a class, called instances of the class, and operating upon them using the same functions or methods.
Methods act like general functions that we've worked with in CSC108, but are defined within a specific class and operates on objects of the class. It can directly access the attributes of an object and work on such, but is otherwise pretty similar to general functions. The introduction of classes also expands the scope of the latter though, as classes of objects can be passed as parameters of functions, so functions can define interaction between objects of different classes.
Inheritance further classfies objects into subclasses of classes (so should subclasses be called orders or should superclasses be called phyla?). The objects in subclasses have some common attributes and methods covered in the superclass, and each subclass provides more detailed attributes and methods--often partially inherited from the superclass by declaring such--for the objects. Inheritance enables more reuse of code, as functionally similar types of classes of objects can also be grouped together and operated upon using the same code, only slightly changed in the specification for each subclass.
Right now the idea of classes feels mostly like an organization technique, as it organizes objects into classes and subclasses, and allows functions to be defined on the group of objects instead of individual objects themselves. As pointed out repeatedly, it greatly simplifies code, and allows for things that's difficult (or perhaps impossible) to be done with what we've learned before, so I suppose it's quite useful. We'll see what it can do.
Sunday, 22 February 2015
Sunday, 8 February 2015
Week 5, 0202-0208
Because of the midterm we didn't exactly cover much during lecture this week. The midterm went fine, although the marks aren't out yet to determine how we did. Since the SLOG requirement for this week is about tracing recursions, I might as well talk about that.
...I don't really know what to talk about tracing recursions. It's pretty helpful for one to see what exactly the function does and how recursion works, but I suppose that's it. Tracing is rather boring once one understands what's going on, and gets frustrating quickly. So I'll write about recursion in general instead.
Judging by what we've seen so far, recusion is indeed useful as for reducing code complexity for tasks, since it is much simpler than layers of dreaded if-then statements (which might not even work), and for general problems which may or may not be doable (efficiently) with what we've learned in CSC108. Quick sort is the obvious example for the latter motive, with an average performance of O(nlogn), it works much faster than the sorting algorithms we learned before which all has average performance O(n^2).
It seems that we're going to be working on recursion for a while, as both the examples done in lecture--quick sort and the example on checking imbalanced parentheses--are both applications of recursion, and as the SLOG requirements for later weeks are often on recursion. Looks like I'll have to revisit this topic a few times in the future when we learn more about it.
...I don't really know what to talk about tracing recursions. It's pretty helpful for one to see what exactly the function does and how recursion works, but I suppose that's it. Tracing is rather boring once one understands what's going on, and gets frustrating quickly. So I'll write about recursion in general instead.
Judging by what we've seen so far, recusion is indeed useful as for reducing code complexity for tasks, since it is much simpler than layers of dreaded if-then statements (which might not even work), and for general problems which may or may not be doable (efficiently) with what we've learned in CSC108. Quick sort is the obvious example for the latter motive, with an average performance of O(nlogn), it works much faster than the sorting algorithms we learned before which all has average performance O(n^2).
It seems that we're going to be working on recursion for a while, as both the examples done in lecture--quick sort and the example on checking imbalanced parentheses--are both applications of recursion, and as the SLOG requirements for later weeks are often on recursion. Looks like I'll have to revisit this topic a few times in the future when we learn more about it.
Sunday, 1 February 2015
Week 4, 0126-0201
This week we mostly talked about recursion and finished up assignment 1. The material seemed intuitive enough, though I don't know how long it will remain this way.
Overall the first few weeks went okay, I think I know what we were talking about, although I am not entirely sure about that. The lectures are much more engaging than CSC108 (in which we mainly did exercises during lectures) and more similar to the style of lecture in CSC165 (well, because the instructor is the same), which is probably a good thing.
Oh and next week we have our first midterm. Hopefully it will go fine, though it did remind me that I never got my tests for CSC165 back due to shyness, conflicting commitments and crowded office hours, and I put off getting them back until it became awkward to ask for them (not a good idea to ask for test #1 back when everyone is worrying about the final). I suppose that is--personally--a bigger problem than the midterm itself. If only we could get it back during tutorials...
Overall the first few weeks went okay, I think I know what we were talking about, although I am not entirely sure about that. The lectures are much more engaging than CSC108 (in which we mainly did exercises during lectures) and more similar to the style of lecture in CSC165 (well, because the instructor is the same), which is probably a good thing.
Oh and next week we have our first midterm. Hopefully it will go fine, though it did remind me that I never got my tests for CSC165 back due to shyness, conflicting commitments and crowded office hours, and I put off getting them back until it became awkward to ask for them (not a good idea to ask for test #1 back when everyone is worrying about the final). I suppose that is--personally--a bigger problem than the midterm itself. If only we could get it back during tutorials...
Subscribe to:
Posts (Atom)