Thursday, 19 February 2015

Week 6 Impressions

The week before reading week had very interesting lectures discussed.We started to discuss the science behind computers and how a computer sees a class as nodes, a path, and with children. In this week I was introduced to new terminology. I started to visualize a class as tree branches that all contain children within their larger branches. This makes it easier to find specific children and apply a function call to it. I found this idea similar to binary searches, where you can shorten your options by specifying you search results. During our Wednesday lecture, we also implemented a more complicated function of recursion than what was presented in previous lectures. We continued these recursion implementations in the lab, however, it definitely felt more challenging than previous weeks. During the break I plan on continuing to study week 6 and do more examples so I can start off week 7 prepared to learn the next topic.

Wednesday, 18 February 2015

Summary on Object-Oriented Programming

As a continuation of CSC108, I have learned much more on object oriented programming and how it can be applied not only on how to create computer classes, but also in everyday life. Throughout object-oriented programming, I've learned about many different ideas, such as classes, attributes, methods and instance variables. Not only was I able to create different classes, but I connected all the different ideas with structure and used the appropriate methods.Take as an example, myself, Amanda D'Errico. If we were to create class Girl, we would need different attributes, such as height, weight, hair colour, and so on. These different attributes will have appropriate names to define the methods for class Girl. Then, we can have myself as an instance. Other ideas that I've learned in the past few weeks are different ADTs, such as Stack. There are many built-in functions to Stack, such as is_empty, push and pop, which all contribute to its class. Stack follows a first in, last out (FILO) property, which I like to picture as a tube with marbles stacked upon another. Another ADT I've learned is Queues, which follows a first in, first out ideology (FIFO), resembling a cafeteria line. Inheriting data types have also played a role in object-oriented programming, as it has shortened my code. Overall, object-oriented programming has helped me expand ideas in computer science and in the rest of the world, and I hope to learn more in the following weeks!

Tracing Recursion from Week 4

Tracing recursion is a very important concept for CSC148 that builds from analyzing every move a function did from CSC108. I find it very similar to debugging, however there is a different way we were taught in class to express the way we trace. In class we learned that tracing requires you to call the function on every element within the built-in function you are working with, whether it's sum(), len(), or others. With the help of my TA, I have also learned when we do "human recursion" (assuming we are the computers who hold memory), we can use a function call we traced earlier to easily compute the inner value of a function. For example, suppose we have a function called sum_list that takes in either a list of numbers and sums them or it takes in a list of integers and returns the integer value. If we know sum_list([1, 1]) is 2 and sum_list(5) is 5, then we know sum_list([[1,1], 5]) is sum([2, 5]) -> 7. Once again this is because we have seen these examples before. Recursion is a useful tool to not only shorten code, but trains your brain to effectively evaluate and use shorter steps to trace a function call.

My Impressions Weeks 1-3

Throughout the first few weeks of the course a lot of new topics were discussed that built on what I have been learning in CSC108. Ideas such as classes and its characteristics served a major role in developing my understanding of computer science. In the first week one of the first topics we tackled was how to write our own class, instead of the standard function implementation I explored in CSC108. This has taught me to connect ideas together to represent a larger idea and concept. The second week I learned more efficient ways to write code, such as list comprehensions as well as different attributes for a class and different test methods. Not only have list comprehensions shorten my code for if statements and for loops, it was especially useful for the third week, where we introduced to recursion. In addition to recursion, we focused on the importance of inheritance and exceptions. With inheritance, we can incorporate the same attributes from one class to another and add or alter an attribute to make a collection of classes. In week 4 I will continue to explore recursion, which will be used throughout the remaining of the semester.