Sunday, 1 February 2015

class and subclass

We learned about the basics of class and subclass this few weeks. Although for some simple program, using class seems a bit redundant, but I find that using class makes the program very organized and as the program gets bigger and more complicated, I am sure that making classes and subclasses will help make things much more easy. The concept and methods of class in the first few weeks is not so difficult and pretty straight forward. 


However, the first assignment is a bit confusing. Unlike CSC108, the instructions and requirements of the assignment seems to be ambiguous at first. It seems that I can write anything as long as the game subtract square works. Later, I learned that the assignment requires us to write at least 5 classes. I am struggling with the function and distribution of methods in different classes. After I submit the assignment, I am still not sure what method should belong to which class. Especially for the game_view class, from my understanding, it should interact with the user,  controlling the output of the program and promoting the input of the user. But each game is unique, it will print different things and get different information from the user. I thought maybe creating a subclass for game_view might be a good idea.

No comments:

Post a Comment