12 Weeks of winter term of 2015 finally ended and so did CSC148. Honestly, it wasn't a piece of cake for me. I still have stuff that I need to work on to understand and improve. At this point, I feel a lot more pressure about learning programming because there are enormous amount of things about programming starting from the number of programming languages(which I only started to learn one of them).
For last 12 weeks, I learned more about object-oriented programming, abstract data type, recursion, tree, node, binary tree search and more. I can't say that I am perfect with all the materials since I didn't get good marks on my midterm 2 which I did not really expect to be that bad and now I'm pretty depressed about it. But, on the bright side, I know exactly what I need to study more and this is not the end. I still have final exam and I believe in myself that I will improve my skills and knowledge and do well on the exam.
All the materials, contents, assignments were quite challenging. Mostly, they required lots of time of thinking. To be on the right track, I had to practice a lot on thinking logically. When I didn't find a right direction, the result was definitely full of errors. But even though I was on the right track, there was a small thing or a little part of the last step tackled me to make my codes work. Every time I confronted all this frustration, sadly, I felt like I'm stupid. However, when my codes finally worked, it was the pure happiness that came to my mind. I did say that I felt like I'm stupid when my codes didn't work, but somehow, I was enjoying that moment. It was sound and healthy frustration. Actually, the more I struggled, the more I was motivated to solve the problem.
I'm not perfect. I'm not really smart either. But I will keep learning, coding and enjoying programming. Because I believe that this is not the end but it is the start of my life journey of coding.
Search This Blog
Friday, April 3, 2015
Friday, March 27, 2015
Don't look back in anger!
One more week! Only one more week is ahead of me. Can't believe this term is almost over. Time flies. I haven't fully understood all the materials we've covered, but the end is coming. I'm having mixed feeling of relief, excitement, regret, disappointment and anger. I'm relieved and excited cause the term is almost over and I can finally have some piece in my mind. But at the same time, I regret that I didn't work harder and disappoint and angry at myself cause I didn't achieve the level I planned at the beginning of the term.
However, while I was reading my past posts again, I looked back again and calm myself down from frustration. I could tell it wasn't super easy course for me, but I did try to do some work. Also, I found many resources that I can use for my study and my understanding of materials is definitely better than before.
Well, I don't have anything to agree or disagree to my previous posts. My blog is mostly to record the stuff that I learned and to help my memory and understanding. It might be perfect, but I hope some of the information that I linked would be helpful to whoever come across my blog as they were good resources for me.
I also browsed some of the blogs of the other students. I didn't check every single blog(unfortunately and of course,) instead I was scrolling down and click simultaneously then I can choose random blogs. I've seen some blogs similar to mine, or shorter, loger and even empty one. Many of students were working hard on this course on their own way. Some of the blogs that I visited were very intuitive and motivated.
Here are two of the blogs that I really like:
http://computersciencebysystemupdates.blogspot.ca/
This blogger writes very intuitive posts. His summary of Object-Oriented Programming was very well-organized. Also the one with the drawing beautiful fractal using turtles was amazing and motivated me to mess around with codes.
http://galexwongcsc148.blogspot.ca/
I picked this one because the posts were well-written. It represents honest impression of the course of the blogger and the blogger expressed feelings and opinions in a neatly manner.
I wish my blog also looks good to other students as well and I thank all the students for their effort cause it motivated me to keep going.
Until I become better, I will keep going and for now, I will prepare for the next week so I won't let myself down.
However, while I was reading my past posts again, I looked back again and calm myself down from frustration. I could tell it wasn't super easy course for me, but I did try to do some work. Also, I found many resources that I can use for my study and my understanding of materials is definitely better than before.
Well, I don't have anything to agree or disagree to my previous posts. My blog is mostly to record the stuff that I learned and to help my memory and understanding. It might be perfect, but I hope some of the information that I linked would be helpful to whoever come across my blog as they were good resources for me.
I also browsed some of the blogs of the other students. I didn't check every single blog(unfortunately and of course,) instead I was scrolling down and click simultaneously then I can choose random blogs. I've seen some blogs similar to mine, or shorter, loger and even empty one. Many of students were working hard on this course on their own way. Some of the blogs that I visited were very intuitive and motivated.
Here are two of the blogs that I really like:
http://computersciencebysystemupdates.blogspot.ca/
This blogger writes very intuitive posts. His summary of Object-Oriented Programming was very well-organized. Also the one with the drawing beautiful fractal using turtles was amazing and motivated me to mess around with codes.
http://galexwongcsc148.blogspot.ca/
I picked this one because the posts were well-written. It represents honest impression of the course of the blogger and the blogger expressed feelings and opinions in a neatly manner.
I wish my blog also looks good to other students as well and I thank all the students for their effort cause it motivated me to keep going.
Until I become better, I will keep going and for now, I will prepare for the next week so I won't let myself down.
Wednesday, March 18, 2015
BST: Binary Search Tree
Binary Search Tree is based on the property that right child is bigger than the parent, and the left child is smaller. When binary tree is generated this is always true. Therefore, when search for an item, we can use this property and make searching process simpler instead of checking all the items in the tree.
The successor is the node that are next-largest. Because of the property of tree, we can conclude that there are three cases when look for an item.
The successor is the node that are next-largest. Because of the property of tree, we can conclude that there are three cases when look for an item.
- If the node has a right child, then the successor is the smallest key in the right subtree.
- If the node has no right child and is the left child of its parent, then the parent is the successor.
- If the node is the right child of its parent, and itself has no right child, then the successor to this node is the successor of its parent, excluding this node.
def _find_min(node: BTNode) -> BTNode:
'''Find and return minimal node, assume node is not None'''
return _find_min(node.left) if node.left else node
This is a part of the code from the class BTNode and details omitted. Since finding maximum has been discussed in the class, I tried out finding a minimum based on the lecture. Notice that the only the left children are checked, and the process is recursive.
There are more things that can be done using Binary Search Tree. So, understanding this will be a crucial when it comes to data structures.
Friday, March 13, 2015
The pain of recursion, and more
Recursion, recursion, and recursion!
Ok, so recursion is important concept. It seems I can't get away from this in this course. All the labs, assignment 2 was about recursion. And yes, the assignment! Minimax! Oh, you minimax! I still don't understand why I couldn't write this properly. I understood what is going on, and knew which part is recursive. But then, why is it so hard to make it work? I still can't figure it out what I am missing.
I see some students who are good at this and say that recursion is easy. Well, I have nothing to say. Recursion is not easy for me(, yet.) I wish I could naturally understand recursion like one of those guys, but I guess I have to take an honest, work-hard path to get to the level I want.
Generating Tree using nodes and children felt abstract. Sometimes, it is clear what I am doing but sometimes, depend on objects, it is quite hard to imagine how Tree is generated. For example, Minimax from assignment 2 was quite hard to bring the concepts into my head. Game state represents the state of current game and it is NoneType. Basically, Minimax uses this current game state to look all possible moves that can be chosen and suggest a strongest move based on this data. Of course, game state can be expressed as a string form, but I needed to use more to use Minimax.
I could tell where it's recursive but I couldn't write right recursive code. The assignment due is passed so there is nothing I can do any more, but I still kinda feel uncomfortable. Unsolved problems leave me such an uncomfortable, unpleasant feeling. Furthermore, despite of my frustration, the class goes on.
Ok, so recursion is important concept. It seems I can't get away from this in this course. All the labs, assignment 2 was about recursion. And yes, the assignment! Minimax! Oh, you minimax! I still don't understand why I couldn't write this properly. I understood what is going on, and knew which part is recursive. But then, why is it so hard to make it work? I still can't figure it out what I am missing.
I see some students who are good at this and say that recursion is easy. Well, I have nothing to say. Recursion is not easy for me(, yet.) I wish I could naturally understand recursion like one of those guys, but I guess I have to take an honest, work-hard path to get to the level I want.
Generating Tree using nodes and children felt abstract. Sometimes, it is clear what I am doing but sometimes, depend on objects, it is quite hard to imagine how Tree is generated. For example, Minimax from assignment 2 was quite hard to bring the concepts into my head. Game state represents the state of current game and it is NoneType. Basically, Minimax uses this current game state to look all possible moves that can be chosen and suggest a strongest move based on this data. Of course, game state can be expressed as a string form, but I needed to use more to use Minimax.
I could tell where it's recursive but I couldn't write right recursive code. The assignment due is passed so there is nothing I can do any more, but I still kinda feel uncomfortable. Unsolved problems leave me such an uncomfortable, unpleasant feeling. Furthermore, despite of my frustration, the class goes on.
def append(self, value):
''' (LinkedList, object) -> NoneType
Insert a new node with value at back of lnk.
>>> lnk = LinkedList()
>>> lnk.append(5)
>>> lnk.size
1
>>> print(lnk.front)
5 ->|
>>> lnk.append(6)
>>> lnk.size
2
>>> print(lnk.front)
5 -> 6 ->|
'''
new_node = LLNode(value)
if self.front is None:
self.front = self.back = new_node
else:
assert self.back, 'Unexpected None node'
self.back.nxt = new_node
self.back = new_node
self.size += 1
So, this is a part of class LinkedList. At first, I was thinking about literally linked list, like multiple lists are somehow handcuffed each other kinda shape. It turned out I had a wrong concept. Just to help myself remember what this is... Linked list is created based on nodes. Suppose there are some nodes created with numbers like the docstring above. Initial LinkedList will be empty when it's called for the first time. Using append, I can append node into the LinkedList. Now, there is one node and the size of link is 1. If I insert another one, the new node will be at the back of the link, and the existing node becomes the front one. The size also changed to 2, the numbers of items in the link. Not only can I append items at the back of the link, I can also insert at the front, or check an item in the link. I found that drawing the pictures help me to figure out how each object becomes different attributes.
I'm still little behind on all Tree stuff, so adding LinkedList on my study list is little burden now. But what can I do, I will keep working one step at a time.
(Cheer me up, Fry!)
Friday, March 6, 2015
Visiting nodes in tree
So far, we've learned about binary node tree with nodes and children namely left child and right child.
def __init__(self, data, left=None, right=None):
''' (BTNode, object, BTNode, BTNode) -> NoneType
Create BTNode (self) with data and children left and right.
'''
self.data, self.left, self.right = data, left, right
Now, I know how to create Binary Tree Node. But what do I do with this?
This tree also contains data so finding data that I want will be something I need to study. How do I find the data within the tree then? In order to find the specific data, I will have to go through each node in tree and verify if that is the correct one. Once I find the right one, I can return the result.
There are three ways to visiting noes:
- inorder
- preorder
- postorder

<Inorder>

<Preorder>

<Postorder>
Ok, it's not pretty drawings but there's so much I can do with mouse and I'm not really good at drawing. But pictures are way easier to understand and remember this for me, so, for the sake of my memory, I am taking the risk of public embarrassment on the web. At least, I will never forget this.
Thursday, February 26, 2015
What is Abstract Data Type anyway?
Object-Oriented Programming contains other concepts to be designed. One of them is 'Abstract Data Type'. Frankly speaking, I am still not confident to define the definition of Abstract Data Type(ADT). According to the lecture, we abstract data and operations, and suppress the implementation. For example, sequences items that can me added, removed, accessed, specialized list with access to only recently added item, collection of items accessed by associated keys.
Further research provided me better understanding of ADTs.
Basically, ADT is a mathematical model for data types where is defined by its behaviour from the point of view of a user of the data. Integers can be ADT, so can queue, list. Data structures such as queue, dequeue, list, tree, graph, set, which I already learned are included in ADT.
The picture above shows how ADT can be defined. The video I found on Youtube summarizes and explains well on this subject and it was great help for me to understand.
Further research provided me better understanding of ADTs.
Basically, ADT is a mathematical model for data types where is defined by its behaviour from the point of view of a user of the data. Integers can be ADT, so can queue, list. Data structures such as queue, dequeue, list, tree, graph, set, which I already learned are included in ADT.
![]() |
| Abstract Data Type |
If anyone interested , watch this video, hope it will help you organize your thought as it did to me. Also, this is the link of the page that contains the above picture. It is a part of free online book called 'Problem Solving with Algorithms and Data Structures using Python' by Brad Miller, David Ranum. This book also talks about basic data structures, sorting, searching, tree which we have learned in the class. I think it could be a good reading for further reference.
http://interactivepython.org/courselib/static/pythonds/Introduction/WhyStudyDataStructuresandAbstractDataTypes.html
In ADT, there are different data structures. Each data structures itself has many things to talk about. My goal from now is, reading about more ADT and study each data structures in ADT.
Sunday, February 15, 2015
Object-Oriented Programming
Object-Oriented programming.
Object-Oriented programming is one of programming paradigms based on "objects" just like its name. What does it mean by 'based on objects'? How do we program this?
The concept of OPP(Object-Oriented Programming) seemed vague. Ok, I got the 'Object' part. Probably related to the using objects. But what does that mean? How do I use it? Just the taking the lecture was not enough for me to understand whole concept of OOP, so I studied about OOP further.
So, yes, Object-Oriented Programming(OPP) uses objects to program. The objects are data structure that contains data and it's also called 'attributes'. In the computer program using OOP, it is constructed on objects and these objects are interact with each other. For example, we have learned how to write classes. This is one way to design object-oriented program.
When I design a class, I initialize objects according to the purpose of codes I am writing. Then, I will probably add more methods that uses objects I initialized to get other result for a class. Like this, each objects are related to make computer program work. As I practice labs and exercises, I learned that using the objects to design program requires well-organized plan ahead what I want to write, proper purpose of classes and right contents in those classes.
A messy plan leads the result nowhere. It is hard to build the entire class and often hard to decide what to write for each methods or even what to initialize for a class. When the plan is well-organized and solid, it is easy to proceed to write. Having a plan also saves lots of time since it gives me a direction to next step. Just like we have a recipe for writing a function, organizing plan is good way to start.
An excellent, motivating plan without specific purposes of class, however, will be like poutine without gravy. One class should contain objects and functions that are relative to class docstiring. If the class doesn't do what is supposed to do, it will create confusion to users and it will be hard to make connect to other classes. Setting the specific purpose of a class and implementing proper methods are absolutely important to OPP.
In OPP, the following concepts are included as well:
Not only is there Object-Oriented Programming for paradigms, also there are many other ways to design program. I only started to learn OOP, but there are so much to learn in OOP. So far, this is my understanding of OOP.
<Further study for OOP and other paradigms, I leave the Wikipedia link>
http://en.wikipedia.org/wiki/Object-oriented_programming
Object-Oriented programming is one of programming paradigms based on "objects" just like its name. What does it mean by 'based on objects'? How do we program this?
The concept of OPP(Object-Oriented Programming) seemed vague. Ok, I got the 'Object' part. Probably related to the using objects. But what does that mean? How do I use it? Just the taking the lecture was not enough for me to understand whole concept of OOP, so I studied about OOP further.
So, yes, Object-Oriented Programming(OPP) uses objects to program. The objects are data structure that contains data and it's also called 'attributes'. In the computer program using OOP, it is constructed on objects and these objects are interact with each other. For example, we have learned how to write classes. This is one way to design object-oriented program.
When I design a class, I initialize objects according to the purpose of codes I am writing. Then, I will probably add more methods that uses objects I initialized to get other result for a class. Like this, each objects are related to make computer program work. As I practice labs and exercises, I learned that using the objects to design program requires well-organized plan ahead what I want to write, proper purpose of classes and right contents in those classes.
A messy plan leads the result nowhere. It is hard to build the entire class and often hard to decide what to write for each methods or even what to initialize for a class. When the plan is well-organized and solid, it is easy to proceed to write. Having a plan also saves lots of time since it gives me a direction to next step. Just like we have a recipe for writing a function, organizing plan is good way to start.
An excellent, motivating plan without specific purposes of class, however, will be like poutine without gravy. One class should contain objects and functions that are relative to class docstiring. If the class doesn't do what is supposed to do, it will create confusion to users and it will be hard to make connect to other classes. Setting the specific purpose of a class and implementing proper methods are absolutely important to OPP.
In OPP, the following concepts are included as well:
- Classes of objects
- Instances of classes
- Methods acting on objects
- Message passing
- Abstraction
Not only is there Object-Oriented Programming for paradigms, also there are many other ways to design program. I only started to learn OOP, but there are so much to learn in OOP. So far, this is my understanding of OOP.
<Further study for OOP and other paradigms, I leave the Wikipedia link>
http://en.wikipedia.org/wiki/Object-oriented_programming
Friday, February 6, 2015
Recursion? Recursion!
First thing came into mind about recursion was fractal from mathematics. Repeating same process looked like same shape is repeated in fractal. At first, this didn't seem complex. However, soon after, I could find myself being confused and frustrated. Right, nothing is easy. I forgot about that.
The handout exercise was not hard. But when I tries to write functions, the errors kept rising. I could tell in which part the recursion occurs. The hard part was the implement. It was quite hard where to put recursive one. And considering all relationships between type contract, return value. Consequently, putting them all together was more complicated than I thought.
What I expected to happen with my code often did not work properly. It takes time to get my code work properly. (But it feels like endorphins is spreading to every part of my body fast once I figure it out!) I guess, I am not really understanding how it works yet or need more practice and experiment with practice.
Most of the recursion function bodies were relatively simple and short compares to functions without recursion. Once I solve what exactly recursion does in the function, the solution was simple. All I need to do is think hard to find right recursion case and properly implement.
This is definitely not easy at all. But If I think about what recursion does and how it works, it comes to handy tools when writing some tricky codes. While we are learning this, my goal is to understand recursion and make myself comfortable with it.
Saturday, January 31, 2015
So much to learn!
First few weeks of the class was surprising for me. All I know about programming, specifically Python, is what I learned from previous course CSC108 and some bits of stuff from Google. Then, in my new class, I realised there are so many things to learn more about Python and what I know now is just a tip of iceberg. I mean, super gigantic enormous great iceberg.
When I was in the class, I noticed that the way professor writes code is more simply and flexible. Also there were so many way to implement something with stuff I know such as if, for, etc. I was surprised, and at the same time, I kinda bummed out because I felt like I really didn't study much about Python. But at the same time, I was glad that I was introduced to new level so I can improve myself to the next step.
The material felt harder than the previous course as well. In this term, it seems that we are focusing on writing my own 'Class', which I'm still having hard time understanding and writing them. Last term, 'Class' was taught at the end of the terms. We had handouts to practice writing it about recording date, event, modifying it, etc. I did solve them, but I didn't really understand fully how this 'Class' thing works and how to implement properly if I encounter other problems. I was struggling to understand purpose of writing 'Class'.
So when I started this class and found out that the course is based on 'Class', I was very worried that I might be able to catch up. But, going into almost week 5, I feel more comfortable with 'Class'. I have reviewed materials from CSC108 and searched about 'Class' more on the Internet. And with labs, I will be even more comfortable writing 'Class' as time goes by, though this is based on the promise that I will work hard, and I will.
My impression so far, the course is challenging but it is full of interesting stuff that I want to dive in.
When I was in the class, I noticed that the way professor writes code is more simply and flexible. Also there were so many way to implement something with stuff I know such as if, for, etc. I was surprised, and at the same time, I kinda bummed out because I felt like I really didn't study much about Python. But at the same time, I was glad that I was introduced to new level so I can improve myself to the next step.
The material felt harder than the previous course as well. In this term, it seems that we are focusing on writing my own 'Class', which I'm still having hard time understanding and writing them. Last term, 'Class' was taught at the end of the terms. We had handouts to practice writing it about recording date, event, modifying it, etc. I did solve them, but I didn't really understand fully how this 'Class' thing works and how to implement properly if I encounter other problems. I was struggling to understand purpose of writing 'Class'.
So when I started this class and found out that the course is based on 'Class', I was very worried that I might be able to catch up. But, going into almost week 5, I feel more comfortable with 'Class'. I have reviewed materials from CSC108 and searched about 'Class' more on the Internet. And with labs, I will be even more comfortable writing 'Class' as time goes by, though this is based on the promise that I will work hard, and I will.
My impression so far, the course is challenging but it is full of interesting stuff that I want to dive in.
Saturday, January 24, 2015
Writing is communicating.
Writing wasn't a fun task for me when I was young. Whenever the writing tasks were given, I was so stressed out and didn't understand WHY I have to write all these things. Many times, I had a hard time to start writing. At the beginning, I didn't know how to start my writing and how to proceed to what I want to say. Also I didn't really understand why I need to learn how to write if I like math or science subjects better. After I grew up, started reading many articles, posts, books, etc, however, my opinion has been shifted.
Thanks to all writing practices and reading, my writing skills improved, and the improvement gave me a new thought on writing. I guess, it's because that I became able to tell if it is a well written material or not. Then, I started realize how important the writing is. When I read a badly written article or post, I found that either it is hard to understand or it didn't make sense. Reading stuff that is not well written, somehow upsets me.
Why do I feel upsetting when I read bad writings? The answer is in the purpose of writing. We write to inform, record, communicate. In particular, if the reason of writing is communicate with other people, it certainly requires readability. No matter how long I explain something in my writing hard, if it's not organized and written properly, it is no use of reading.
For computer programmers, reading a script of codes is the way they communicate each other. To share and discuss what they have created, they sometimes put comments between the codes to give a simple explanation of codes. Even if that is the greatest codes, if the author made bad comments in it, so no one really understands what is going on, discussion would not go smoothly. Some people might even lose interests in those codes.
Sharing information and knowledge is important these days. In the past, everything was written and published as books, but now we have Internet which makes it so much easier to share something. But if you don't know how to write properly to express your thoughts, what's the purpose of sharing? You will be isolated and there will be no progress eventually, while others vigorously discuss with each other and make improvements. Therefore, it is very important for a computer savvy to know how to write.
Thanks to all writing practices and reading, my writing skills improved, and the improvement gave me a new thought on writing. I guess, it's because that I became able to tell if it is a well written material or not. Then, I started realize how important the writing is. When I read a badly written article or post, I found that either it is hard to understand or it didn't make sense. Reading stuff that is not well written, somehow upsets me.
Why do I feel upsetting when I read bad writings? The answer is in the purpose of writing. We write to inform, record, communicate. In particular, if the reason of writing is communicate with other people, it certainly requires readability. No matter how long I explain something in my writing hard, if it's not organized and written properly, it is no use of reading.
For computer programmers, reading a script of codes is the way they communicate each other. To share and discuss what they have created, they sometimes put comments between the codes to give a simple explanation of codes. Even if that is the greatest codes, if the author made bad comments in it, so no one really understands what is going on, discussion would not go smoothly. Some people might even lose interests in those codes.
Sharing information and knowledge is important these days. In the past, everything was written and published as books, but now we have Internet which makes it so much easier to share something. But if you don't know how to write properly to express your thoughts, what's the purpose of sharing? You will be isolated and there will be no progress eventually, while others vigorously discuss with each other and make improvements. Therefore, it is very important for a computer savvy to know how to write.
Subscribe to:
Comments (Atom)
