Sunday, 9 February 2014

SLOG #3

Week 5: More Recursions 

In this week's lecture, we dealt with more recursions, tracing recursive functions in particular and recursion relating to the assignment. We also dealt with namespace, making variables global, local or nonlocal, this concept isn't as new to me because I've been somewhat introduced to it in high school although in Java so it's a bit different in implementation but I understood the concept. 

I feel like the labs really help a lot in terms of solidifying the concepts learned in class. It somewhat forces you to understand everything in order to complete the lab. The first half of the lab went smoothly, it was mainly tracing recursive functions which I found easy enough with simple functions like the ones presented in the lab. But the second half was the hard part, it was implementing your own recursive methods for the presented problems.

Sunday, 2 February 2014

SLOG #2

Week 4: Recursions 

For this week's lecture, we mainly dealt with recursions, functional programming and unit testing . I found making nameless functions with lambda very efficient as it saves name for other functions if you're only using that nameless function once and it can also be done in one line which I found pretty neat, like the one line structure for making a list from the previous weeks. We also dealt with some unit testing which I found pretty easy as we've done it in this week's lab and a little in CSC108 last semester so that wasn't very hard to understand.

Now the hard part was the recursion, we were presented with more complex recursion examples in class such as the Sierpinski Triangle. This wasn't very easy to understand at first glance, so what I did was understand and trace the recursion example codes posted online and played with them for a bit. I would also try to make my own simple recursive programs in the next few days to solidify my understanding and maybe trace more recursive programs!

On this week's lab we were mainly working with inheritance and unit testing. The lab went pretty smooth, we finished most of the tasks except fixing the code to make it more efficient (reducing the redundant lines) as we ran out of time. Although I did finish it at home and found it to be very simple as you simply need to call the __init__ method from the parent class. Implementing the unittest wasn't very difficult although it required a bit of research mainly for testing the exception.