Saturday, 28 February 2015

Week 7: Pimp My Function


 CSC 148 Entry 6

     Yo dawg I heard you like to write functions, so I made you a function that calls on itself so you can use the function to iterate through trees and other types of data structures.


     The more I learn about recursion the more I am impressed by the various possible things which can be done with recursion. For example, we learned how to iterate through lists nested in lists. When I originally saw the problem I was thinking of possible convoluted solution to the problem. However, the solution was so simple and elegant.

if isinstance(variable, list):
     return something([funciton(x) for x in variable])

This solution to the problem of iterating through the nested lists seemed so rudimentary yet complex at the same time. It really touched me and and I had a thought that this is what computer science is about coming up with elegant solutions to problems instead of brute forcing them. From then I see recursion in a new light.

     Most of the problems posted in lab 5 and 6 required the use of recursion to solve and this was actually quite challenging to try and solve. The problem was because it was a lot of work and that it required a lot convoluted code to solve; the problem was trying to wrap your mind around the concept of how the function would run over and over again and the possible cases which there are. I found the advice which Professor heap gave in lectures to think of all the different possible cases starting with the base case extremely helpful because it gave me a focus to start off from and eventually solve the problem.

    Although I found the recursive problems very hard, the more problems I see, the more simpler recursion seems. I think this is because all of the solutions to the problems are very similar. You just have to focus on the bases case, accounting for different scenarios and write the recursive step. When working on minimax I found it really helpful to draw diagrams of what is going to happen in each case, I think this is the key to recursion, its not how it will be implemented it's thinking of the conditions for the recursive function. After knowing what to account for the code basically writes itself.

Tuesday, 17 February 2015

Week 404 not found: Under the Weather

CSC 148 Entry 5

     Unfortunately after some partying with friends I'm now sick. ): I haven't been this sick all term. I feel sort of thankful though that I'm sick when there's no class.

Friday, 13 February 2015

Week 6: A Tangible Object that's Made of 1's and 0's

CSC 148 Entry 4

    Before I talk more about the my understanding of Object-Oriented Programming I thought I think it's sort of poetic having objects exist as an abstract concept within the computer yet existing as nothing more in the physical world as some pattern encrypted onto our computers. So I think it's quite ironic when we call them objects yet it is so fitting.

     Object-Oriented Programming is the creation of classes which in turn dictates the properties which an object of that class has and what can be done with the object. When I first created a class for the first time and understood the implications of what I have done I felt like I was an omniscient being with unlimited power. In my mind I had the thought that I was creating atoms and dictating what physical properties they had and how they could interact with atoms. I think this is an analogy which is quite similar to what is the core concept of Object-Oriented Programming. Classes are like creating an representation of the properties of a type of object. Sort of like dictating the properties of an atom. Atoms are the core components of the world. Everything is made of atoms and different compilations of atoms. Much like how most programs are combinations of classes and how classes interact with each other.


     An instance of a class is defined as an object. Sort of like how matter is all an instance of some atom in the periodic table. Similar to how the periodic table have various groups such as halogens, earth metals, Nobal gases, classes can be under different classes. This is called Inheritance. The classes inherit all the properties of the parent class. Inheritance is something which object-oriented programming has that gives it an extra level of depth. It is essentially the ability to make subsets of objects. This creates a branching of possibilities of types of objects that exist and is very powerful for programming.

Friday, 6 February 2015

Week 5: Back to the Streets Where We Began!

CSC 148 Entry 3

     After seeing more of recursion, although sometimes it takes me a quite to trace and understand the code, it's arguably the most useful concept which I have learned this year. After seeing a lot more of it this week, I have a much greater understanding it and how powerful a tool it is. In CSC 165 last semester I learned about time complexity, recursion seems to have a very large big O because of the nature of how recursion works. This was something I was thinking about when recursion was being taught to me. So in my mind I had this mental image of the scene from Spiderman where his grandfather told him that with great power comes great responsibility. However, Instead of it being Spiderman's grandfather it was professor Heap and he as saying with great recursion comes great time complexity. I couldn't help but thing of it having spent so much time on Big O last term with professor Heap. I think I improved a great deal when using recursions from when I first encountered.  them. I think this all comes from how I can trace them a lot easier.

     I dunno how I well I did on the test. I realized after handing in the test that I miss understood the question. I think that it will cost me dearly because the test only has three questions on it. One of my friends in the course expressed concern for the test.

http://sicilliax.blogspot.ca/2015/02/impression-of-first-few-weeks_1.html

However I did not think much about that much about the test because I felt that I had such a great understand of assignment one. I was really confident about the work I did for assignment one that I went into the test with a strange calmness.

Thursday, 29 January 2015

Week 4: The First Week of Comp Sci Professor Heap Gave to Me!

CSC 148 Entry 2

     Although I have some previous experience in the field of computer science on my own, 108 and 148 are my first real courses for the field of computer science. Luckily for me python is actually the language which I learned by myself. I am quite comfortable with the material which was displayed the first week in lectures. However the concept of recursion seems like it can give me some trouble since it seems like it can get quite complex quite fast. The first examples shown to us turtle seem quite intuitive and professor heap explained it quite efficient with much swagger. All jokes aside, I have never used the turtle methods before, and that's perhaps the only material in the first week which I am uncomfortable with since I haven't seen it before. I plan to look a bit more into the turtle class on my own so that I am more comfortable with the material which I have encountered.

    I actually really like the first assignment which was given to us. It's something which is quite interesting yet covers the topic which we have very well. I am quite interested in seeing what we have to come up with in the next few assignments since Heap said that the assignments in a way all builds on top of each other.

Thursday, 22 January 2015

Week 3: Deja Vu

CSC 148 Entry 1

     Writing on the topic of why geeks should write feels not politically correct because it carries the implication all those who are writing these slogs are geeks which is not necessarily true. Having been through the process of writing these slogs for 165 I am all to familiar with this process. Although I did not find the process to have much merit, I am open to the thought of it helping me. Perhaps I think a better guiding question is should we whether or not it is good to write a blog. During my past experience of writing a blog it felt like an arbitrary activity which I had no real interest in and only participated in because I was being graded on it. Something which I have grown to dislike over the past few years which is being forced to do things not out of general interest of doing them but being forced to do them. However, that's something which is probably inevitable since it's all part of growing up.