Sunday, 1 February 2015

Week #4

About working in pairs and the assignment:


In the 4th week, we finally handed in our assignment 1. It's a big jump to compare with CSC108. In CSC108, all the docstrings of required functions were given and we just needed to implement the bodies and add some helper functions. However, in CSC148, we need to decide which methods we need and combine them, which was kind of hard, but also, what makes computer science course more interesting. Designing a program by ourselves is much fun! I can't help asking my friends to try the Subtract Square Game out!

I have to tell that it's such a good idea to work in pairs! First of all, my partner did programming for a year before and he's very good at writing code. The problems that were difficult for me seemed like a piece of cake for him. I learn a lot from him. For example, I had no idea of how to swift between two players, but he told me that we can change the player's turn by keeping track of odd and even numbers, which I believe is very useful and will be used in the future. He is also very patient and careful. Before working with him, every time when I worked on a program for about 3 hours, I had a rest, especially when I could't find the bugs and then felt upset. But he didn't stop until he tackle a problem. That made feel ashamed and I'm trying to do the same thing with him. Secondly, discussing during working together enhances our ability to communicate as well as helping with sparking good ideas. After discussing, we had a better understanding of the handout and found better ways to write the code. I really enjoy working with my partner and appreciate for it.

During the assignment, we found that we were not very comfortable with the special methods __str__, __repr__ and __eq__. Following are some notes (posted by the instructor on piazza):

These methods are most often used by the developer for debugging.  It is often helpful, as a sanity check, to test whether two objects are equivalent (or not).  If the result of that check is surprising, you'll often want to see the output of __str__ to confirm what __eq__ says.  Sometimes the output of __repr__ is useful to allow the developer to cut-and-paste into a Python interpreter in order to "poke at" an instance of a class.
This assignment involves a text-based game interface, so a well-written __str__ may help you implement this.
Finally, we instructors think that these methods are an important part of good code development.  So we require you to do them.

No comments:

Post a Comment