w1d3: Recursions and Blocks
Today, I got much more comfortable with the idea of blocks. I had not really understood it when I was doing the test first ruby and tried testing until the test just kind of worked. Now, I understand what exactly the block of code I will be passing is and when I will be calling it.
I also learned a whole new concept. Recursions. I think left to my own devices I would still use methods iteratively as it seems more intuitive. But there are some problems that recursions work better on. It’s a really cool concept I’m glad I got to learn about.
For instance do a binary search, recursive made much more sense intuitively. Or merge sort. Instead of an arbitrary variable i ticking away, it read better to keep calling the function until I met the break conditions I stated.
I also learned an invaluable lesson about programming in general. It’s essentially solving problems, and like any problems your success depends on how you slice it. My partner and I took a break from trying to make our brains imagine all the cases and parts. We took good ole pen and paper and wrote down how the merge sort process would unravel. It did wonders!
Pretty exhausted from the very limited amount of sleep I got. It’s only the middle of the week, but I’m very excited for the weekend where I can catch up on sleep and go over things that went over my head.