Sunday, 5 April 2015

Week 12: Complete

I have reached the last week of the course and hence it is time to look back. This course has progressed from learning about removing redundant code in the form of inheritance to recursive functions that confused me for a good two weeks of the course. In this course, I have come to appreciate both my group mates that I do assignments with and my TA that helped me apply the concepts learned in class. For me, the highlight of the year would probably be in Week 9 of the course where term test 2 took place. In that week and the one preceding it, recursion was all that I thought of and tried to master. For me programming functions that called itself when I certain condition was met befuddled me. During that time, I was unable to understand how to constantly call the function when a certain condition was met. All in all, this course not only taught me more programming concepts but allowed me to appreciate the importance of group work and getting help from my lab TA, Asha.

Week 11: Thanks and Realization

This is week 11 of my course CSC148 with Professor Heap. In this week's slog I will revisit my blog post on "why Geeks Need to Know how to Write" while comparing my thoughts on it with Brendan Neal's slog entry.

From my progression with the course and interacting with my fellow classmates, I completely agree with my stance during week 3 when I wrote " why Geeks Need to know how to Write". From doing labs and assignments with my peers, I have come to appreciate the format in which the course was shown to us. By working with fellow classmates, I was not only able to learn more about the material ranging from inheritance to trees, but also, to improve my social skills with others. As I mentioned in my week 3 slog, I stated that "computer science isn't a very social community" due to the fact that everything was mostly your thinking and actions. With these assignments, I was not only able to see how I could apply my knowledge of class material and my previous experience in C, but also, the knowledge pool of my teammates. I was astounded to see the different approaches that they took to address the problem and was really happy that we were able to communicate with each other to maximize our code for assignment 3.  This course has allowed me to interact with my fellow classmates and and see how they think by analyzing the code that they write. As I mentioned in my week 3 slog, communication between computer science students has direct correlation to computer to computer communication. We, CS students, are able to understand each other through the code we write which emphasizes the importance of our communication.

My friend and fellow teammate for assignments, Brendan Neal (http://brendannealslog165.blogspot.ca/) had similar thoughts to me. All throughout high school, I was an introverted kid. Most of my communication that was unrelated to course work was on the football field. However, in class, I was mostly silent and did not communicate with my peers a lot. For Brendan and I, we both hated humanities because we were essentially forced to talk and express our ideas. For him, it was instrumental in developing his communication skills with people around him. This was in fact the same case for me. I learned and experienced teamwork and communication in these classes due to the projects and reports my peers were assigned to do. In addition, I also completely agree to his justification that STEM fields were less involved with communication than those in other fields. The job environment in STEM fields are more individualistic in the form that tasks had to be completed separately and social skills aren't as valued as they are in business fields.

After reading my previous posts and my fellow peers slog, I know see the definite relationship between effective communication and computer programming. Before taking CSC148, my understanding of computer science was just ability to code anything that was assigned to me. However, after doing the assignments with my classmates, I came to the realization that the example calls that are in the doc strings are basically a form of communication with people that read my code. These example calls not only give the reader a better understanding of my code, but also, ingenuity in my code when I am able to shorten the amount of calls.  This furthered my belief that Geeks not only have to be able to write code, but also, to be able to effectively communicate their thoughts with the reader.

In conclusion, I completely agree with my earlier self about the importance of "why geeks should write" because of both Brendan Neal's slog post and my own progression though this course. I would also like to thank my TA, Asha, for being their to help me during lab times as it provided me with another form of communication with a fellow programmer.

Week 9 and 10: Grinding through labs alone

I have progressed to week 9 and 10 of CSC148 and things have progressed very slowly. I have noticed that without TA's giving me immediate input with my implementation of BST functions, I constantly reached an impasse with my coding. For these two weeks, I was only able to get an understanding of the material rather than a hands on learning style.

To summarize:
  • binary search tree is a very special ADT
  • data is sorted
  • numbers on left children nodes are less than parent nodes
  • numbers on right children are more than parent node
  • easy to insert into BST

However, the thing that was on my mind for these two weeks was the term test. As mentioned in my week 8 slog, my group had a terrible time making our code recursive for minimax and the tippy functions. We didn't have the right mindset in which to turn our code into recursive calls. This made it extremely difficult for my preparation for the test. Professor Heap stressed in class about writing recursive coding which really scared me due to the fact that I had a rudimentary grasp of the idea.  For me, I had trouble visualizing the function calls that were nested within if conditions.  This made me to believe that I was thinking about the coding on a base case rather than a general one. After understanding this and reading my peers slog, https://csc148jasonus.wordpress.com/, I was able to come to a realization. Quoting from Jason's slog: "idea of being within" and his metaphor with Inception, I was able to finalize my understanding of recursion.

To be honest, I still had to put a ton of examples from the labs to guarantee my understanding.

Week 8: Binary Trees

This is Week 8 of CSC148 and the week that assignment 2 was due. Our group had difficulties implementing the functions for the class minimax. Even though we had the concepts down for the implementation, assigning the game states to the nodes of the tree was extremely difficult for us.  Overall, we had a decent understanding of the material; however, it was just the recursive functions that threw my group off.

This weeks lab material was extremely easy for me as it involved linked lists. Since I already implemented linked lists in C, I found it extremely easy to transfer over code from C to python.

Friday, 27 February 2015

Week 7: uhhhhh

I would like my TA to grade my Object Oriented Programming summary in week 6.

Below is my revised version of week 6's impressions about Object Oriented Programming.

------------------------------------------------------------------------------------------------------------------

Object-oriented programming , as the name suggested, is a style of programming in which data and the operations are organized into objects. In other words, programmers focus on objects instead of the implementation details.

Here a few terms I had to define:

Object: A basic entity in Python that models a thing or concept in the real world, which contains attributes and behaviours.
In fact, every value in Python is an object, like str, int, list and dictionary.

Inheritance: A mechanism involves classes inherit (get) commonly used attributes and behaviours from other classes. A subclass (child) class, by default, inherits all the methods and attributes of the super (parent) class.

Class:  A template or blueprint for the objects of similar types.

My thoughts of OOP can be thought of as better organization and removing redundant code.

Methods are special functions written for a related class. This removes the concept of having a multitude of functions that each refer to some object. Thus, methods in classes are simply used to group related manipulators of objects and associate them with a class.

Inheritance was an extremely defining term in my mind. It allows me to reuse the same methods for inherited objects without having to encounter the problem of duplicate code.

In the example below, the use of inheritance from object oriented programming exemplifies the removal of having to initialize address and room as in class Townhall by inheriting the attributes from class House.




In addition, OOP removes the concept of having multiple functions referring to different objects by organizing them into classes and sub classes so that methods have a direct correlation to their class and subclasses. Professor Heap gave us a great example in class that demonstrated this concept. First he showed a few functions that were related to class point. Then he introduced another class called Heavypoint which had some duplicated code with the the parent class point. In the end, the professor cut down the duplicated areas and reduced the messy python code into classes followed by there methods and subclasses.

In summary, object oriented programming make modification to pre-existing code easy due to the ability to inherit methods and attributes from a parent class.

Week 6: Object Oriented Programming

Object-oriented programming , as the name suggested, is a style of programming in which data and the operations are organized into objects. In other words, programmers focus on objects instead of the implementation details.

Here a few terms I had to define:

Object: A basic entity in Python that models a thing or concept in the real world, which contains attributes and behaviours.
In fact, every value in Python is an object, like str, int, list and dictionary.

Inheritance: A mechanism involves classes inherit (get) commonly used attributes and behaviours from other classes. A subclass (child) class, by default, inherits all the methods and attributes of the super (parent) class.

Class:  A template or blueprint for the objects of similar types.

My thoughts of OOP can be thought of as better organization and removing redundant code.

Methods are special functions written for a related class. This removes the concept of having a multitude of functions that each refer to some object. Thus, methods in classes are simply used to group related manipulators of objects and associate them with a class.

Inheritance was an extremely defining term in my mind. It allows me to reuse the same methods for inherited objects without having to encounter the problem of duplicate code.

In the example below, the use of inheritance from object oriented programming exemplifies the removal of having to initialize address and room as in class Townhall by inheriting the attributes from class House.




In addition, OOP removes the concept of having multiple functions referring to different objects by organizing them into classes and sub classes so that methods have a direct correlation to their class and subclasses. Professor Heap gave us a great example in class that demonstrated this concept. First he showed a few functions that were related to class point. Then he introduced another class called Heavypoint which had some duplicated code with the the parent class point. In the end, the professor cut down the duplicated areas and reduced the messy python code into classes followed by there methods and subclasses.

In summary, object oriented programming make modification to pre-existing code easy due to the ability to inherit methods and attributes from a parent class.

Week 5: Recursion

ThisView blog is the fifth week of CSC148 and this week we covered recursion in our lecture. When Professor Heap first introduced the idea in class I was extremely happy to note that I had knowledge about this topic before hand. Factorials had been a common high school topic and I was easily able to translate the ideas into code. In my mind, recursion was simply a form of python script that called itself repeatably until it reaches the deepest element. Here is my implementation of factorial:


What I didn't know about recursion was that it is a extremely repetitive process. I noticed this after I can it through the python visualizer and noticed the amount of calls to line 2 and 4 that were made. Basically every time the function called itself, python had to determine whether the n-1 was equal to 1 or not. In addition, I gave myself a simple example and traced the code by hand when n = 4.


Summarizing my thoughts on tracing recursion, I found that I must first locate the recursive function and then use this code and apply it to each element of the object. Then making my way to unravel each of the calls to the lowest element. 

During the lab, I found that my understanding of recursion made it easy to do the lab material and quiz as I only thought of the questions presented as an onion that has multiple layers, slowly unwrapping until I reached the core.

I also found this video extremely helpful with my understanding of recursion:

https://www.youtube.com/watch?v=s12IdMeVpw0


Week 4: Yet Another Week

This is the fourth week of CSC148 and I feel relatively confident about the course material that we have been doing. I found that reading the course notes about inheritance and ADT very easy as it mostly required just reading the material and understanding the concepts of data representing and removing excessive code.

For inheritance, I found a really good example on David Liu's website (http://www.cs.toronto.edu/~liudavid/csc148/week2/inheritance.html) that allowed me to understand the material really well. Basically, I didn't understand how to carry over methods over to another subclass. However, this example on the webpage shed light on my confusion.

To use inheritance, I noticed that you have to include the parent class name,"House", in the declaration of the subclass. Also to carry over information of methods in from parent classes, I would simply write the parent class method preceded by the Parent class name(refer to line 3 in screen shot).

ADT was very easy to understand as it only required me to do a thorough reading of the course notes posted on the website.

Friday, 30 January 2015

CSC148: Week 3 Why Geeks should write

Computer science isn't a very talkative community. After all, you are spending most of your time sitting in front of a screen typing away, finding some obscure bug or all-in-all communicating with the computer.

In many ways, programming is a form of  communication with a non-human. Think about it this way, the computer, although boxy and only 1 meter tall, is a rather smart individual that just needs some pushes and motivation to generate a lively conversation. The more inputs or complexity of your work, the more responsive and "human-like" the program is.  This means that eventually the program that you have spent hours working on and communicating with will become smarter, faster and above all cooler than yourself. After all you are a geek.

Writing is one of the most useful forms of communication. You don't have to repeat yourself, it's easier to translate and you can take your time to fully articulate what you mean and clear up any mistakes before someone gets the chance to read it.

Week 2: CSC148