Friday, October 18, 2013
Anne Hoy Why
Quick post here. So, while I was coding this week's exercise I figured out how I could have made my cheese moving program work (at least I think I did). This is somewhat disappointing seeing as I can no longer use this information for that project. Well, I guess I could, but it be worth nothing other than my own satisfaction at having solved the problem, which, with my rather limited time due to life is unfortunately not enough motivation to get me to go back and bang my head against that wall again. Anyway, I've gotta go study for my Calculus midterm tomorrow (I am seriously thinking of finding myself a TARDIS and going back in time to convince Rene Descartes against all that mathy stuff). Bye~
Tuesday, October 15, 2013
OOP and Recursion
So, I haven’t had a lot of time to update this blog lately,
mostly due to midterms and various assignments. Anyway, these entries are a
little late because of that sorry.
Object-oriented programming is probably one of the most intuitive
things ever. It’s literally the representation of a thing (whatever that thing
may be) in code. What defines it are it’s
parameters and its methods. The parameters are unique characteristics, like
colour, size and shape. Methods are the things the object can do, like bounce,
run and change colour. One important bit to not get confused is that the
difference between a class and an object. A class is the blueprint for an
object, an object is one unique variation of the class. Now, the reason I say
OOP is intuitive is that -for the most part- it’s how we as human beings tend
to organize the things we interact with. We categorise them by the things they
have and the things they can do, hence why OOP tends to be pretty easy to
understand.7
Recursion on the other hand is not quite as intuitive, at
least to me. When people explained recursion to me it made a general sort of
sense I could see. I mean why wouldn’t you break down a large problem into
smaller easier parts that you can solve the same way you did the bigger part,
right? Unfortunately, I discovered that I don’t quite solve problems that way,
or rather I don’t do it consciously. When I go to solve a recursive problem I
break it down through trial and error for the most part. Rarely do I sit down and actually think through the
solution enough that I would be able to fully understand it consciously, in all
of its nitty-gritty detail, which is kind of essential if you want to write a
recursive function. Now I’m not saying it’s not useful, of course it is, there’s
tons of problems that can be simplified through recursion and the such. Never
the less, I still don’t find it as useful and generally applicable as
Object-oriented programming.
As a side note, I found the list-comprehensions we learned
recently incredibly frustrating because seemed to make a difficult subject all
the more difficult for me. True, their incredibly easy to read, which is not
something you can say for a lot of code. However, they are also practically impossible
to debug once written. The one line of code you use to write the comprehension
leaves pretty much no room for internal debugging with which to see what’s
going right and what’s going wrong.
Anyway, that’s just my opinion at the moment and who knows
maybe by the end of the semester I’ll figure recursion and list-comprehensions
out and love them. Anyway, I gotta go now, bye~
Subscribe to:
Posts (Atom)