Sunday, 5 April 2015

W12: I Survived This Far, Let's See How The Final Goes...

    Well, now that our last lecture on Wednesday concluded the semester is officially over, I can breathe a sigh of relief. Oh wait, that's not true... Finals are looming over us. I can hardly wait until finals are over; oh, and also, when Spring decides to sober up and stop the surprise-snowing but give us the well needed sunshine and warmth.

    Through a few of my past courses, I've always kind of been not with things 100%, but figuring things out as we go. This is especially noted in csc108, csc148, and csc165; sometimes, during the lectures, I was so confused that I wanted to ask questions, but I didn't know what it was I didn't know. For me, the labs allowed me to apply and absorb. Due to the lack of "actual" labs though, I'll really need to step up my game before the final. Hopefully, if I manage my time wisely and not get distracted, I should be able to feel pretty prepared for the final. I'm lucky none of these have come up for me (yet):


    My dad was so excited when I first started my cs courses here. Before I left, he was so thrilled about being able to play a game created by me, similar to Angry Birds, in the future. Looking back on a1, a2 and a3-- I realize he can keep dreaming (but thanks, dad, for being so optimistic and having so much faith in me!). It's going to be a while before I can achieve anything like Angry Birds, that is, if I ever manage to. The assignments have had their ups and downs, as I mentioned in a previous post, but I've learned a great deal from them as well.

    Coming from csc108 I was still unfamiliar and uncomfortable with certain concepts such as "classes", "special" methods etc. but now I feel a lot more confident with them. And trees? Well, let's just say my knowledge has definitely been branching out. haha.
© Alex Kuo
©Alex Kuo
    During this semester, I helped a friend who was taking csc108 and I found it fairly beneficial (for the both of us). I think it really shows how well you understand something if you can explain it and teach it to someone else, or help someone else to understand. I was a bit surprised with myself at how fast I was able to find a solution for problems or the errors in her work. I was careful never to give direct code or answers to her, but to hint and prod and guide her along so that she would learn as well.

    Despite that, I'm still really nervous for my upcoming exams. If I can just get past these exams, then I can get to summer, and hopefully, second year the next time I'm back in Toronto.

Best of luck to everyone!!!

Monday, 30 March 2015

W11: Déjà Vu

Programming is an Art Form That Fights Back

Do I still enjoy creative writing?
Yes.
Do I still want to make the best of everything and give it my all?
Yes.
Do I still sometimes regret not choosing something like art school?
Yes.
Do I still think I am blundering around trying to find my future?
Yes.
Do I still think my group from a2 is awesome?
Yes.
Do I still think programming is an art form that fights back?
Definitely.

Well, that about sums it up.











    Kidding. (Although my answer for every one of those is still true.)
I am still in the same state of attempting to figure my future out- and struggling.
I am still fascinated and impressed by many people's ability to learn and comprehend programming and the aspects of computer science.

    Anyways, I welcome the TA's back and emphasize, that in my opinion, programming is LARGELY learned by "doing". Of course, at first it was, "sweet! free thursdays for me :) ", but soon I realized the importance of the labs and the help provided by the TA's. I learned a lot from my TA during my labs and I relied on the labs as a major part of applying the concepts taught and understanding. Now that the end of the term is closer than ever- with exams starting only a week away, I really have to get through more lists of to-do's and have the material engraved in my mind- or something like that. I struggled with trees and recursion (slightly better now), but linked lists? wth.

    It's not just me though, I see that others have as well. As this fellow slogger has noted, that with practice, trees and recursion begin to feel more routinely, and linked lists just require practice as well. I find that, and I don't think I'm alone in this, computer science just takes a lot of practice and applying the concepts to actually learn. Another classmate, and a friend, has shared similar struggles in this course. In her slog, she mentions discovering the convenience for recursion and how a lot of the time, it's taking the time to think things through and not trying to immediately implement code; as well as drawing diagrams when necessary, pictures can actually really help.

    And yes, programming is an art form that fights back. It's like the Language of Shakespeare, it is its own language and it's probably marvelous and has some majestic features as well. Unfortunately, it's not something everyone can understand easily. I've heard people say that Shakespeare was just some babbling idiot and his works don't make sense, but isn't that me? I've wondered who the creator of python was and wondered if he was sane. I mean when I first looked at code, I thought, wouldn't it just be easier if there was proper grammer? Of course that would probably kill efficiency and possibly be even more complicated to write but what I'm trying to say is, programming is impressive, but it doesn't come easily (at least not to me); if you're really passionate and just love coding, then of course it's brilliant- but to me, it's like trying to understand Shakespeare for some people.


Sunday, 22 March 2015

W10: Getting there? Or....

    Well, isn't it wonderful that the sun has come out, the sky is beautifully blue and the birds are chirping? Despite the fact that the TA's have been on strike and that I have been a little behind in my labs, I can't believe we're so far into the semester. The strike has been a little frustrating as we have not been provided with the help I find extremely beneficial during labs and I have not taken it upon myself, unlike this fellow classmate, https://taylorluntslog.wordpress.com/2015/02/26/week-7-one-way-or-another-im-gonna-find-you/, who has taken it upon himself to learn the material by himself and not be completely dependent on the profs. I can't believe that we only have less than two weeks really, before it's finals.

  • we talked about devising tests for subtract square, which we did examples for. Examples with diagrams which made it a little clearer to follow.
  • the assert statement in python, which is used to insert assertions into programs for debugging
  • unittest and test cases, which I remember doing in 108. Unittest was explained fairly well in the textbook we used for 108, Practical Programming: An Introduction to Computer Science Using Python 3; the examples were easy to understand as well as the guidelines on their structures.
  • Assignment 3 has been released and we've talked quite a bit about that; as there are two options for us on how we would like to complete the assignment. Both of which Prof. Heap went over in lecture. Due very very soon. Eeeeek! 

    Sometimes, as the end of the semester nears, I feel relieved and terrified at the same time. I feel like csc148 was a bit of a jump from csc108 and sometimes I'm afraid I haven't completely made it or that everyone else is successful while I'm still trying to find my way.
©Alex Kuo
That's all I have to say for now.

Saturday, 14 March 2015

W9: Ode to 148

The anxiety rattling my nerves,
all weekend, and on monday too.
On tuesday was my 165 test,
and 148 on wednesday; how could I not be stressed?
Exams so soon, how could this be true.

And then the weekend was over,
and monday came too soon.
Oh proofs, if only I knew what to do.
And 148, please give me a clue-
I prayed as I looked at the beautiful moon.

In psych I could not sit still,
I could not focus and my mind wandered.
I thought about the test of 165,
as I waited for 2:00 to arrive.
About university and life I pondered.

Right after handing in the test,
for a question, I thought of a better solution.
No time to dwell on that though-
I just hope the mark won't be too low.
Now time to review about code execution.

Tuesday afternoon I was quite busy.
Studying had to be put off till a bit later,
but trust me, computer science is no jest.
So I ALWAYS try my best,
too bad there's always someone greater.

And so the studying began,
or I guess it would deemed procrastination by then.
The reviewing of labs, and binary trees,
that I had to open my window to allow for a cool breeze.
I really needed to be quite zen.

Linked Lists?
Where do I even begin.
Probably at self.front,
walking through the list, continuing the hunt
until I reach self.back, or West Berlin?

Binary trees, bst's and linked lists,
up until 3:00, "studying"/writing my aid sheet.
If only I could do really well, 
but I started getting tired, that I could tell.
I dreamt I did well, if that was real, wouldn't it be sweet.

Wednesday morning, I was very nervous.
Then it was time, and I made it through. 
I think I understood, 
can't say for sure if I did good, 
but for now, I bid you adieu.

Friday, 6 March 2015

W8: Programming is an Art Form That Fights Back

It's past midnight so technically it's Sunday morning and I'm doing a bit of relaxing which means my slogging.
My recollection of this past week?

  • CSC148 ASSIGNMENT #2 DEADLINE: MARCH 05, 10PM
  • CSC165 ASSIGNMENT #2 DEADLINE: MARCH 06, 11:59PM
and then...
  • CSC165 TERM TEST #2: MARCH 10 during tutorial time
  • CSC148 TERM TEST #2: MARCH 11 during lecture time

    Well of course those weren't/aren't the only things on my mind but a large amount of last week was dedicated to working on csc148 a2. Organizing times to meet and work on the assignment with my group and still get other stuff in my life done. As soon as a2 was out, I read over the handout several times, then I started brainstorming. Over reading week I started writing but then I got stuck and didn't have anyone to discuss it with- so my next move was to look for a group to work with. Luckily, bingo! I found one! They weren't free until after reading week but I felt relieved that we could get started soon.

    Once we actually met up and started discussing and writing, everything seemed to be right on track. (I'm the sort of person that actually NEEDS to use an agenda, write and plan things out, and have a schedule). My teammates were wonderful! (They are still wonderful people!) I really enjoyed working with my teammates and new friends, Julia and Fiona, because there was so much interaction and discussion. In the past, I've worked on projects with people that barely communicate but still manage to get the task done- that's not bad, but I'm just not that type of person. I need to discuss and work on it together (if I'm in a group) to learn. I think we met up almost everyday for a couple of hours to work on it; I think meeting up helps us stay focused (or at least it helps me. I know if I were at my apartment I would probably get distracted, and if I got stuck I would probably take a nap or go do something else and then come back to it later- maybe even hours later...).

    Some of a2 was kind of confusing and took a while to figure out and understand but we made good progress each day I believe. I think I actually learned quite a bit about OOP in general just because of all the discussion we had for this assignment. When errors occurred or questions were raised, we all tried to help each other as best we could and it worked out fairly well.

    There wasn't too much to modify/add in game_view.py so that was done pretty quickly, as well as tippy_move.py. It did help me in that we were given starter code for subtract square, and some things were fairly similar so we could refer back to the examples for subtract square. tippy_game_state.py and strategy_minimax.py  was definitely more work, but it makes sense according to the break down of marks. Minimax though, we first had to understand what it was supposed to do, and to do that, we imagined it working with subtract square first, a simpler game. As well as for methods we were unsure for this game Tippy, we experimented first with subtract square to get a basic understanding before moving along.

    I won't go into many more details about how we worked on a2 but I surely did find it a productive week, especially with the help of my team! :) The midterm is coming up and I am nervous but as mentioned in this fellow classmates' slog: https://juliaslog.wordpress.com/2015/03/01/getting-it-together-an-attempt/, I need to go through my list of "to-do's" and get some studying done. Also, I didn't manage to finish the lab because I got stuck, which definitely means I need to go back and understand. I was also planning to go back and finish it but with a2 and everything else, I simply haven't had the chance :p

    In regards to my post title, I have always been more of an artistic person, this computer science I am doing right now has been a bit of a surprise to my family and friends as well as myself. I look at it as a sort of challenge to take on and find it kind of fascinating at the same time. Programming is kind of a struggle from time to time with certain concepts; I also think of it as something abstract and artistic, it has it's own beauty. It's pretty amazing what a little bit of code can actually do or represent. Sometimes I do regret not choosing something more artsy, but you never know :p I haven't exactly "discovered" my path yet, but I'm hoping I will soon. As for now, I accept these challenges presented before me and am determined to make the best of these opportunities and experiences and to gain from them! :)

    I also do enjoy creative writing from time to time and I've heard, 
"Like punning, programming is a play on words."


Sunday, 1 March 2015

W7: Summary of Recursion

Have you heard of the butterfly dream?
A man dreaming of being a butterfly dreaming about being a man, dreaming about of being a butterfly dreaming about being a man....

Sometimes I think recursion is a beautiful thing, in a sense, artistic-
but art doesn't always need to be understood; therefore, recursion doesn't need to be understood right?
"Recursion is too deep for me, so I'll just admire it from afar".
 Not exactly.

I've talked about recursion quite a bit already, in the second part of week four's post:
http://ak148slogaddress.blogspot.ca/2015/02/w4-its-week-four.html
as well as touching on it in week five:
http://ak148slogaddress.blogspot.ca/2015/02/w5-re-re-re-re-cursion-recap.html

Now, I know I've said this before but for those of you that don't know,

People often joke, that in order to understand recursion,
you must first understand recursion. 

    So far, I think we've spent a fair bit of time on recursion, I'm not complaining- I find it rather helpful actually. The topic was first introduced in week four; we mostly tried to understand how it worked, tracing and tracing and tracing code. Continuous practice of tracing recursion helped me understand, not completely, I'll admit, but the gist of it. After the midterm, we started writing a bit of recursion and then we learned about trees- no, not maple, not cherry, not birch, not oaks or pines, but binary.
But before we talk about recursion and binary trees, we need to know some terminology.
  • root: the topmost node with no incoming edges. In this case, 8.
  • node: represented by a number in this binary tree (8, 3, 10, 1, 6, 14, 4, 7, 13). 
All nodes are one of the following:
leaf (children): node with no children (no outgoing edges). In this diagram, 1, 4, 7, and 13 are leaves. Also distinguished by left and right child, a parent (node 6) has a left child (node 4) and a right child (node 7).
internal node (parent nodes): node with one or more children. In this diagram, 3, 6, 10 and 14 are internal nodes.
  • edges: indicated by all the arrows connecting nodes.
  • subtree: a tree formed by any tree node together with its descendants and the edges leading to them.
  • height:  1 + the maximum path length in a tree. For this binary tree, it's height would be 1 + 4 (the longest path) = 5/ A node also has a height, which is 1 + the maximum path length of the tree rooted at that node.
  • depth: height of the entire tree minus the height of a node. Length of the path from the root to the node. Depth of node 7 is 4, depth of node 14 is 3, depth of node 10 is 2 etc.
    Now, these trees can get quite long, similar to family trees; and because they can get quite long, this is where recursion comes in. Recursion prevents us from having to go through the trees manually, which would probably take quite a long time, and imagine if you screwed up somewhere :p Now these trees have a base case, one that we can predict, manually and does not require recursion. Then, a general case,  one that calls itself and therefore does require recursion.

Here's an example that Danny showed us in lecture:
the if statement, is the base case- if there are no children, return 1. The else statement, then, is the general case- if there are children, go through the tree, count the number of children and return the sum.

    I think recursion is a simple concept, "a method that calls on itself", but learning how to trace and write it requires more patience and practice. Sometimes it's just hard to see what the function does and is therefore difficult to implement into code. I know I definitely need more practice writing the general cases so bye for now!

Friday, 13 February 2015

W6: OOP too OP for me

    It's finally time for a "break". Our first term test and a1 results have been returned. I have been kicking myself for the stupid mistakes I made on the term test. I wish I had checked it over, but I was literally writing until the very last second before the exam invigilator said, "stop writing, pencils down!". Besides that, I am satisfied with both results and really wish I could take a break; instead, a2 for both my csc148 and csc165 classes have been released and I am once again, thrown into a state of panic.
 
    Looking back to the start of the semester, I must say, I have improved my understanding of many things in the course. I felt we were a little rushed in the end of csc108 so I wasn't comfortable with classes when we started csc148, but now I feel a lot more confident, as well as with other OOP concepts .

Everything in Python is an object, they are, what we call, "the basic building blocks".

Classes
Why do we use classes? Mainly to have a sense of "togetherness", so that functions we use are not separate but can be grouped, in which they become methods. Somewhat similar to its cousin, def. In classes we are able to define attributes and methods. An attribute is a characteristic of an object, such as a salary of an employee. Methods are operations we can perform with our object; for example, a cancellation of an account. During the first week or so, I was still getting familiar with the structure and design of implementing classes, as well as the special methods: __init__, __str__, __repr__, and __eq__.

Subclasses:
A (sub)class (or "child class") derived from the parent class; an analogy commonly used to portray classes and their subclasses. These are generally more specific for particular cases, than what the parent class covers, as well as having the ability to override certain methods of the parent class.

Have you heard about the object-oriented way of becoming wealthy?
No...?
Inheritance.

Inheritance:
As defined by Google, "derive (a quality, characteristic, or predisposition) genetically from one's parents or ancestors"). It's basically the same in programming as well. Subclasses, children, inherit "characteristics/attributes" from classes, parents. Here, they are inheriting methods and data that have already been written. One important rule of programming is, "DRY", Don't Repeat Yourself (as I've learned how "lazy" some fellow programmers are haha).

Property:
Trying to make something "private" but not exactly. We do this by adding two underscores "__" 's in front of a variable/function and Pythonista's (as Prof. Heap calls fellow programmers), are expected to realize and respect that code. Means you're not supposed to change it, but there's nothing actually stopping you from doing so.

#well this wraps it up for now.