Tuesday 12 November 2013

Trouble in the lab...

Last week's lab was a real struggle, 2 hours of 2 brains struggling together to think up a solution and nothing! We just hit roadblock after roadblock, it seemed we couldn't conceptualize or visualize the problem properly. Neither of our different styles of working yielded any results. My partner tried drawing it out and thinking it through before coding, and I tried getting something down on the computer to give me a starting point to work on, but neither method got us the solution we wanted.

Now, a week later, after working on and off for the better part of a day, I've finally got the method working the way it should. But I'm still not quite convinced I've found the best way to do it... The code seems too long and there seem to be too many cases that could perhaps be compressed to make the code shorter and simpler. :S

On the bright side, it feels good to solve a problem that was giving me trouble on the eve of our second test! Hopefully this is a good sign and everything goes well tomorrow.

Good luck to anyone reading this tonight!!! See you on the flip side :)

Saturday 26 October 2013

If at first you don't succeed... come back later?

I've found that with the exercises, especially the last few weeks where they've involved a lot of recursion, it's easy to get stuck on a problem and spend too much time with few results. The longer you think about a problem, your brain starts to go in circles coming up with the same fruitless ideas again and again .... and the longer this goes on the more disheartened you become about ever solving the problem.

The best way I've found to battle this issue is to get up and walk away for a while, a few minutes, hours or maybe even overnight, and approach it with a fresh mind later. I've found the recursion problems are the ones that I usually get stuck on, as I'm still not used to the way of thinking about recursive problems (i.e. how a computer will solve it, how a base case will be dealt with, how each higher case will be dealt with). It seems at times it still takes me some quality brain work (both conscious and unconscious) before I can figure out how to program recursively.

On the other hand, happily, it took me almost no time at all to come up with an implementation for this week's exercise! I've gotten a good grasp on binary trees and this week's lab really helped with figuring out nodes and how to deal with binary trees in terms of nodes.

Cheers 'til next time

Saturday 19 October 2013

OOP + Recursion

Having taken a programming course before in high school, this wasn't my first exposure to OOP (object oriented programming). I've never learned another style of programming, so I can't imagine why there would be another way that could work better. OOP makes a lot of sense in connecting the way we program with what we're familiar with in the real world. You have an object, which has attributes and can behave in certain ways. I believe anytime we can connect something abstract (such as programming) with something concrete (things we can interact with in the real world), it makes a lot of sense to do so. It increases understanding as our brain always wants to connect something new to something it already knows. Not to mention all of the organization that OOP brings to the table. Software development almost always requires a group of programmers, which means your code will need to be interpreted by others and you will have to interpret the code of others. If you know code has been written object oriented, then you know where to look for what, and you have a better idea of where to search for errors when they come up. I'm sure OOP has many more benefits that I'm not even aware of yet, but what I've mentioned is compelling enough for me to enjoy using OOP.

Recursion, however, was a different story... I'd never learned recursion before and definitely struggled for the better part of the month to figure it out. I can't say I'm an expert yet, but I have come far from my first week of class. Even before recursion, I had never heard of list comprehensions before. Now, I can't even fathom writing out a 3 line for loop when it could be done so simply! Recursion is even more amazing. I still look at my recursive methods in wonder, as they complete so much with so little code!

Recursion is difficult because I was so used to iteration, I tried to understand recursion by imagining the program iterating in some way, which just led to much confusion and misinterpretation... Another problem is getting bogged down by trying to track down exactly what the program will return each time. The 'black box' way of looking at things really helped out here. Think of the base case, and when you write out the recursive method, imagine that the rest has already been solved. It's as easy as that! Well... almost. But my struggles with recursion are definitely diminishing, and it feels great to have another weapon up my sleeve for tackling future problems, whether they be of the programming type or any other.

First Post!!!

So, I've been pretty bad about starting up my SLOG, but I'm sure now that I've started it'll be smooth sailing! It seems a pretty cool idea from Danny's side to get us to keep blogs, and I'm excited as I've never had a blog, or even a diary, before.

This course is unlike any other I've taken at UofT before (I'm a second year student). I've never come across a professor more invested in every student's success than Danny. His techniques and teaching styles always emphasize understanding WHAT you want to do and HOW you could do it before doing anything. If you can't implement your code, at least you have a conceptual idea. Clearly, there is just some small step inbetween where you're confused or struggling, and once that's cleared up you'll be well on your way to mastering whatever concept is being taught. But blindly coding until you get results doesn't teach anything, and next time you get a slightly different problem you'll be clueless.

It seems strange for a student to get marks even when they haven't gotten the final result, but you're in the class to learn not just to get a grade, and in the long run you'll be stumped by bigger, more difficult problems if you haven't learned how to properly approach a small problem.