Friday, 27 February 2015

Abstract Data Types

Abstract Data Types
    Up until this point we've dealt with a number of abstract data types such as stacks, queues, trees and binary trees. The stack is simple enough to follow. You add some number of elements to the stack. Then when you remove them, the first one to be removed is the last one to have been added to the stack. Or essentially last in, first out. As with queues, they run on a first in first out basis. The first element to be added to the queue is the first one to be removed. Comparing the stack with the queue, my thought is that each abstract data type is situational. That is, dependent on the circumstance, one may be more beneficial to use than the other. The tree as I understand is to be thought of as more or less a representation of an upside down tree. Such that each place where a new branch branches off is considered a node. Furthermore, a binary tree is a specific type of tree where each parent node can have up to and including two children nodes. The nodes in a tree then can be their own data type. Again, each data type is better suited to different circumstances. Traversing the trees brings us a whole bunch of options. We have traversals such as preorder, inorder, and postorder. Essentially, how preorder works is it displays the root node's data, traverses the left subtree recursively while displaying the current node's data, and then traverses the right subtree similarly displaying the current node's data. Inorder and postorder are simply just variations of the steps in preorder. In inorder, it traverses the left, displays the data of the root, and then traverses the right. For postorder, it traverses the left, then it traverses the right, and finally it displays the root's data. In the end, these concepts aren't too difficult to understand. 


Thursday, 26 February 2015

Object Oriented Programming

Object Oriented Programming
    The whole concept of object oriented programming I find to be a life saver. Being able to create your own data types not only saves time but also simplifies everything. I can only imagine how horrendous it would be trying to create some huge software just with lists and dictionaries. Having all those variables floating around, not necessarily being connected to each other would become overly confusing. Having techniques such as inheritance possible gets rid of the need of rewriting the same code as seen in our assignments and labs. So far we've done class inheritance with the introduction of subclasses but I'm sure such concepts such as object inheritance will come in handy. In fact, I think it would be widely used rather than creating a new data type each time when you only need to change a few things. Creating a basic "super" object with which you then inherit to create various other sub objects. We can virtually customized any type of data structure to match our needs. This week, learning more about recursion; it really lets us do so much when dealing with abstract data types. For instance when we traverse trees, otherwise we'd have to use so many loops rather than a couple lines of simple code. I'm sure what we've learned about object oriented programming doesn't nearly cover the scope of it's entirety. I haven't had the chance to work with a procedural programming language so I can't compare and contrast the two as I've only worked with Python and Java but I'm sure each has their own benefits. If I were to guess, I'd probably say that the procedural languages are for times where you need to be closer to "computer" language or byte code.

My Thoughts On Recursion


My Thoughts On Recursion

               Tracing recursion has been really interesting to say the least. Essentially compacting a method like that will be very beneficial. Being able to replace having to use all those for loops to get a simple task done makes this a life saver! Of course I can't say grasping the concept has been easy. The fact that we'll have to trace recursive methods on our test is what's worrying me the most out of all the concepts we've learned. However, all these new concepts we've been learning and will learn are what really make this class interesting. I'll just have to put the effort in to get the concept down but in the end it'll be worth it. From my current understanding, we define what a base case returns and by doing so the recursive part of the method always starts with the inner base case of the input. From there it works its way further out of the input until it can no longer do so. At this point it returns the answer. The whole concept I find to be really clever!

CSC148: The Beginning


CSC148: The Beginning

               Having had the privilege to have Professor Heap first semester for my CSC165 course, I've been very excited for CSC148. Compared to CSC108, lectures have been more technical and hands on. I can see why it would be called Introduction to Computer Science as opposed to Computer Programming. The tutorials themselves are really detrimental to gaining a solid understanding of the curriculum. The whole hands on aspect is something that CSC108 lacked. When I was working on assignment one, the techniques I had used in the tutorials directly helped me. Saying such is an understatement! The tutorials were a huge help doing the assignment and gave me a grasp of the fundamental concepts required in the assignment. In regards to recursion, the concept is rather confusing but will probably clear up with more practice. It seems very practical and time saving however so it'll be of much use to learn.  As for the test, I feel pretty prepared as we were taught really well by Professor Heap and our T.A.'s alike! All in all I'm really glad I decided to become a computer scientist and am looking forward to what else the class has to offer.

Why Should Computer Scientists Write?


Why Should Computer Scientists Write?

               In movies, computer scientists are portrayed as these hackers who program all day, have minimal contact with the outside world and are.. well.. geeks. I'm here to say this is a huge misconception. If I were to compare a computer scientist to another field I'd compare it to an artist. Our programming languages and software are our paintbrushes. What we create requires ingenuity, and imagination. It's a form of expressing our ideas, and what better way of sharing ideas than writing? I don't want to say that the perspective I gave at the beginning is completely wrong, because quite frankly it's not. Sure we program a lot but communication is probably the most important thing for a computer scientist. We have to work together create software and expressing our ideas is integral to the software's creation. Hence through writing we get the spread of ideas. We can get our thoughts on paper and begin to formalize our ideas. Writing down how we proceed to solve a certain problem is like how an architect sketches the structure to a building. Getting that game plan down whether it's in pseudo code or words helps serve a great deal. By far, doing this before jumping in and programming saves lots of time which would be spent on figuring out how to integrate all the moving parts. The whole open source concept is based on the spread of ideas and it's very successful. With how we're all connected through the internet, teams of people working on various projects from various locations have to be on the same page. Hence, computer scientists must write to be able to work together. For instance imagine having to find a bug in code that someone else wrote, the only catch being they didn't comment any of their code. Or trying to gain potential investors without having any sort of documentation about your software. It's preposterous just thinking about it. There's no way around writing as a computer scientist. Writing makes computer science better. It's how we learn the concepts, how we teach others the concepts and so on.