Tuesday, February 17, 2015

Object-Oriented Programming

This week's prompt is a bit tough to me, since I don't know much about programming languages. Actually, python is the only programming language that I am familiar with, therefore I could not tell the differences between python and other programming languages that are not object-oriented. Nevertheless, based on materials from CSC108 and CSC148, I could still try to summarize concepts that I learned by using python.

One significant characteristic of object-oriented programming is that, as its self-explanatory name show, it let object serve as the basic unit of program. Attributes and methods are restored in objects. Therefore, each object is able to accept and process data. In the lectures of CSC148, I learned about class and subclass. They are the blueprints of objects. Class and Subclass give objects basic attributes and define objects abstractly. In lectures and labs, we have created a number of classes and subclasses, each of them builds different objects to fulfill its assigned functional responsibility.

Moreover, objects can interplay mutually. In the lecture of week 6, Professor Heap implemented a data structure, called tree, using class. He demonstrated how each tree could have other trees as its children. It suggests that objects can interact with each other in different ways. They are not necessarily at the same level. This concept really attracts my interest, and I would love to learn more about how objects are connected with each other.

Object-oriented programming is a rather big topic, and there must be concepts that I am not aware of. I hope next lectures could further expand and deepen my understanding of OOP.




Sunday, February 8, 2015

Tracing Recursion

In the lecture of week 4, we learned the concept of recursion, and how to trace a recursion function. In computer science, recursion is the method of using a function in the definition of the function itself. It is different from typical thinking pattern of human beings. For example, to count non-list elements of a list containing sub-lists, computers would have to work from a list to its sub-lists to sub-lists of sub-lists and so on, while human would count whenever we see a non-list element, no matter which layer of sub-list this element is in.

Tracing recursion functions helps us to understand how they behave. Professor Heap demonstrated how to trace a recursion function line by line. We should try to think as computers when tracing recursion functions, from one step to the next, even though we have the ability of jumping to the conclusion. At first, I was not used to it, and I had to force myself to follow the lines. However, after practicing, I figured out the trick. Instead of looking at the whole jigsaw at once, I should start with the first piece of puzzle and move forward, following orders from recursion functions. With this idea in mind, the whole process was no longer confusing.

After I mastered the skill of tracing recursion functions, the logic behind these functions became clearer. In lab #3, we were asked to write a single function using recursion, and it didn’t take me much time. I am looking forward to writing more recursion functions.



Sunday, February 1, 2015

First Impressions

During the first weeks, I finished my first assignment. It was about creating a simple game using python. At the first glance it was overwhelming, and I honestly thought about whether I should drop this course to escape from it. It was different from those assignments I used to deal with in CSC108; in the good old days, the instructor would give specific details and instructions about every single function, and all I had to do is only to follow these instructions. In this assignment from CSC148, the instructor only provided general and abstract guideline, and I had to come up with my own design of the functions.

At first, I literally had no clue where to start this assignment. I just forced myself to write something. Once I got involved, a vague imagine of next steps started to form in my brain; and I followed it. It was a messy style of working, and I paid my price for it - I had to edit my whole file after I finished it. Nevertheless, my game did work successfully, allowing my friends to play without any error.

Looking back, I would say this assignment was a good challenge for me to start programming on my own. After all, I can't rely on the instructor and TAs for my life; someday I would have to work independently. There is still a long way till I could finally master programming, but I have the confidence to walk through.