It felt like time went by faster this semester compared to the last. All of my classes are now over and the only thing left in this school year are exams and 2 essays. My overall impression of this course was that the concepts of trees and recursions were very interesting. I wasn't really interested at the stuff we learned at the beginning and at the end, which were something to do with functions vs methods and big-Oh. I would say that while big-Oh intrigued me in CSC165, I guess I got tired of it by now.
What was particularly interesting about this course was that all 3 assignments were very closely connected. At the start of the course, when I heard that each assignment would build on the next one, one thought that crossed my mind was whether everyone would have to always have the same partners for all 3 assignments then. When assignment 2 came out, it turned out that starter code for a completed assignment 1 was given. So it turned out what I believed was false. Nonetheless, I worked with the same people for all 3 assignments. Option A of assignment 3 actually relied on a portion of assignment 2, the minimax strategy class. My group decided to avoid option A primarily because of two reasons. For one, we thought our minimax wasn't working perfectly, and the other reason was because it seemed much more complicated. Using the unit test in lab09, it turned out that our minimax was actually working fine and so the problem that we were encountering had to be in our tippy game state class. While working on option B, we were glad to have been provided with all the function headers and docstrings, unlike the previous assignment.
One of the biggest hurdle in this class for me was wrapping my head around the concept of recursion. It took me a week or two after being introduced to recursion to finally get what was going on. At the start I managed to implement recursive functions just fine following the steps we did for the sum_list function. But during the lab, when we got some more complicated recursive functions, I felt myself lost for the first time in any of my computer science course. In all previous scenarios, when an extremely difficult problem came up, I was able to solve it after some time, trying out different approaches. However, for these recursive functions that would have more than just I if-else statement, I found myself giving up before the lab even finished. It wasn't until working on assignment 2 with my friends that I was able to properly understand how to implement more complex recursive functions. I am glad that I got back to it even after having initially given up on it.
While in 12 weeks, it seemed like this course did not cover as many topics as CSC108, I felt that the focus on about 2-3 particular topics like recursion really worked well to tie together all of the tests and assignments. I enjoyed this course.
CSC148のSLOG
Thursday, April 2, 2015
Friday, March 27, 2015
Revisiting an Earlier Post (Week 11)
This week, I will revisit my Slog from Week 4. During Week 4, we were to write about our impressions of the first 3 weeks. In that post, I complained about how about half of each class was getting devoted to answering student questions regarding the first assignment. I agree that it is certainly a bit annoying to use most of class time to answer similar questions that were asked on Piazza. However, I also disagree to certain aspects of it. For both assignment 2 and 3, I have found the questions and answers to be much more helpful, especially when the professor includes slides to help answer common questions asked on Piazza. I suppose my original stance on this was different because I was not very into assignment 1. My group started assignment 1 late and it was generally simple. However, as the concepts gets more complex, assistance like this in class is no doubt helpful.
In Slog #9 by theCStist, they write about how they used to write code by trying a bunch of different things until it ended up working but now they take it step by step, starting with some examples. I find that this is basically what I was initially doing for the more complex recursive functions. I admit that sometimes I still do this. However, when the code does run, I try to go over the completed code and add comments to describe what I did there to help myself understand what I just did.
In Slog #9 by theCStist, they write about how they used to write code by trying a bunch of different things until it ended up working but now they take it step by step, starting with some examples. I find that this is basically what I was initially doing for the more complex recursive functions. I admit that sometimes I still do this. However, when the code does run, I try to go over the completed code and add comments to describe what I did there to help myself understand what I just did.
Saturday, March 21, 2015
Impressions of Week 9 (Week 10)
Last week, we wrote our second term test. I found the test to be straightforward and average in difficulty. Like before, studying the lab exercises and especially the additional exercises proves to be one of the most useful thing one can do in preparing for these tests. One thing I really didn't like was that the test took place so early at 9am for Diane's section.
During this week, we learned about mutating binary search trees. Although we got a short lab for it, I didn't bother doing it until after the test. And even after the test, it wasn't until week 10 that I really attempted it. Without having a lab to attend, doing these at home doesn't feel like it has much priority.
In this post, Jason writes that handwriting code is not a very good way of evaluating a student's skills in writing code as it results in a lot of careless mistakes. I agree that having tests be 100% hand written code is not the best way to evaluate people and in many cases, typing code does not directly translate into being able to hand write the code. Thus, when preparing for tests like these, students including myself will have to find alternate ways to prepare for the test including writing a bunch of practice code by hand. However, I find that it may be difficult to find an alternative to this as allowing students to write code on a computer will easily allow cheating. Furthermore, it would force every student to bring a laptop or the professors would have to somehow provide hundreds of computers, both of which are unrealistic scenarios.
During this week, we learned about mutating binary search trees. Although we got a short lab for it, I didn't bother doing it until after the test. And even after the test, it wasn't until week 10 that I really attempted it. Without having a lab to attend, doing these at home doesn't feel like it has much priority.
In this post, Jason writes that handwriting code is not a very good way of evaluating a student's skills in writing code as it results in a lot of careless mistakes. I agree that having tests be 100% hand written code is not the best way to evaluate people and in many cases, typing code does not directly translate into being able to hand write the code. Thus, when preparing for tests like these, students including myself will have to find alternate ways to prepare for the test including writing a bunch of practice code by hand. However, I find that it may be difficult to find an alternative to this as allowing students to write code on a computer will easily allow cheating. Furthermore, it would force every student to bring a laptop or the professors would have to somehow provide hundreds of computers, both of which are unrealistic scenarios.
Friday, March 13, 2015
Impressions of Week 8 [Linked Lists] (Week 9)
I found the idea of linked list to be a bit more easy to wrap my head around than the trees from the previous weeks. Mainly because it's linear, in the sense that the data do not keep spreading out. The data in a linked list is similar to cargo in a freight train, each node contains some stuff then contains the link to the next node.
When I looked over the code of the already implemented functions in the lab, I noticed that many of them has a similar segment of code which is used to traverse through it. Seeing this, I went back to the lecture slides and found that there was a page on walking through a linked list. I guess I must have missed this slide during class. You walk through a linked list by having a variable cur_node refer to the front. Then in a while loop structure, we do some stuff then set cur_node to cur_node.nxt.
This was the first lab exercise that we didn't get a chance to go into tutorial and get assistance from a TA. Since I didn't have my lab on Thursday this week, I sort of slacked off on the lab exercise. Once I did get to it, I was able to implement a few functions without a problem but then I ran into trouble with insert_before and delete_after. After trying some random stuff, I gave up and looked through the solutions. Although the solutions did help, I felt like I would have understood more if I was able to work through it myself after some feedback. However, I should probably only blame myself since I slacked off this week. I will try harder next week and refrain from blaming the strike for my lowered motivation to do lab work.
When I looked over the code of the already implemented functions in the lab, I noticed that many of them has a similar segment of code which is used to traverse through it. Seeing this, I went back to the lecture slides and found that there was a page on walking through a linked list. I guess I must have missed this slide during class. You walk through a linked list by having a variable cur_node refer to the front. Then in a while loop structure, we do some stuff then set cur_node to cur_node.nxt.
This was the first lab exercise that we didn't get a chance to go into tutorial and get assistance from a TA. Since I didn't have my lab on Thursday this week, I sort of slacked off on the lab exercise. Once I did get to it, I was able to implement a few functions without a problem but then I ran into trouble with insert_before and delete_after. After trying some random stuff, I gave up and looked through the solutions. Although the solutions did help, I felt like I would have understood more if I was able to work through it myself after some feedback. However, I should probably only blame myself since I slacked off this week. I will try harder next week and refrain from blaming the strike for my lowered motivation to do lab work.
Sunday, March 8, 2015
Impressions of Week 7 [Binary Trees] (Week 8)
During week 7, we learned about linked structures, using the class BTNode as the example. A binary tree (BT) is subcategory of trees. While a root in a tree structure may have infinitely many childrens, all contained within a list, a root in a binary tree may have up to two children. One of the examples we examined that made use of a binary tree was binary arithmetic expressions. Each of its root contains a "data" that can be used to evaluate its two children. For example, a root with '+', left node '3', and right node '4' would represent '3+4'. A more complex case would require recursion. Such as one with a root '+', left node '*', right node '7'. The left node (now the root), has a left node '3' and right node '4'. In order for this binary tree to make sense, each child node that also has children must evaluate its children and return the evaluated value up the tree so that its parent may evaluate that value. Doing this we would represent the expression '(3*4)+7', with the '(3*4)' evaluated first and returned as the left node. The final evaluation would look like '12+7'.
I didn't really get what preorder, inorder, and postorder was about. I will try to review them in the future. I found the idea of binary search trees to be rather convenient and interesting.
The parenthesize function in the lab was almost identical to the evaluate function we developed in class. I actually found this to be helpful in solidifying my understanding of recursion using binary trees. I found list_between and list_internal_between to be extremely difficult. I ran out of time during the lab to finish it, and decided to give up on it for the time being.
Coming back to this, I finally figured out what I was doing wrong in list_between and list_internal_between. My biggest mistake was to trying to implement the else block in one line like I did for every other recursive function. This has expanded my view on implementing recursive functions. I had always tried to stick to a single line per if, elif, and else for recursion because recursively calling the function would reset any sort of setting, counters and the likes in the function.
Having learned this, I think that I should try more ways to implement recursive functions, even if I initially think they are wrong. If I try enough ways to implement one, I will learn something from it even if I fail to correctly implement it the first few times.
I didn't really get what preorder, inorder, and postorder was about. I will try to review them in the future. I found the idea of binary search trees to be rather convenient and interesting.
The parenthesize function in the lab was almost identical to the evaluate function we developed in class. I actually found this to be helpful in solidifying my understanding of recursion using binary trees. I found list_between and list_internal_between to be extremely difficult. I ran out of time during the lab to finish it, and decided to give up on it for the time being.
Coming back to this, I finally figured out what I was doing wrong in list_between and list_internal_between. My biggest mistake was to trying to implement the else block in one line like I did for every other recursive function. This has expanded my view on implementing recursive functions. I had always tried to stick to a single line per if, elif, and else for recursion because recursively calling the function would reset any sort of setting, counters and the likes in the function.
Having learned this, I think that I should try more ways to implement recursive functions, even if I initially think they are wrong. If I try enough ways to implement one, I will learn something from it even if I fail to correctly implement it the first few times.
Sunday, March 1, 2015
Monday, February 16, 2015
Object-Orientated Programming Summary (Week 6)
Object-Orientated Programming (OOP) was the main focus of our first unit in this course. One of the features of OOP is inheritance. Inheritance allows us to be able to take and use methods from a previously written class rather than rewriting it all over again in a similar class. Suppose we made a Shape class which may have a method to get its area. Then we decide to create a Square class, which will have new attributes such as having defined side lengths. However, Square is certainly a Shape and also has an area. By having Square inherit Shape, we are able to use the previously established method to get the area from Shape in Square.
OOP allows us to organize our classes that are similar. For example, a Square and Triangle class both can be organized under an abstract class Square. We can define things that all shapes possess in Shape or at least lay out the foundation to be overwritten in one of its subclasses by implementing a NotImplementedError. Then we will define things specific to Square and Triangle in their own class. By having both of these classes inherit Shape, we can simplify our code by having other parts of our code work for generic Shape objects. Since Square and Triangle are both also Shape objects, any of code that works for Shape objects will work for them. Imagine making thousands of specific card classes for a card game. We would not want to implement code to deal with every single type of card classes. Instead, we can have every specific card class inherit a superclass Card then implement code to handle Card objects.
In inheritance, a subclass inherits methods and attributes from the superclass. It is then possible to extend a method from the superclass in the subclass by reusing the same code from it buy altering it in a way to better suit the subclass. It is also possible to completely override a method from the superclass by rewriting the whole method if a way to alter the original code to fit the new class is not readily available.
I thought the course's approach to teaching us OOP was okay. I generally found the examples to help me better understand what is going on when I decide to read over the course notes. I didn't really like how fast and rushed the first assignment felt. We were still going over many things involved in the assignment during class when it came out. In the end, my group ended up finishing the assignment during the last few days before it was due.
OOP allows us to organize our classes that are similar. For example, a Square and Triangle class both can be organized under an abstract class Square. We can define things that all shapes possess in Shape or at least lay out the foundation to be overwritten in one of its subclasses by implementing a NotImplementedError. Then we will define things specific to Square and Triangle in their own class. By having both of these classes inherit Shape, we can simplify our code by having other parts of our code work for generic Shape objects. Since Square and Triangle are both also Shape objects, any of code that works for Shape objects will work for them. Imagine making thousands of specific card classes for a card game. We would not want to implement code to deal with every single type of card classes. Instead, we can have every specific card class inherit a superclass Card then implement code to handle Card objects.
In inheritance, a subclass inherits methods and attributes from the superclass. It is then possible to extend a method from the superclass in the subclass by reusing the same code from it buy altering it in a way to better suit the subclass. It is also possible to completely override a method from the superclass by rewriting the whole method if a way to alter the original code to fit the new class is not readily available.
I thought the course's approach to teaching us OOP was okay. I generally found the examples to help me better understand what is going on when I decide to read over the course notes. I didn't really like how fast and rushed the first assignment felt. We were still going over many things involved in the assignment during class when it came out. In the end, my group ended up finishing the assignment during the last few days before it was due.
Subscribe to:
Posts (Atom)