I started this week's CSC148 by doing exercise 2. Compared to Exercise1, this exercise needs more thinking. Without some understanding of exception, I don't think I can do it. Actually, this exercise is a good opportunity to review and further think about exception. I struggled with what would happen if the input is a list. I think I have done both the old version and the updated version correctly. The old version is trickier, I spent a relatively long time to think of a solution for that.
Lectures were about recursion. I found that recursion is a strange thing to me: when I look at the code someone has already finished (like the examples from the lecture), I can understand them easily and analyze them correctly, however, when I try to write the code by myself, I struggled a lot. Probably, I need more practice on recursions. I like the "turtle" example, because, we can actually see what happens from the pictures.
During the lab, my partner and I reviewed testing modules. We spent quite a lot of time doing testing. But I think it is worthwhile because writing some test functions will save us a lot of time. We don't need to test every single case again and again.
Assignment 1 is coming, I am looking forward to it.
Friday, January 31, 2014
Saturday, January 25, 2014
Week 3: Object-Oriented Programming
From the first week till now, our main focus of this course is Object-Oriented Programming.
This week, we reviewed what we have learnt about "class", and then, we further studied subclass and superclass. The reason for us to derived a new class from a base class instead of creating a new class directly is that programmers have a preference for inheritance. By inheriting, we can avoid writing the same code more than once. For a method in the subclass which has the same name as it does in superclass, we can use the same method as base class, we can also override and alter it. The readings on inheritance are supplement for lectures and they really helped me to further understand the meaning of using inheritance.
We also learnt about Exception. This is the most confusing part for me. Prof Heap encouraged us to try the examples by ourselves in order to better understand the material. After lecture, I played with the exception example, I tried all the possibilities listed in the example. I think I get some sense of it, but I still cannot explicitly explain why each result happens. So I decided to go through the reading on Exception. The reading provides me with more examples, but I am still a little confused. I tried python help() on except, there is a very long and detailed explanation for exception and it is really helpful. We often use try & except together. When python find a matching of excepting clause (the match may come from its super case, this is the tricky point.), the code inside except will be evaluated, otherwise, python will continue to go to the next except clause till the end.
In conclusion, this week's material is interesting but a little challenging for me. I am going to start exercise 2 soon, hopefully I will finish it this weekend :)
Tuesday, January 21, 2014
Week 2: Exercise 1 is Coming
I started to do exercise 1.
The instruction is quite clear. When starting programming, I found I have actually forgot a lot of useful things. Luckily, there is another ramp-up session this weekend. So I signed it up. Hopefully, I can refresh my memory through that session. I got one question from the exercise, that is to use print function or just return statement. I asked through Piazza, some classmate answers quickly that I should use return otherwise auto testing will not recognize. That makes sense.
The auto testing seems not working for me. It didn't go through my submission although I submit pretty early. During the lecture, Professor mentioned many people have the same auto-testing problem as I did, and provide an email address for us. After contacting with TA, I got my test result. It was fine~
The lectures was about "stacks". "Stack" is an abstract data type(ADT). New item can only be pushed on to the top of the stack, and be popped from the top of the stack. Also, we learned about recursion. We can write a function which use itself inside its body. That's cool~
As for lab, I like the icebreaker. We "sorted" ourselves by cdf account alphabetically. The time is limited. My partner and I have some difficulties to think of a function that collects the distinct words from a file. We spent a lot of time to write some complicated loops. But it turns out that we can simply use the set() function. It will be a lot easier if we have done so.
I attended the ramp up session on Saturday. We go through some basic use of lists, files, dictionaries and loops. It really helped a lot.
The instruction is quite clear. When starting programming, I found I have actually forgot a lot of useful things. Luckily, there is another ramp-up session this weekend. So I signed it up. Hopefully, I can refresh my memory through that session. I got one question from the exercise, that is to use print function or just return statement. I asked through Piazza, some classmate answers quickly that I should use return otherwise auto testing will not recognize. That makes sense.
The auto testing seems not working for me. It didn't go through my submission although I submit pretty early. During the lecture, Professor mentioned many people have the same auto-testing problem as I did, and provide an email address for us. After contacting with TA, I got my test result. It was fine~
The lectures was about "stacks". "Stack" is an abstract data type(ADT). New item can only be pushed on to the top of the stack, and be popped from the top of the stack. Also, we learned about recursion. We can write a function which use itself inside its body. That's cool~
As for lab, I like the icebreaker. We "sorted" ourselves by cdf account alphabetically. The time is limited. My partner and I have some difficulties to think of a function that collects the distinct words from a file. We spent a lot of time to write some complicated loops. But it turns out that we can simply use the set() function. It will be a lot easier if we have done so.
I attended the ramp up session on Saturday. We go through some basic use of lists, files, dictionaries and loops. It really helped a lot.
Monday, January 20, 2014
Week 1: A New Start
It has been a relatively long time since I finished my CSC108 course.
I feel happy to continue my studying in programming. The course website is similar to CSC108's ----it is clean and clear. I can find the information I need easily. I like this style of website.
The first lecture is basically an introduction of the course. Professor Heap mentioned there would be a ramp-up session: the session will be 6-hour long. I was not sure whether I should attend. He also did a little bit reviewing on class at the end of the course. I felt less worried because although I forgot a lot things learnt in 108, I didn't forget all of them.
I had some difficulty following the second lecture because wing used the wrong version of python. It bothered me because what I typed in will not give me the same result as professor's. I felt a little upset because I cannot find the way to change the version right away. After the lecture, I spent some time to fix this problem. The useful information on the website under course soft ware helped me a lot. I reviewed the lecture notes and did the examples in class. Finally, I get an idea of what a "class" is. Inside a class, we can initial values, and we can write some functions. And the standard way to built a class is different from what we've learnt from 108, which is good because we need to learn new things.
I feel happy to continue my studying in programming. The course website is similar to CSC108's ----it is clean and clear. I can find the information I need easily. I like this style of website.
The first lecture is basically an introduction of the course. Professor Heap mentioned there would be a ramp-up session: the session will be 6-hour long. I was not sure whether I should attend. He also did a little bit reviewing on class at the end of the course. I felt less worried because although I forgot a lot things learnt in 108, I didn't forget all of them.
I had some difficulty following the second lecture because wing used the wrong version of python. It bothered me because what I typed in will not give me the same result as professor's. I felt a little upset because I cannot find the way to change the version right away. After the lecture, I spent some time to fix this problem. The useful information on the website under course soft ware helped me a lot. I reviewed the lecture notes and did the examples in class. Finally, I get an idea of what a "class" is. Inside a class, we can initial values, and we can write some functions. And the standard way to built a class is different from what we've learnt from 108, which is good because we need to learn new things.
Subscribe to:
Posts (Atom)