Wednesday, March 4, 2015

Object-Oriented Programming

As a 'transitioner' from csc108,  Object-Oriented Programming  seems really tedious and unnecessary to me at first. For the Subtract Square game in assignment one, I could totally make the game by just using a bunch of for loops, ifs and user inputs, without touching classes at all. And introducing classes makes the game structure much more complicated, thus much more bugs and errors to fix. 

It was not until assignment 2 that I started to realize the merit of OOP: with a clear and well-defined data structure, it actually prevents bugs and errors. Since as the game gets more complicated,  it's really easy to get lost if the gaming process are not well recorded. All those classes coded by the Professors, such as Game State and Game view provide us with the means to keep track of the entire game and AI's move. 


OOP is like designing the right tools before diving into the problem directly, it might seem a bit of wasting time at the beginning, nevertheless it will definitely offer long term benefits when things get harder. ''Well begun is half done'' Sometimes choosing the right way is more important than starting to deal with the problem right way. 

No comments:

Post a Comment