Sunday, 8 March 2015

week #8 : impressions of week 7

In week #7, we continue learning tree. Instead of general tree which is the new knowledge taught in week #6, we learn a particular kind of tree called binary tree as well as the node class for a binary tree. A binary tree is a tree which only has two children called left children and right children. The binary tree can be easily understood once we got the idea how a general tree works. However, some functions under a binary tree class including contain function is a little bit different from the general tree class as we have to make it more specific into left and right children rather than just children.
Here is the contain function in a tree class:

And here are the contain functions in a binary tree:

All of them use recursion: first assume that the function contains works, and then make it to a helper function into the code itself. The only different is that writing contains function of a binary tree, we have to think both left and right children not like that in a tree class.
Overall, I think the tree class is interesting and is pretty helpful for us along with the recursion. Once we understand them and know how to use them perfectly, it will be our treasure in future studies.


Sunday, 1 March 2015

Summary of recursion

For the last few weeks, we have learnt recursion including how to understand the recursion code by tracing it and how to write some easy codes with recursion. But more importantly, in order to fully understand the what is the recursion, we need to define how to think in a recursive way.
For tracing the recursion code, I think it is the easiest part in the study of recursion. Just plug some examples which is from easy to hard into the code step by step and finally we will get the correct result unless we are not carefully enough.
For writing the recursion codes, it is a further lever of studying the recursion. Here is the way it goes, the problem with recursion can be easily solved and will be straightforward if you get used to recursive thinking. However, you can't even write a word on it if you are not familiar with the recursive thinking. So, a recursive way of thinking is very necessary for us to learn the recursion. 
So how to think like that? It is kind of different from when we do a normal code. Unlike we try to figure out the necessary code that can return the result we want when we are writing the code without recursion, we need to get the idea that what does the whole function do and think in a opposite way, which is that we assume that we've already got that function and use it as a helper function into the code. Before using that, we need to find a base case, which is the easiest possible result that it might return.
For me, although I got the idea how the recursion works, I still need more practice on that. I did the lab about recursion with some easy exercise and I got them all right. But the fact is that the recursion is weigh much harder than what we did before as we've started learning the tree which has almost every function that has to be done using recursion. I hope I can get used to that. 

Monday, 16 February 2015

summary of Object-Oriented Programming concepts

Talking about Object_Oriented Programming, I would like to say that almost everything, such as objects and classes, that we have learned though this course except recursion helps us understand  the Object_Oriented Programming well, which is short for 'OOP'. OOP is the way of programming in order to design the application more focusing on using objects rather than logic. In Object_Oriented Programming, we don't care much about how the logic goes between input and output, what we mainly care about is the objects that were mentioned in this application.
I remembered that at the beginning of this course, we were learned abstract data types (ADTs) in python including classes, attributes, methods, etc. According to the course notes,  "an ADT speci es the intended meaning of the data it stores, and the operations it provides on that data". The stack is an typical example explaining what we basically do with ADTs  with some general features of ADTs. A stack, obviously is the object and pop, push and is_empty are methods used to manipulate the stack. Also in our first assignment, we use OOP concepts  to make a game with five classes. Our first step is always to find out objects and operations needed by this object.
Inheritance is also a concept which is important and beneficial to understand OOP. Sometimes, we only have general features which does not satisfy some specific requirements. Employee, as an example that was taught in class, is the general object ( parent class). However, we have different kinds of employees under that parent class like hourly employee and salaried employee, which are named child classes used to implement the parent class. As a result, hourly employee and salaried employee share the same features as employee but have their own attributes on the other hand. This method is so helpful so that we don't need to overwrite the same code under a class.
In a conclusion, understanding Object_Oriented Programming concepts is pretty important to us because it is the basic stuff we need to know in order to make a further move into computer science. After I summarize the OOP concepts by looking over the whole thing from the course notes, I feel like this part of knowledge is much clearer to me. If we have something not familiar with, reading course notes over and over again might be a good way to get through.

Sunday, 8 February 2015

impressions of tracing recursion

Tracing recursion is my favourite part in this course so far. It is pretty interesting and for me, it is kind of easy to trace the output through looking at the code that is given. Everytime I see the code, thinking that how magical it is that the function itself goes into its own body code. I've seen the slog from http://sl0gforcsc148.blogspot.ca/, and there is a conversation which I totally agree with that goes like this:
       Student: "How do I learn recursion?"
       Teacher: "You have to know recursion to understand recursion..."
In order to understand how the body of function works, you have to understand what the whole function does. And then , useing a smart way with only a few lines to illustrate something which goes to unknown even to infinity

Although I love the way tracing recursion does, there is still one thing I'm worried about. I have no idea how to start if I'm asked to write a recursion by myself. We did the lab exercise in week 4 and there was a part asking us to write a code of recursion which confused me a lot. I know it won't be long to ask us write the recursion code by ourselves, so I still need more practice on that in order to fully understand the recursion part.

Sunday, 1 February 2015

Impression of first few weeks...

It has been four weeks since winter semester started. I was quite busy and tired during past few weeks even though a series of tests haven't come yet. It is much busier than last semester partly because I take six courses in total this semester, but mostly because the courses that I take are more difficult, especially CSC148. Every week there is only two hours' lecture plus two hours' lab for CSC148 but it covers more staff than CSC108. Besides, it is quite different than what I used to think.
When I first came to the lab, I got frustrated a lot. What I used to is basically implementing a class that has been given or understanding the code written by others. To tell the truth, I have totally no idea what should I do to design a class by my own through looking at the instruction even though I was learnt ways and several examples during lectures. It was the first time I realized that I supposed to work harder on that.
Thankfully, I get familiar with the course materials through reviewing the lecture slides and even Rampup slides. But I'm still worried about the oncoming test. Hopefully, I could survive after the test.

Sunday, 25 January 2015

Why geeks need to know how to write

I started to write slogs for the course CSC165 last semester totally because they counted for marks. And to tell the truth, I've never had such a habit writing slogs every week recording what have been done and what am I worried about. So when I first heard that we need to write something every week, it was really a bad news to me. However, after 12 slogs have been done, I have to say that keep writing slogs is kind of beneficial to me, not only in the way of writing skills but also in the way of  understanding the course material itself. And I think it is also one of the reasons why geeks need to know how to write.
 Not only in computer science, but also in other fields of study, geeks need to record what they have done so far so that they can move on to the next part based on those things they just got. What's more, we don't have such a strong brain to memorize all of the stuff we've learned and mistakes we've made. Therefore, it actually a good idea to write down those things as "With the log you’re building a record, a stream of evidence about the bug." and "But in light of fresh evidence, it becomes the key that unlocks the problem and points to a fix. "--Adventures in Debugging-Keeping a Log.
For the course CSC148, we again need to write slogs. But this time would be a little bit different to me because it is not only for marks but also for improving.










 ----

Monday, 1 December 2014

Week #12

This is the last week before the class ends and it will be my last slog which is needed to hand in. What we learnt this week is about countability and computability and most interestingly, induction, which is another method used in proof. Since I've already learnt about induction at the beginning of MAT137 and we did a lots of practice at that time. It much easier for me and much clearer to me when I listened to it as the second time. In my opinion, induction is quite useful to solve questions with variable n, which is uncountable as long as this method is actually in your head. 
Although the term test result really frustrated me these days, there is a good news happens to me, which is I got a full mark on my second assignment, which surprised me a lot. I can't even imagine that I can get any full mark in university because courses in university seem much more difficult than high school. But I did it!  I suddenly feel like maybe I can do better than I used to do by changing my mind of these courses. And it actually encourages me to prepare well on final exam.
I see many amazing slogs on the course website especially slogs from http://www.reddit.com/r/journeythrough165/. I think keep writing slogs every week is a good habit because it can actually record your mental journey through this semester.

Here is a proof using induction :