Sunday, 29 March 2015

SLOG 9: Revisiting SLOG 1:"Why Geeks should Write"

Hi All!!!
I am back with another exciting entry for CSC148. I have to say, these weeks seem to be going by super fast. It sure seems like we are on a fast forward mode. Regardless of that, lets take a moment to look back to the earlier weeks of the semester. In particular, let look at SLOG1: "Why Geeks (Computer Scientists) should write?"
First and foremost, I want to look at this SLOG particularly because the whole point of us being required to write slogs in my opinion is to see how helpful writing about a topic is. In my previous slog if you remember I mentioned that writing is helpful because since computer programming is a different language, translating material from that language into English/ non-computer programming language can lead to better understanding of the material. I have to say, this is actually True as writing SLOGS and summarizing the material learnt in class helped me to understand it 10 times more than it would have if I had just practice writing the codes. It not only helped me to understand the material but it also helped me to remember it. As I am a cognitive science major, a little connection has to be made (just like in my first slog): translating the programming material into English and English material into programming codes literally coded my neurons (brain cells) in such a way that certain material such as the __init__ method, class and subclasses, the special methods __eq__, __str__, and __repr__ became a default for me. When I was starting to learn these material it was hard to wrap my head around it and now it feels like its no big deal at all. So you can see, writing is helpful for the writer as it helps them to not only understand the material but also to make their codes more concise. I surely found myself writing more concise codes during labs and assignments once I wrote what needed to be coded in English first and then doing the translation.
I also mentioned that writing for 'Geeks' is crucial because it helps others understand what the codes are doing and what they are suppose to be doing. Some people who are new to programming, like myself, understand what each method does and how to implement it for a particular case but when it comes to reading the code have difficulty understanding what exactly is the code doing. Reading what computer scientists/Geeks have written in non-programming language helps us to understand what their code is doing and how we can actually relate it to our own scenarios.

I am sure you all will agree with me on this that writing the slogs has contributed a great deal towards our understanding of the material. Just a little advice for you and for myself: Look at theses SLOGS before the final exam... It helps to read your own slogs and those of other students as it fills in the gaps of materials and it helps to remember material in concise form.

Thank you all for reading my posts and keeping up with them every week. 1 more SLOG/Week to go... Lets do this guys... Good luck for all your exams and KEEP WRITING!!!

Sunday, 22 March 2015

SLOG8: Impression of Week 9--> TEST Week

Hey All! 
I am back with my 8th slog for this semester. Damn this semester is going by so fast. Looking back to week 1 I remember telling you how this was my first time writing blogs whether it be for class or for leisure. I must say though, writing every week did help me to understand my material as it gave me a chance to look back at the material and summarize it. It worked as a review process for me and helped me to improve my grades a great deal. Specially considering that for nearly a month our amazing TAs are on strike, going back over the material to summarize for the blogs really helped me to pin point where I was lost and what I was confident with from the previous week's material. I really though hope that the TAs would come back now that we are near the end of the semester because getting that extra help in this course would definitely help all of us for the final exam. 
During week 9 we had our Test 2, and you know what that means... STUDY STUDY STUDY CRAMMING STUDY...This is exactly how the week went for me. Simply going over all the material expected to be on the test and working on questions from past test. Although I missed having the TAs, I have to be honest I was happy to get that extra few hours from the lab hours to just go over all the material. When I wrote the test I felt confident that I did well and I knew how to tackle all the questions on the test as compared to test 1 where I just felt lost(even though material was much easier on test 1). I am still awaiting my marks for the test just as everyone else is but I am sure well get our marks soon. 
After the test we had a short lecture on how to mutate the Binary Search Tree (BST). I went over this material before the test thinking that it will be on the test but since I am in Danny's evening class, this stuff was not on the test. But it felt good to have gone over the material before class. Basically, mutating the BST involves either inserting data into the tree or deleting the data from the tree. Also since a BST only has two children(left or right), it is easy to determine where the data goes. For example: if the data is less than the node, then the data goes to the left of the node making it the left child and if data is greater than the node, it goes to the right of the node making it the right child. Though it was a short lecture, we managed to cover a lot of material that needed to be covered for the final.

Now, that the countdown to the final begins, I want to thank all of you for reading my blogs and wish you all GOODLUCK!!! *Keeping fingers crossed to get TAs back* 

Sunday, 15 March 2015

SLOG7: Impression of Week 8

Hi All!!
Okay wait before we start talking about anything related to week 8, lets just take a deep breath and grasp the fact that its WEEK 9 already(well the end of it as its the last day)!!! Week 9 of 12 weeks wow we are nearly to the end and we are still having to face the consequences of the TA's strike. It is unfortunate but like I said last week, the TA's gotta do what they gotta do. I really hope they get what they want and they return to school as last week I felt like a lost fish in the pond.

Last week, we had to submit Assignment 2 which when I started working on wasn't too bad but it just got complicated out of nowhere to me. But thanks to my group members we managed to finish the assignment and submit it on time (hoping for as good of a result as Assignment 1). Though majority of the week was spent working on the assignment, there was yet Test 2 coming up which definitely required some undivided attention. I really wished the TAs for this course were back in class as my new TA seemed like a helpful one and him being around for the lab would've helped a lot for the test. Not all was lost though, because Prof Diane and Danny made sure we are not completely neglected before the test. The lectures were as usual clear as it can be for a 1-2 hours lecture and missing the lab kind of gave me that extra time to work on course material at home/library. This extra time to myself motivated me to find a way to solve the lab problems and lecture materials which in turn enhanced my learning of the material. After writing test 2, I feel it definitely helped me to answer the questions.

Week 8 lecture consisted of Linked List which can be seen as lists that are made up of item and a sub-list.it is basically a collection of  nodes. It is mutable. I feel I still need some more practice with Linked list to understand it completely. That is what I am working on for now and hoping that TAs will be back in action soon.

Thanks all for reading...

Sunday, 8 March 2015

SLOG6: Impression of Week 7

An overwhelming week indeed!!!
I don't know what to say but that the week has gone by way too fast. I feel just a few days back I was here writing my summary about recursion. Anyway, I am back here to give you some insight on how Week 7 of CSC148 went.

Like I said earlier, it was an overwhelming week filled with loads of info and decision making. This was the week after reading week. As I am sure you all will agree with me that the week after reading week is like a recovery week. Its like you are healing from a wound because you are coming back to reality from vacations/studying/no class week but part of you is still in that vacation mode. This week did however, came with a lot of surprises and bad news. For example, the TA strike. I don't know how to react but wow that wasn't expected. But they gotta do what they gotta do and we must learn to deal with it. Thankfully our lecture instructors are still there to teach us the material though. With the strike at its peak, labs and tutorials being cancelled for most of my classes and marks being adjusted due to strike, this weak was not less than any roller-coaster ride.
With all this set-aside, the show must go on...and it sure did. This week we learnt about binary trees. Binary Trees are basically our Tree design but it only carries 2 children. One child is on left and the other is on the right. Something like this:

In this Tree, A has two children: B and C. These two have 2 children of their own: B--> D and E ; C--> F and G. Since D, E, F, and G do not have any children, these are referred to as Leafs. The binary tree can be evaluated in order, pre-order, or post-order. Searching a binary tree involves recursion which has a base case of checking whether there is a leaf. If there is no leaf then we evaluate the left tree, then the right tree, and then combine left and right using the binary operator. The lab for this week wasn't cancelled which helped me to learn binary tree much better and not to mention, I am super happy about the new TA. He is literally the best TA. He really knows what he is doing and is well prepared for the lab. He is actually willing to help us whether it be a very small matter. I am unhappy that during the strike I'll miss out on the interaction with him but I really hope these TA's get what they deserve.

Looking forward to the last few weeks of class and TEST 2!!! Good luck everyone

Sunday, 1 March 2015

SLOG 5: Tracing Recursion ALL OVER AGAIN

Hey all!! Hope everyone had a good reading week and a great recovery from the reading week. I sure did. I definitely feel this was a productive reading week where I caught up to most of my course work and studied extra hard to be prepared for the second half of the course. 

This week we are asked to revisit one of the topics previously written and to be honest I love that idea. I feel that revisiting something you have already written not only helps you to understand the material better but it helps you fill in those gaps and detect the important information from the not-so-important/ necessary info. I literally re read my slog for recursion and then looked at my test and the only thing that went through my head was
                'WHY DIDN'T I JUST READ MY SLOG BEFORE THE TEST!!!' 
Reason for this reaction, well I did super poorly on the recursion question of the test mainly because I thought it was a smart idea to not write each of the tracing steps clearly. I get it now that that's the whole point of tracing. Well there is still room for improvement and I am learning from my mistakes. One thing I mentioned in my previous SLOG on recursion was that at that time we didn't have to worry about writing the code for recursion. However, now by week 7 we have gone over some coding for recursion. To be honest, when asked not to worry about the code for recursion I was scared it might be something super difficult. But turns out it isn't really and the coding aspect actually helps understand the tracing part even more.

I feel my last post on recursion did a pretty good job at defining and explaining what recursion is, so I will not repeat that here. You can actually just re-read that part from my previous post. However  I will write a little bit about the coding part of recursion. Its honestly simple if you break it down into two steps, just how we did while doing the class activities. These 2 steps are:
1) Write the base case: this is the case where no recursion is needed. It helps to write the  examples and see the simplest example and turn that into the code. 
2) Recursive code: This is the main part of the code. More like base case is the appetizer while recursive is the main course(Lame... I know :( ). This is the part of the code that will actually do the tracing. It usually involves multiple if/elif statements that ensures that all conditions have been met. 

Here is an example of the code that I stole from one of the class notes posted on course website:

def koch(t, order, size):
    if order == 0:
        t.forward(size)
    else:
        for angle in [60, -120, 60, 0]:
           koch(t, order-1, size/3)
           t.left(angle)

In this example, the base case will be if order is equal to 0, then t (which is referred to turtle) proceeds forward based on the size provided. The recursive part is under the else statement. It checks for the angle and then tells turtle to turn  left according to the angle.

Although this example is quiet easy to visualize how the code works, there are of course much difficult examples such as those we work on in the lab. But I feel as long as you use the 2-step-process, as I like to call it, coding recursion becomes a piece of cake. I hope my post helps you understand recursion as its doing it for me. Thanks for reading and GOOD LUCK to everyone for the second half of the course.