Sunday, 5 April 2015

SLOG10: Final SLOG for the semester

Welcome everyone to my last SLOG for CSC148. While course went by so fast, I still feel that we were able to cover a lot of material. Looking back to the first week of classes I was overwhelmed by the material in this course. Now I won't say that now I am less overwhelmed but I will say that the material really did get harder and harder over the weeks. Not to mention the strike worked as a cherry on top of cake.

Looking back to first few weeks of classes, I was terrified by the material and after test 1  wasn't sure if I should continue to take this course. But I didn't give up and I kept trying to understand the material and eventually with working on the assignments on my own and then the partner, it helped to gain insight onto how to code appropriately and where I was going wrong. My mid semester, I began enjoying the material since it was all about recursion and this topic seemed really interesting to me. Over the weeks, even with the TAs being on strike, I still managed to go over the material weekly and teach myself the material based on the class notes.

Overall, one thing that I found to be most difficult for me was to turn the English understanding of the methods/functions into the code.I always commented out what needs to be done and then worked on figuring out the code for it. Though it is still difficult for me, I am still able to write the code and I enjoy doing this. Another topic I had struggled with during this semester was using recursion to draw trees. I know its very simple, but my head just does not wrap around it as fast. I am able to do this but it takes me a while to understand exactly how to do it.

Now that the class is over and the strike over, lets all focus on the exams and try to ace them to the best of our abilities. Thank you again for reading and following my posts. Good luck for the exams everyone!!!




                                                                  

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.

Sunday, 15 February 2015

SLOG4: Summary of Object Oriented Programming

Hi all, I am back with my 4th SLOG for this semester. I have to say things are going so fast but as I anticipated in my first slog, its going to be an uphill battle. It sure has been one. With test one, assignment one and a couple of quizes out of the way I feel much confident in my ability to program using python. Today I'll be writing more about what object oriented programming (OOP) actually is. In doing so, I hope that it will aid my understanding of OOP and will fill the gaps (if there are any) for your understanding. Please feel free to correct me and fill in where I am lacking by commenting at the bottom. One of my reasoning in my  "Why Geeks should write" slog was that writing helps the writer as much as it helps the reader (if not more) in understanding the topic at hand. With this reasoning in mind I will start by defining what object oriented programming is all about. 

Object oriented programming is a programming language model that focusses on 'objects' and data rather than action and logic. In OOP we care about objects to be manipulated rather than the logic behind manipulating them. Some of the basic topics of interest are:
1) Class: A data structure that contains the set of attributes that characterize any object of the class.
2) Subclass: child class. 
3) Class variable: A variable that is shared by all instances of a class. it is defined within a class but outside any of the class's methods. 
4) Instance variable: A variable defined inside a method that belongs only to the current instance of a class.
5) Inheritance: The transfer of the characteristics of a class to other classes that are derived from it. Subclasses are used for inheritance.
6) Instantiation: the creation of an instance of a class
and much more. While most of this was a review from CSC108, working on the assignment 1, creating classes and subclasses helped me be fluent in creating classes. Initially I was overwhelmed by the amount of things that creating classes require, specially the special methods __str__, __eq__, and __repr__. But now that the assignment is done and the test 1 is over with I am super comfortable with these. 
Looking back at the concept of object oriented programming, I can see how one can use this approach to keep track of data. This is extremely helpful to me for the statistics part of my studies. It helps me view material presented in other non-compsi classes as a class having subclasses. It helps me to use the idea of superclass and subclass and methods to summarize material in my other courses in a coherent manner and do a better job and understanding and remembering the material for later one, such as on a test. 

I hope this summary has helped you in understanding the object oriented programming concept more and I hope you are able to relate to the idea of how using OOP for summarizing other course materials can help narrow down to the main topics of interest rather than the 'junk' material. 





Thursday, 5 February 2015

SLOG3: Tracing Recursion

Week 4 SLOG 3 and still counting...
So turns out that I have successfully survived the first 4 week of classes. Did I just say 4 weeks?? wow that sure was fast.Anyhow, this fourth week was quite interesting I must say because it wasn't until the beginning of this week when I realized that the next week I was to be writing the midterm for CSC148. With the upcoming test preparation and the amount of stuff due in my other classes including Assignment 1 for this course, week 4 was a hell of a ride.

Now, lets talk about the interesting stuff. Or I should say, the new material we studied during week 4. We were introduced to Recursion. Recursion is a way of coding a problem in which a function calls itself multiple times in its body. For now we are asked not to worry about writing the codes for recursion and focus on tracing them. To be honest, this was the first time that after the lecture it felt like I actually knew what was going on during the lecture. I was actually able to follow along with the prof. I want to say its an easy concept but I dont also. The way Prof. Danny went over the material explain step by step how recursion works and how to trace it, made it easier for me to understand the material.

The code for Recursion is as followed:
              if isinstance(L, list):
                    return sum([sum_list(x) for x in L])
             else:
                  return L

Now lets look at how a simple list will be traced:
    sum_list([4, 1, 8]) --> sum( [ sum_list(4), sum_list(1), sum_list(8) ])
      # here we go over the code presented above to see whether sum_list(4) is a list or not if it is not we return the value of L and if it is then we sum the values of the list.
                                --> sum([4, 1, 8])--> 4 + 1 + 8
                                --> 13

A nested list would look difficult to trace, however it is quiet easy to trace:

        sum_list([[1, 2, 3], [4, 5], 8]) --> sum([sum_list([1, 2, 3]), sum_list([4, 5]), sum_list(8)])
         #here we add the integers of each list separately:
                                                    --> sum([6 (1+2+3), 9 (4+5), 8])
        #now we have a list of 3 integers that can be added by using the built-in function sum: 
                                                   ---> 23 (6+9+8)
I know it might be too soon to say this, but Recursion has to be the easiest material to grasp on for me. For me it was a very basic concept and something that I can actually use later on for coding. Also, since I actually understood the material, I actually enjoyed the lab of this week because I was able to finish the lab and do well on the quiz. Out of all the topics we learnt in class, my favourite topic would be tracing Recursion. Like I said in my previous post, "Practice makes a man perfect", this truly holds as the more I practice using the additional questions on the lab handout,  I better understood Recursion as well as other topics.

This is what I actually got out of Recursion, I would love to hear what you think and please feel free to add to my understanding of Recursion if there is anything major I missed on via commenting on this post. Thank You for reading my not-so-funny posts. I will leave you all with this pretty picture presented to us in class that used recursion: 'The Recursive turtle example":






Thursday, 29 January 2015

SLOG2: Impression of first few weeks of CSC148

Before I begin writing my second slog for CSC148, I would like to take this moment to take a deep breath and embrace the fact that we are already in the fourth week of classes. How time goes by is unbelievable. I remember the first week of class when I entered medical science building and I was not sure how this course will be, what it will be about, etc. As I mentioned in my previous slog that I had taken CSC108 last semester so I was hoping that an introductory course on Python would ease the transition into CSC148. I sat right at the front of the class so I can focus and understand the material. To my surprise, at the end of the class I felt clueless about what Professor Danny taught. Now don't get me wrong, Prof. Danny isn't a bad prof. In fact, he is really helpful and the way he teaches someone with no background of Python will also begin to understand it. 

Before getting into the material we learnt in class and my struggles with it, lets shed some light on how week 1 to week 3 went. I can definitely say that on average these 3 weeks were an uphill battle for me. Week 1 began with a lot of confusion about the material. This is mainly because we started of with the topic of Classes, which we barely touched upon in CSC108. Since I had minimum to no background in computer science, it was like getting introduced to a completely new topic. Although it was somewhat assumed that students are prepared for this course based on CSC108, at that time I felt that nothing I learnt of in the introductory course was being used in CSC148. Note that I said "AT THAT TIME". Reason behind this is by week 2 I was beginning to understand and get a hold on the topic of classes. I used the time between the two lectures to go over material taught in class and just reading over the chapter notes provided on the course website. I also, feel the CSC108 textbook is a good reference to read over when in doubt or when stuck. Although I was starting to understand what a Class is and how to create a class and what methods it requires, I wasn't 100% confident that I can do this on my own. It wasn't until labs began in week 2, when I actually started to get a feel for it. Like they say 

"PRACTICE MAKES A MAN PERFECT"

Before the lab, I went over the material and I'll be honest with you I was more lost than ever. Taking one step at a time and finishing the lab material as much as I could based on my understanding, I have to say it was a good base for me. After working on the handout during the lab with my partner and discussing with the TA and fellow students, I understood a lot more than what I went in with. I understood what the __init__ method does as well. Basically I went into the lab with just the following:
                            class RaceRegistry(object):
                                     """ A system for organizing a 5K running race"

After the lab, I had this much:
                           LEGAL_SPEED = ['under 20', 'under 30', 'under 40', '40 and over']
                           class RaceRegistry(email, speed_category):
                                    """ A system for organizing a 5K running race
   
                                     Attributes:
                                         - email address: list of strings of email address
                                         - Speed Category: string. < 20, < 30, < 40, and >= 40
                                     """
                                     def __init__(self):
                                               register = {}
  Other than the lab component, during week 2 we also worked on __str__, __repr__, and __eq__ methods. I have to be honest here, I didn't understand the point of these methods then and I still do not understand it. During this week's lecture, Prof. Danny went over these methods briefly in terms of our assignment 1 and I understand the definition of them but still clueless about what the point is of having them there if there is even one.
While all this was going on, I was also working on Assignment 1 with a partner. Now I have to say, what the assignment did for my understanding is not even close to what the lecture and the labs have. Like I said before, PRACTICE MAKES A MAN PERFECT!! and it sure did for me. The only thing that threw me off was the subclass and how it is inherited from the superclass. Luckily my partner is in the earlier lectures of Danny so she explained that part to me. This is why, during week 3, subclasses seemed like review and it cleared up more for me.

Looking back at the 3 week period that passed in this course, I must say there was a lot of material covered but it sure just got better and better for me over time. I am honestly looking forward to what else is in store for me from this course. One thing is for sure, this is just the beginning and I know things just get harder and harder but I am confident now that I can tackle the course material as long as I keep working at it.

Thank you all for reading my posts. I know its quiet lengthy but I hope from my experience you can take a few advice for yourself and it'll help you in the future. Feel free to pass a comment to me as I love getting feedback on how I am doing specially since I am new to computer science and to writing slogs.

Wednesday, 21 January 2015

SLOG1: Why Geeks (Computer Scientists) should write?

As a third year cognitive-science student taking the first year computer-science course, it sure feels like I am just learning to talk in another language. Although the process of learning a new language is quiet exciting, it sure comes with great difficulty. I remember the first time I enrolled in CSC108, I went to the coordinator with the hope that I can get an exemption from taking the course but Professor Campbell convinced me that this course will not be difficult at all and I will learn a lot. After finishing the course last semester, I was starting to feel this whole computer-programming deal. I was able to follow what was going on in class on a day to day basis and was able to do most assignments and in class assignments on my own. This actually gave me confidence that I can take another course in the computer-programming aspect. Since CSC148 is one of the courses required for my Cognitive Science Major, I thought to myself “hey why not just take one more course" and here I am taking the CSC148 with Danny Heap.

Once I enrolled into CSC148, I was pretty excited to see what was in store ahead for me. The day I saw the course syllabus, I remember reading the requirement for submitting a SLOG every week. I was pretty confused but once Prof Heap explained it to us during the first lecture, my first reaction to it was exactly what he has asked us to write about in this post: "Why should Geeks write?" First and foremost, Geek is defined by the British dictionary (http://dictionary.reference.com/browse/geek?s=t) as 

"a person who is preoccupied with or very knowledgeable about computing".

Personally, I feel the answer to this question can be obtained only when you place yourself in the shoes of a Geek. For someone who spends most of their time writing codes in languages such as Python, Java, C+, etc, it can be difficult to express what they want to in English or any other non-computer language. They should also practice writing because translating something from one language into another takes deeper understanding of the material and that will lead them to understand the material better and will help them to make their codes more concise and less over-loaded with codes. It will also help them to remember certain information for later one. this can be seen as having to talk about their programs and problems in a non-computer language as a superclass and referring back to these problems as a subclass for it. When in need for the info later on,  geeks will have a better understanding and memory of the info and it will be stored in their implicit memory so that  it can be accessed at a later time.

For now this is all I can think of as to why Geeks should practice writing, this is just my take on the question as cog-sci student but I would love to hear what you all think about it.