This week is the last week for CSC148 and we basically just review some materials that we've learned in the past. The professor also mention some interesting mechanic in Python: for example, when we try to create a nested list using the code "[[]] * 6", the created list will not behave what we wanted it to be; instead, all the empty list in the master list will be the same object and thus any attempt to populate the list will result some unexpected result. I also discovered this another time while I was doing assignment 2 because the usual method for copying a list (i.e. list.copy()) does not really work with a nested list, so an alternate method must be use.
Overall, this semester with CSC148 has been really rewarding and I am ready for more CSC courses in the following year.
Friday, April 8, 2016
Wednesday, March 30, 2016
Week #11 Entry
For this week’s entry, I decided to revisit my first week’s SLOG and some of my views have been changed while some remained the same.
In my first SLOG, I started off by talking about how I adore Object Oriented Programming and to this day, I still appreciate its simplicity and how useful it is when it comes to developing programs that actually exists in real world situation. For example, in assignment one we develop a program that simulate taxis. What I learn from that assignment is the utilization of abstract class and I think it really helps me explore new ideas for developing an application from scratch. Another point of view that I have not changed from the beginning of the semester is how I dislike Python. In the first SLOG, I only mentioned I disliked the private attributes in Python because they are not really protected. Now I dislike Python even more because of its loose syntax. For beginners, a loose syntax rule might be useful in some scenario but for us who have the experience in programming, this will more likely to cause trouble. For example, we cannot restrict the type of parameter passed into a function/method; so what often happen is I receive an error message in a line but the actual root of the problem is in another line where the wrong type of parameter somehow pass the code. In other programming language like Java, this type of error can be easily prevented as soon as the compiler detects the type contract has been violated so it’s easier to debug.
My view on recursion has changed throughout the semester if I look back at my first week’s SLOG. In week one, even though I had some background knowledge about recursion but I held no confidence in my ability to write one. However, after the intensive training along with professor’s amazing lecture, I am now confident about writing recursion; in fact, I think writing recursion is really efficient and fun to code.
As a conclusion, this course has been a really rewarding and fun experience to me, I am now looking toward to learn more about computer science in the following CSC courses.
Tuesday, March 29, 2016
Week #10
In week 10 we started talking about recursion efficiency, which is what I've always been waiting for since the beginning of the semester. I would really like to know what techniques or strategies we can use to decrease the run-time of our programs. The professor use the famous example of Fibonacci numbers to show us how we can massively reduce the run-time by memorized data that we have seen. However, when we increase the input to some really large number, the recursion still dies and seems to take forever to calculate. I was a little bit disappointed to some extend because the professor didn't talk about what are other techniques that we can use to further improve the program; however, it might just be the case that there isn't anything we can do about it and for a simple program like the Fibonacci number, we cannot improve it any further.
Another topic that I found interesting this week is the quick sort algorithm. I've only seen how it works on some diagram but never understand how it truly works. In addition, I now understand why computer scientists say quick sort is best with random order list because if we have a sorted list, then using quick sort is simply not very efficient since all the elements will be group to one side.
Another topic that I found interesting this week is the quick sort algorithm. I've only seen how it works on some diagram but never understand how it truly works. In addition, I now understand why computer scientists say quick sort is best with random order list because if we have a sorted list, then using quick sort is simply not very efficient since all the elements will be group to one side.
Week #9
During week 9 we've talk about mutating a tree, that is, insert and delete a node from a tree. On a first sight I knew delete will be much more complicated than insert because if we have a very large and complicated tree, then deleting a node will mean that we need to consider many cases or ifs. The algorithm given by the professor proved my thought. However, I did find that writing out algorithm for a complicated method/function does help much than just thinking about it in the head. Maybe in the future when I encounter such task I can try first write down the algorithm instead of immediately start coding.
Week #8 Entry
This week we talked about traversal and binary search tree. To me these two concepts are relatively new.
For me perhaps the hardest part for traversal is the level-order visit. This concept is extremely easy to understand, however it is somewhat difficult to implement when I first try to do it during lab. Later on in the lecture the professor offers two ways to implement level-order visit, I personally prefer the iterative deepening not only because this method is easier for me to understand but its name also sounds cool.
On the other hand, binary search tree isn't much of a surprise for me since I have already encountered something similar before, i.e. the binary search. These two concepts are essentially the same; both require a sorted list/tree and we abandon half of the data by only checking one value.
For me perhaps the hardest part for traversal is the level-order visit. This concept is extremely easy to understand, however it is somewhat difficult to implement when I first try to do it during lab. Later on in the lecture the professor offers two ways to implement level-order visit, I personally prefer the iterative deepening not only because this method is easier for me to understand but its name also sounds cool.
On the other hand, binary search tree isn't much of a surprise for me since I have already encountered something similar before, i.e. the binary search. These two concepts are essentially the same; both require a sorted list/tree and we abandon half of the data by only checking one value.
Wednesday, March 2, 2016
Week 7 Entry
For the past few weeks we have talked about recursion, a topic that I am familiar with in high school. However, it is still a fun and rewarding experience to extend my knowledge about recursion in CSC148.
There are several ways recursion is used or analyzed differently in lecture from how I learned it before, but perhaps the most obvious one is tracing recursion. In high school, we don’t tend to have a structured method to trace recursion, rather we often carry the parameter along as we trace the code solely in our mind. For example, suppose we have a recursion that finds the maximum value in a list with depth greater than one, then how I would trace recursion in the old way is to actually take the list in the parameter and goes through the code one by one in my mind without writing down anything until I reach the base case. The downside of this method is I often find myself stuck in a logical loop with complex recursions and unable to keep track of all the small pieces of the parameter as it is being breakdown by recursive calls. Now with the new method taught in lectures, tracing recursion has become easier for me to do.
Another interesting topic about recursion that we have discussed in class is recursive graphics. I am always fascinated by recursive images because they are complex on the visual, but the actual code that produces these images are often easy to understand, at least for the recursive images I have encountered so far. If possible, it will be really interesting to see more lectures about recursive graphics in the remaining time of this course so I can learn more about how to produce complicated yet beautiful recursive images.
Thursday, February 25, 2016
Week #6 Entry
This week we finally start recursion; I'm very excited because this is what I have been waiting for since the beginning of this semester. I notice that the way how the professor trace recursion is a bit different from what I learn in high school: it's more organized and simplified. To me, it is a efficient way since sometimes can get complicated and extremely difficult to trace without organization.
Also we saw an example with recursive images. In high school we also did something similar (e.g. snowflakes) which was a fun experience. Recursive images are so easy and interesting to produce is because what we need to do is only write code for one "branch" and the rest of the "branch" will self-complete, reducing large amount of time of me scratching my head and figuring out the angles between each "branch".
In general, this week is rewarding to me and I am looking forward to learn more about recursion.
Also we saw an example with recursive images. In high school we also did something similar (e.g. snowflakes) which was a fun experience. Recursive images are so easy and interesting to produce is because what we need to do is only write code for one "branch" and the rest of the "branch" will self-complete, reducing large amount of time of me scratching my head and figuring out the angles between each "branch".
In general, this week is rewarding to me and I am looking forward to learn more about recursion.
Sunday, February 14, 2016
Week 5 Entry
This week we learned more about the application of linked list.
Last week I convinced my self that linked list is more efficient than normal list, but to be honest I was not 100% sure about how efficient it can be. But in Friday's lecture, the professor showed us the actual run time using the built-in list and linked list and it's incredible to see how much faster the program become; from some exponential run-time(perhaps) drop down to linear run-time, and I can already how can I use it. For example, I wrote a program once that simulates particle effects, and as I add more particles, the frame rate drops rapidly. Now I know about linked list, maybe I can try it on that particle simulator sometimes and I'm sure it will run much faster.
Last week I convinced my self that linked list is more efficient than normal list, but to be honest I was not 100% sure about how efficient it can be. But in Friday's lecture, the professor showed us the actual run time using the built-in list and linked list and it's incredible to see how much faster the program become; from some exponential run-time(perhaps) drop down to linear run-time, and I can already how can I use it. For example, I wrote a program once that simulates particle effects, and as I add more particles, the frame rate drops rapidly. Now I know about linked list, maybe I can try it on that particle simulator sometimes and I'm sure it will run much faster.
Thursday, February 4, 2016
Week 4 Entry
Last week we talked about a new abstract
data type that I have not studied before in high school – the stack data type.
At first I was confused about why do we use something like stack when we have
list. Aren’t lists more convenient to use? For example, the list class already
contained many useful functions – indexing, finding value etc. But as the
lecture went on I realized in some cases, list is actually a “overkill”, and
those useful functions just became a heavy load in the memory. By using stack,
we can effectively reduce memory usage thus increase the efficiency of the
program. In general, this is probably the most interesting concept I have heard
so far.
Sunday, January 24, 2016
First Two Weeks In CSC148
Before taking CSC148, I have heard from my CSC108 professor that 148 is all about object oriented programming. In my three and half years of programming experience, object oriented programming (OOP) is something that I always adore because of how it makes programming so much easier. As we learn in the first two weeks of lecture, OOP is basically about writing a class and using the instances of class as part of the program. This reminds me of my experience when I first encounter OOP. In grade 11, my computer science teacher asked us to design a game as the final project for the course. I was struggling for a brief amount of time because I had difficulties come up with a way to handle multiple pieces of data that have the same attributes. And when my teacher introduce my OOP, I was astounded since it not only made my code much cleaner but also it was way more efficient. Thus, I am really excited to learn more about the techniques and algorithms that can be use with OOP in CSC148. So far what we learn in the course is basically what I already know about OOP, especially inheritance. The reason why I am so interested in inheritance is because it eliminates abundance of repetitive code, and in the lecture, this is also what the professor suggests. One small problem I have with one of the topics we discussed during lecture is the data encapsulation in Python. Since the major language I use is Java, I don't really like the way Python handles private variables. For me, the variable is not actually protected in Python because we can still access it directly even after we set the property of the attribute. In addition, I am confused about how to make an attribute private in python at the beginning but after reading the course note I understand does the function property() works now. Finally, my goal in this course is to get more familiar with recursion. In high school, my teacher only introduce recursion in a shallow depth, and I am not very good in writing recursion so I am hoping to see what I can learn about recursion in CSC148.
Subscribe to:
Posts (Atom)