Recursion is Beautiful

Reading week is over and we’re back at it in classes now. I played an absolutely unhealthy amount of Dark Souls during my break, and of course did work as well! I also made my presence on the course discussion board again, which I haven’t done in a while. I missed my post last week as well, which I can’t make a good excuse for, but I’m aware of it!

I spent a bunch of time looking at Assignment 2 and understanding it. I actually thoroughly love using regular expressions. My first real foray into it was not very long ago, where I looked into the nuances and limitations of regular expressions for a website I was working on as a hobby. It’s really cool what a well-designed RegEx can identify for you.

After working on and finishing part 1 of the assignment, then talking to Dan about it and refining my code (it’s pretty damn sexy code now, if I do say so myself), I took a break. This was primarily due to the fact that part 2’s base is only to be released to us after part 1’s due-date was reached. Then I realized that I could just use placeholder names for classes until such time as I knew what they were!

So I started working on part 2 of A2. And man, has it helped me see how absolutely stunning recursion is. I was a bit worried earlier, because Dan had mentioned in class that he felt that the concept of recursion and utilizing it is like a gateway concept for most computer scientists/programmers. I was worried about the possibility of me not grasping this concept. But I’ve got to say, once the grasp is in place, it is, quite frankly, a whole new world. *Cue Aladdin music*

No but really. Really.. Recursion makes writing these seemingly complex functions so simple at times. Remembering back to when I first looked at the details for A2 Part 2, I thought to myself, “Oh boy. That’s going to be interesting to code,” as I looked at the function list. But when I am actually sitting down and working on said functions, I think and realize how useful recursive calls are. How simple they are, and then all of a sudden, I know what to do. And I write the code, and… “Wow.” It was that simple? It boggles the mind.

And there’s this kind of unspoken joy I experience when I comment a section of code. I format the comment, even. I also love – absolutely LOVE getting a bunch of things done in few lines of code. Of course I’m also very much for readability, but minimizing lines of code is one heck of a thing I’m into as well. Recursion just makes me so happy.

Damn.

‘Til next time!

Advertisements