Sunday, 22 February 2015

Week7: Reading week! And a time to consider about assignment 1.

    This week is reading week so there is no lecture. But during this week, the result of assignment came out.

    The result is not so bad, but there are some mistakes I should reflect on,

    The strength of my assignment is that I can write the game well, getting 100% in the game itself. Also, the gameview is clear and it scored a full mark as well.

   However,  I made lots of mistakes on the details.

    First, my style is just passable, which means my docstr is not good. I think the way to solve this problem is to write the docstr when I am writing the function. Never complete the docstr after completing all the program. Docstr is not a grammar requirement, instead, it is something that helps us to write the function. So I should write docstr while I am writing the function.

    Second, the special method is also just passable, which means that I didn't understand all the special method very well. And that is a problem I cannot solve just by myself. So I think I should ask for TA for help after the reading week.

    Third, the strategy is not so good. I know my strategy can run, but maybe there is not good for implementing new strategies. The may affect my performance in the assignment 2 if I don't know what wrong is going on. So I should ask for TA before I start assingment 2. Also, I believe someone else must also make mistakes like this, so maybe I can refer to piazza.

    In conclusion, writing program itself is not a real problem for me now. However, how to write program like a computer scientist, how to write it in a wise way are real problems for me!

Thursday, 19 February 2015

Week 6: Recursion in a tree

  This week we did more exercise on recursion. We used a tree model to understand recursion. And during this week I learned some new methods to deal with recursion problems.
 
     First, just like using a tree, we need to draw a picture to help us understand recursion, otherwise it will be too abstract for us to understand.
   
    Second, during solving the tree problems, I found that the easiest way to write a recursion function is: first, find the basic case. Then, go further, try a one-time recursion. Last, check whether this will work for more complicated data. This process simplifies writing a recursion function, thus making it easy for me to write it.

    But I also encountered some problems. Sometimes I even cannot figure the base case. For example, sometimes some problems seemed to ask us to  trace back from children tree to parent tree, but the base case cannot be when it comes to parent tree! So this case may bother me. I've handled a problem like this, but still really confused about it. I think a good way to overcome it is to practice more. Thus, I'm trying to find more exercise form lab to do.

    Another problem is not about programming itself, it's about my learning style, I found that my answer for midterm was OK, but it was not so reasonable. Writing a function which can run is not a hard thing for me but thinking like a computer scientist is really a tough thing for me. I am so worried about that and am afraid this may make me lose lots of mark on the coming test. I think the best way to overcome the problem is to ask others more. Working out a function is far more from success, I should communicate more with others to find the most reasonable way to write a function.
   

Sunday, 8 February 2015

Week5: Test1 and practice on ADT

    During this week, the first test of CSC148 took place and it turned out that it mainly covered the design of creating classes.Also, on this week's lab, we started to use ADC like Stack and Queue.

    Taking test is always a good way to find students' own weakness. And during this test, I find there is no big problem for me to implement an existing class but I am really not good at designing a new class to solve problems. For example, the question 1 really bothered me and it really took myself to work out it. From this test, I get to know I  should really do more exercise on designing class, my weakness is not about programming itself but about how to transfer a task faced by human to a model that the computer can solve.

   And during the lab, I started to work on ADT, Queue and Stack. I've learned some concepts about ADT in the lecture but found it difficult to use an ADT, and couldn't understand why we should use ADT.

    During using it, I found the key to use an ADT is to use its own method more. For example, as for Stack, we don't know how the elements are stored, in a list, or in a tuple? But it doesn't matter at all, we just use pop and push to delete or add elements.
 
    And why should we use ADT? It just is like in our daily, we don't always use row material to produce products. We sometimes use semi-finished products to produce. And the ADT is just like a semi-finished product, we don't need to write the ADT by ourselves, but we use some ADT to make something more complicated and useful. The skill to use ADT is extremely important for a programmer, in my opinion. Otherwise, we have to always use the most basic  method and function to work out everything, that would be really annoying when we deal with complicated problems.

Sunday, 1 February 2015

Week4: A totally new method to write function:recursion and a week for assignment1

This week is nearly a week for CSC148 as the main topic for the whole week is to work out the assignment 1, and during this week we also learned a new method to write function: recursion.

The assignment 1 makes me have a better understanding of creating a new class. 

First, I began to understand why we should implement some special method. At the beginning, I can not understand why should we write something like __str__, __repr__ and __eq__, but during the assignment 1, I found myself easy to get confused when working on an object. An object is abstract, so we must write something to description it, like __str__ and __repr__, __eq__ also helps us to keep track of the object by differentiating different objects.

Second, I get to know how a game should be like. We create some objects to keep track of some data we need, and we should write a method for the class to help it transfer these data into some actions. In this way, we can make a game or something else.

We were also exposed to recursion this week. I had heard it from my friend before, and I thought it was a magic, I thought it was a special grammar for programming. But now I have some new understanding on it. Now I think it is not a real magic, it's just about using the programming language wisely, and now I think it is not so special, as it in fact doesn't contradict with what we learned before at all! I think a recursion is to repeat use the function over and over again and when it reaches its base case, it will work just as a non-recursion function. So tracing back is really a good way to understand recursion. It is just like the proof by induction in math, it is about using the base case to get to our destination.