Monday, 30 March 2015

Week 9: Impressions of Week 8

In week 8 of the wonderful world of CSC148, we learned about the properties and applications of Linked Lists, another ADT. Linked Lists mark the first time since pretty early on in the course that the subject material hasn't been involved with recursion in some way. Working through the lab, I was kind of surprised at how simple the exercises ended up being. I quickly figured out that the solutions to the majority of the exercises were a straightforward matter of updating the start and end of the list if applicable, then changing simple connections between nodes in the list. The experience was particularly interesting because my prior work with lists usually involve using built-in methods to do all the work updating and changing the lists without me ever having to think about exactly how these methods are accomplishing their goals. In week 8, the lab got me thinking about exactly what lists are: a bunch of nodes consisting of data values and a pointer to the next element in the list. I figure this will be somewhat similar to when I start learning lower level languages like C, where all of the internal workings that Python hides from me will be laid bare. I'm excited to be more exposed to this kind of material so I can learn more about how to make my code faster, more efficient, and better suited to the modern world.

Thursday, 19 March 2015

Week 8: Impressions of Week 7

Here in CSC148 throughout week 7, we were introduced to the abstract data type of the binary tree. Building upon the generic Tree ADT that we were introduced to earlier in the semester, the binary tree has the special characteristic of having up to two child nodes designated "left" and "right". Personally, one of the really radical things about the binary tree (and by extension, the tree) is how the class is kind of "recursive" simply in its existence. When I say that, I mean that the tree is essentially made up of a node that points to two smaller trees. In addition, the trees are stored through a class that keeps track of nodes, with internal nodes also keeping track of their children and their children's children. The root node of humongous trees with millions of children is an instance of the same class that each and every child node is also an instance of. If there was ever an ADT that was perfect for recursion, this is it.

As mind-boggling as recursion has a tendency to be at times, the class designed around recursion was just as mind-boggling as I expected. Going through the exercises in labs, I managed to gain a pretty solid grasp of what was going on, but the whole system of having trees contained inside of nodes of trees and having an entire tree represented in a single node was kind of a weird concept to wrap my head around. By the end of the lab, I had built-up the same relationship with the implementation of the binary tree as with the limit in calculus and particle-wave duality of electrons in physics: I could solve problems with them and I accepted that they existed and were valid, but the concepts didn't seem to fit quite right in my head. Hopefully, with time and more practice, I'll gain a stronger grasp of the concept of how a binary tree is implemented.

Week 7:

To the TA marking this, please mark my summary of object-oriented programming concepts. Thank you.

Week 6: A Summary of Object Oriented Programming Concepts

Object oriented programming is a type of programming language that revolves around storing data in "objects". These objects have properties and behaviour that can be accessed and utilized when solving problems pertaining to these objects. 

To better communicate how object-oriented programming actually works, let's take a look at an example of an object: a human. Humans have names, titles, addresses, phone numbers, and countless other instances of information that describe something about that particular human. Depending on what exactly you wanted to do with your human, you'd need different information. An employer would want a degree or diploma and a criminal record, if any, while a school looking at prospective applicants would want an academic transcript. A potential significant other would be more interested in this human's interests, hobbies, and, well, knowledge of a criminal record definitely wouldn't hurt. 

Working with these human objects involve needing the ability to access all of this information (ideally in a quick, convenient manner) and to update the information as our human conducts his life. In addition, though all humans have certain characteristics in common, some will require keeping track of additional information that other humans won't need to deal with. For example, a student will need a list of courses they're enrolled in, the name of the school they attend, and an academic transcript, to name a few things. In contrast, a carpenter would have absolutely no use for those things to help him or her perform as a carpenter. A doctor, a lawyer, and a teacher yet have different sets of data that they require that would lack any application or meaning in a different profession. And yet, all of these people need to keep track of basic information like their names.

Object oriented programming addresses all of these issues and more through implementing concepts like inheritance. You can create a general class that stores all the general information that every human needs, while creating subclasses for specialized humans that have specialized needs. You can easily access and modify all of this information to solve the various problems that arise with various different types of humans. An additional strength with OOP is that, without even looking at any of the source code of the super class, you can simply use the methods in the super class to create specialized methods by amalgamating the more general super class methods.

Object-Oriented programming is a powerful paradigm that provides a simple, straightforward way to translate complicated real world issues into code.