Sunday, 5 April 2015

Last Impressions

Now, when the semester is officially over, it’s time to share my last impressions about the whole introduction to programming course. Even though this course was definitely not easiest one, I really enjoyed it, and, looking back in time, I'm glad that I have taken. 
   
   The first weeks of this course were not easy for me, as I have forgotten almost everything I learned in CSC108 a year ago. However, as time passed by, I began to restore my memories about classes and methods’ implementation. I came to realize that in Python it is very important to know how to implement the class properly, as it helps you control the whole programming process in the future. 
   
    Another important concept I've learned in this course is recursion. Although I am not proficient with it, learning it opened a new way of thinking about the problems for me. Recursion was extremely helpful during the work on assignments 2 & 3, and it was irreplaceable for creating minimax strategy. 

   Sadly enough, we didn’t have the labs during the last four weeks of the course. Before the TA strike, I couldn’t imagine how difficult it will be for me to do without weekly labs and TA’s support. I constantly felt that I am behind the course, and I didn’t have enough motivation to do the lab exercises. Fortunately, the strike is over now, and I really hope that graduate students and the university will be able to come to a mutually acceptable agreement.


   In the conclusion of this post, I would like to thank everybody who helped me in this semester. Special thanks to Danny, who tried his best to make sure that the strike has the smallest impact possible on our learning experience, and was always approachable and ready to help. I’m also grateful to my TA, who supported me during the first 6 labs, and those TA who helped me to complete the 3rd assignment. Finally, I want to wish everybody good luck on the final and in their subsequent studies. Hopefully, we all will pass!

Friday, 3 April 2015

Revisiting Recursion

In one of my previous blog entries, I shared my first (and very brief) impressions about recursion. Today, I would like to talk more about this concept which so far has been the most important topic in the entire course. 

When recursion was first introduced I did not realize to the full extent how significant it will be for this course. First, the idea of calling a function on itself seemed pretty odd to me, but with time and practice I came to a better understanding of how this process works. The exercises with the search trees helped to finally understand that recursion works by executing the main body of function if the stated condition is satisfied, and then coming back to the original state. It took me a lot of time to comprehend how the trees might be traversed with the help of recursion; however, writing functions for assignment 3 was very useful for getting the practice in creating the recursive calls. 

Still, I am not completely comfortable with applying recursion to all the problems I need to solve. It becomes very difficult for me to use it properly, when the recursive call should be used to create the new data structures, such as lists or dictionaries, or when I need to somehow keep the track of the recursion traversing the tree. It is also pretty difficult for me to figure out in which case I should apply recursion. At this moment, I am pretty sure that it is appropriate to use it when nested lists or trees are involved. However, it is not always easy for me to determine at what point in the program I should use the recursive call. For some time in the past, I have thought that the recursion executes only the part of the function that is written before the call. When at some point I realized that the part following the recursive call is also executed, it was a big surprise, which changed a lot of things for me. Nonetheless, it is not easy at times for me to think recursively. When I look at the search tree, in my mind I can automatically count nodes, leaves, and determine the paths from the root to the nodes. It is difficult for me at times to overcome this automaticity and start thinking about recursion processes happening in my cognition. Anyway, I try my best to understand how each function or method I write should work, and where recursion should be used.

As for comparing myself to others, I think that http://dogthatslogsthroughthefog.blogspot.ca/ is a really interesting blog, and the author writes about the course-related concepts much better than I do, but probably has the same problems with recursion.


Concluding this post, it’s worth saying that my understanding of the concept of recursion has improved during the course. However, I really wish I could get more practice with it and be able to appropriately apply it to programming problems.

Tuesday, 17 March 2015

Week 9 impressions

   The semester comes to an end, and I have less and less time to write posts for this blog. Last week in CSC148 was not easy for me. Term test was quite fair, although I couldn't remember what the tree tracing was about. Besides, it was pretty uncomfortable to call Danny every time I had minor questions about the test content.

   It was also quite inconvenient not to have labs for two weeks in a row, and although I try to catch up with the course, it is not easy. I am completely lost in lab#8 now. I am sure there is an easy way to write the code, but I have no idea, what I am supposed to do. Anyway, I really need to sleep now, maybe I'll have some really good ideas after this.


Tuesday, 10 March 2015

Week 8 impressions

   Another week has passed by, and I need to write another post. This week in class we learned about linked list structures. As it was already noted in the lecture linked lists have a lot in common with trees. However, in difference to trees linked lists can only have one node on them. I think the idea of reference between the nodes of the list can be very useful and important. It helps to connect otherwise unrelated data structures and use them as a whole. But although linked lists seem simple at first, it soon became clear to me that working with them requires not only thinking about the concept, but also a big deal of drawing pictures. Drawing schemes really helps when you start to create the code, because otherwise it is pretty easy to get lost in nodes and lose track of what the code is doing. When working on the lab exercises I realized how tricky these lists can be. Putting cur_node instead of cur_node.value has screwed up my entire work and cost me a lot of time to find and correct. Besides, the alternation between cur_node and prev_node in one of the functions was not easy to understand without a picture, however, I managed to figure it out once I've done the drawing.
 
   To conclude, I hope that with more practice I'll get better with writing methods and functions for the linked list structures. And  of course I hope that my second midterm will be at least as good as the first one.

 

Monday, 2 March 2015

Week 7 and assignment impressions

    As I have already written a post about object-oriented programming before the reading week, I will just share my impressions about the first week after the reading week. These days are quite busy for me, as I try to stay on top of all of my essays, assignments and midterms. However, I try my best to keep up with the course content and meet all the deadlines.
  
    This week in class we mostly discussed our second assignment and binary trees. I feel pretty confident with binary trees, and I think that the discussion of assignment helped me to get some insight into what I was supposed to do. Nonetheless, some things remain quite unclear. For instance, I still cannot get what the rough_outcome method in the TippyGameState class is supposed to do. Looking at its alternative in the subtract square game state I came to a conclusion that it's supposed to evaluate the outcome of yet unfinished game. The mechanism of work is pretty straightforward for subtract square, but things got really weird when I started to design it for tippy. To begin with, the only ultimately winning condition for the player I could think of, was an almost completed tippy. Of course, it was not easy to make computer find such a tippy on the board, and many lines of ugly code were created for this purpose. Another thing is that I couldn't make up any ultimately losing conditions, except for the one in which opponent has already formed a tippy, which is weird, as in this case game will be over. However, when I started implementing code for the strategy, I realized that, maybe, I should have implemented this function using some method which would list all possible outcomes of the game, and then evaluate this list to find rough outcome at certain point. On the other hand, it would have linked rough_outcome to the minimax strategy pretty tightly. 

   Another idea I struggle with while working on assignment is minimax strategy itself. It took me an entire day to get a slight idea of what should be happening in that piece of code. And when I finally found a way to make computer list all possible outcomes of a single move, it returned me an insanely nested list with, literally, thousands of items. It wouldn't be that bad (list was expected to be long and nested, as there are many possible outcomes of the game), if there was at least one -1.0 result on that list. Unfortunately, I could only see 1.0 and 0.0. Still, I guess, I need to improve that function or test it with more examples. Hopefully, I will eventually make it work and suggest_move will finally return the best possible move. 

   To conclude, most of this week was dedicated to writing an assignment, and I have a lot of impressions about it. I hope that I will manage to complete and submit it on time. Yet, I am feeling pretty insecure about this work.

Sunday, 15 February 2015

Object-Oriented Programming

This week I need to write a post about Object-Oriented Programming. Although I am not really sure what I should write about it, I will try to express here whatever I know about this paradigm. Object-Oriented  Programming is a concept in computer science that views computer program as a combination of data structures. So far in this course we have mostly worked with classes, their attributes and methods. 

In the first two weeks of the course we have studied the concept of inheritance which allowed us to create subclasses, and format or create in them new methods, which were not implemented in the super class. Basically, methods that are specific to a certain subclass, when written in a superclass, can only raise a “NotImplementedError”. This happens because super class does not contain methods for specific subclasses, but only indicates methods and attributes common to all the subclasses. When we write the subclass, the general information will be inherited from the super class, and we won’t need to implement this part of the code again. However, if we want to add some more specific methods to the subclass, we are free to do so without changing the super class. 

Designing classes and subclasses is not very difficult - you just need to know what is the purpose of your code, what it should do when executed, and which methods and attributes you will use for it. Also, making up proper names for your methods and writing clear docstrings can be very helpful. 


I had a couple of problems with with class design in the beginning of the course, but the first two labs and writing assignment were very helpful in clarifying these concepts.

Sunday, 8 February 2015

The new week has come to an end, and it is the time for a new blog entry. The last two weeks of my programming course have been mostly dedicated to the term test preparation. I’ve spent a big deal of time solving the additional lab exercises and going through all the lecture slides. Now I really hope that all my effort will eventually pay off. As for the test itself, I think that this midterm was well written and fair enough, albeit I felt a little short on time at the end, and the tables in the room were very unstable. I also cannot help wondering when we are supposed to complete test review exercise, that will give us a bonus mark for each test.

Another important thing that happened in this course during the last two weeks was the introduction of recursion. This seems as not very complicated concept, although pretty irritating when it comes to extremely nested lists. During our 3rd and 4th labs I have also discovered that putting recursion into the code can be a rather tricky task, demanding a big deal of intellectual effort. However, recursion is an important tool for creating an intricate code, and I hope that with the practice I will get used to applying recursion to program writing and my skills with this concept will somehow improve. In the meantime, I would rather get ready for another midterms and start looking forward for the reading week.