Monday, 14 October 2013

Object-Oriented Programming and Recursion

Topic 1: On Object-Oriented Programming.
CSC148H1 is my first introduction to the whole superclass/subclass concept, and I believe I’m taking to it well enough, going by the exercises (although I’m aware that the exercises are significantly easier than, say, the midterms). As mentioned in the previous entry, my partner and I had procrastinated on the assignment; thus, we weren’t able to finish the Controller class. I know it wasn’t mandatory, but I had been working on it on the Tuesday night, and I think I had almost had it. If we’d started earlier, I’m certain we could’ve finished Controller. If I had had the chance to tinker with Controller some more, I think I would’ve handled SolvingController differently, as well. For example, someone on Piazza mentioned that the select function could be called by ManualController and SolvingController, but the way we had set it up didn’t allow for that; the cheese would move immediately from one side to the other without showing the animation. Perhaps I could’ve tried scrapping the original select function; I remember thinking that I should find a way to rewrite it so that it’d show the animation when it was called by a helper function within the SolvingController class. Maybe my problem was that the superclass I was creating relied too heavily on ManualController? I think I’ll revisit this part of the assignment closer to the end of term and see how I’ll tackle it then.

Topic #2: On Recursion.
CSC148H1 is also my first introduction to recursion, as well! Unless you count recursive sentences discussed in Linguistics (the program in which I plan to specialize). I can honestly say that I don’t think I am too comfortable with it yet. There are times when I think I’m picking it up, but the moment I second guess myself, I start getting confused. To counteract this, I’ve basically been poring over the functions shown in class, and googling for tips on understanding recursion. I liken it to learning how to create simple sentences in a new language and then being introduced to a bunch of different conjunctions; in theory, I know how to form complex phrases, but in practice, I default to structures that I am most familiar with (AKA: glory to the for loop). I’m thinking of maybe redoing the last assignment from CSC108 as I’ve been told that it would’ve been a lot easier with recursion. This… wouldn’t surprise me, at all; I remember the coding I did for it being ridiculously long and repetitive, and I think "translating" a project I'm familiar with to recursion will be beneficial. Good news is that, during the last lab session, I was actually making decent progress with the recursive exercises; I figured out the first one almost immediately (which may not seem like much, but I’ll take slow progress over no progress any day).

1 comment:

  1. Good reflection. Keep up the good work and the interesting posts!
    If you want more practice with recursion, you can take a look at: www.codingbat.com

    ReplyDelete