This week, we get
our feedback of Assignment 1 and Term Test 1.
Before we learned
recursion, we focused on object – oriented programming, and assignment 1 was
all about it. To be honest, I am a little bit proud of myself. We learned how
to develop a class in CSC108, but we didn't have a chance to write our own
classes. After finishing assignment 1, I get the whole idea of object –
oriented programming. When programming, you must have a whole picture of what
you want. Take Assignment 1 for example, you want a program from which you can
choose many different games to play. First, you need generic class for both
GameState and GameStrategy and a GameView class for people to play with. Then, develop
subclasses piece by piece according to those generic classes until you meet all
requirements. I think the key concept is: don’t start form details but start
from structure.
Still, I
encountered a lot of problems when doing Assignment 1. I didn't know what to
put in the parent classes. Details were undecided so I couldn't write any code
including details. Everything must be generic. And I thought the parent classes
are useless because they were so generic and simple that I still need to write
many specific code in the subclasses. But then I understood, writing parent
classes would make it easier to write subclasses because you don’t need to
repeat code you already wrote if the subclass requires a method which does the
same thing that the method in parent class does. And you will know what you
need to implement clearly because you already built the structure when you
wrote the parent classes.
Hello Lisa,
回复删除Assignment 1 was challenging, but you are right structure is really important. Parent classes as you pointed out help you decide which methods to include in your children classes. Basically, every method that is in your parent class should be included in your children class.
In terms of generality, I would say that looking at what different games have in common is key to decide what a general feature could be.
All the best,
Christian