Sunday, 28 February 2016

Week 6

     This week we learned more about linked list. Linked list is a class with subclass linked nodes. The attributes of linked list are head, tail, and length, where head is the first node in the linked list, tail is the last node in the linked list, and length is the number of nodes in the linked list. The subclass linked node represents a node in the linked list, linked nodes have attributes: value and next, where value is the value of the current node, and next is the next node after the current node.
     Linked lists have methods that add a node in the middle of the list somewhere, or a method that takes out a node from the list somewhere.

Week 5

     There was a test this week, unfortunately during the test, the fire alarm went off, so the students had to stop writing the test and wait outside. Once we got back into the testing location, we couldn't continue writing the test. I was a bit disappointed because I studied for the test and according to the questions I did before the alarm went off, the test wasn't that hard. Hopefully the professors will vote for a solution that is fair to us and the rest of the class who took the test.

Week 4

     After last week's inheritance, and subclass, we learned about abstract data type - stack and container, unit test, balanced parentheses and linked list.
     Stacks and containers are just abstract data types that can store values and new items are added on top of the stack, and you can only remove items from the top of the stack. Also there's a method which tells me whether the stack is empty or not.
     I personally find unit test to be the most challenging part of this week's materials. Apparently unit test is a framework that setup test cases, and run them independently. An example of unit test can be used on balancing parentheses. The solution to this unit test is that we create an empty list, which if see a "(", add to s. If see a ")" remove from s, and if at the end the list is empty, then it's true.
     The next part of this weeks lecture is linked list. It is like a list, but the nodes inside the list are linked with the previous and the next node. Linked lists have a head and tail, which are the first and last node in the linked list. and each node have a node linked to node.next.

Wednesday, 10 February 2016

Week 3 - First impressions of the course.

    It has been 3 weeks into the course, I found this course pretty fun. Unlike csc108 this course is teaching me more about how to design a programs using the codes I learned in csc108. 
    So far I have learned about designing classes, and abstract data types(ADT). At the beginning I found classes pretty confusing, because I didn't know why classes are needed, why can't we just use methods without a class? But after going over the slides and reading the example codes available on the course website, I found out that classes are for things with same properties and operations. Like squares for example, all the squares have a centre, and a side length. I can make a class with side length and centre as its properties, and every time I want to initialize a square, I can just initialize the class with the proper properties. This makes the codes very organized and clear to see.
    In addition, I like the tutorial questions a lot, I get a sense of accomplishment when I complete the problems and see them run without any errors, I think I'm starting to like coding. :)