Saturday, February 28, 2015

Week 7

For the past few weeks, we have been focused on writing recursive code. We did several exercise sheets during lectures which I found was very helpful. Furthermore, we were required to write more recursive code during our past two labs. It was very good practice in getting a better understanding of how recursion works, and now I'm more comfortable with it than I was when the concept was first introduced. 

We were also introduced to another abstract data structure: Tree. What I found most especially interesting is not the Tree itself, bu the Binary Search Tree. With this type of data structure, we can easily locate data without having to go through the whole Tree! (This is assuming the BST is relatively balanced) Searching for data thus becomes very efficient since we can easily cut down our search space in half (left or right side of the node) as we find the value that we want.

I would like to be graded on my summary of of object-oriented programming which can be found in in my Week 4 and 6 posts. 

Thursday, February 12, 2015

Week 6: Summary of OOP Concepts

I've already written about some of my impressions on objected-oriented programming in my Week 4 post, so I guess I'll just expound on them some more here. Again, I cannot stress enough the importance and significance of using classes. It enables so much functionality, not just when writing code. Being able to extend attributes and methods of super classes to subclasses through inheritance is one of the great features of object-oriented programming. It provides this sort of structure to the code which can used for future code that is to be written. Not only that, object-oriented programming also allows for easier collaboration between people. Each person can work on a different part of the class separately, and eventually all of these code can be combined to become a working program. 

Thursday, February 5, 2015

Week 5: Tracing Recursion

We've finally been introduced to the concept of recursion last week! Looking at recursive code for the first time, I found it quite hard to comprehend. This is because even though I've seen functions call other helper functions before, I haven't seen a function call itself! And this is precisely what recursive functions do!

I found that tracing recursive functions on paper was extremely helpful in understanding how recursive functions work. Going through the activity sheet we were given in class showed me that having a function call itself doesn't seem completely ludicrous at all. It actually makes a lot of sense!  This activity also highlighted the importance of having a base case in order for the recursion to work. Furthermore, I noticed that recursive code itself is quite short. It's amazing how this short piece of code can be so powerful!

  

Monday, February 2, 2015

Week 4: First Week Impressions

I understand that CSC148 is a follow up to CSC108, which teaches basic programming. For the first weeks of class, it was clear that we students were being hammered on the importance of object-oriented programming. We spent a lot of lectures focusing on building and designing a class properly. For example, we were taught to choose the appropriate names for our attributes and methods. We also spent time on designing special methods such as __init__, __eq__, __str__ and __repr__ which I only found out about in this course. Learning about the built in function property() was also pretty amazing. It allowed get/set methods just like in Java or C#.

In talking about object-oriented programming, another neat feature we learned about is the concept of inheritance. Initially, I thought setting up classes with all its special methods was a a lot of work, and quite impractical. However, I guess all that work paid off when we created sub-classes which inherited the methods and attributes of the super-class.

Overall, this idea of classes and sub-classes all interacting with each other in a program is quite fascinating. I got to experience that first hand in completing Assignment 1. I hope to learn more in the weeks to come!