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.
Sunday, 28 February 2016
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. :)
Subscribe to:
Posts (Atom)