Monday, 6 April 2015

End Of Semester Thoughts

In this last SLOG I will be reflection on my experience taking CSC148.

CSC148 picked up right where CSC108 left off, classes. Our first lab was creating a class to handle race registry. However we started learning about inheritance soon after. Inheritance was an incredibly important concept that was used all throughout the course. In almost if not all lab exercises, assignments, term tests, had code that used inheritance. Our first assignment was an exercise in how to create generalized classes and then create specialized subclasses.

After inheritance we moved onto discussing recursion. Now while I have written about my dislike for recursion I do think it is a very important concept. My dislike for recursion doesn’t mean I don’t think we should learn it. When first learning about computer science it’s important to create a large toolbox. Variables and basic data structures are like your nails and screws, loops are your hammers, functions and classes are your saws and drills. Recursion is just another thing that you have to add to your toolbox.

I haven’t found anything this semester to be a conceptual hurdle however I did some technical challenges. I did find minimax to be a hurdle that was hard to jump over. I found it to be very difficult to understand how exactly the algorithm was supposed to work. This semester did consist of technical challenges. Every assignment had some bugs that were difficult to fix, the tests had some questions that were difficult to come up with a good solution.

I want to talk about this for a moment. It is actually very difficult to write a computer programming test. It is very easy to forget to initialize a variable or even something as simple as a bracket on paper. Writing code on a computer using an IDE such as wing will make it virtually impossible to make this mistake due to their “spellcheck”. To go along with having to make sure you don’t make a stupid mistake, we are now getting into more complicated topics. So now we have a set time limit to write more complicated code. Now that the concepts are more challenging it is becoming ever more challenging to walk through the code to check that it is working as you have anticipated.

The final thing I’m going to touch on are the computer labs. The computer labs were very helpful, they felt like what I wish PCRS, from CSC108, were. Small assignments which reinforced concepts that we were learning about in lectures aided in the understanding. However unfortunately the TA strike resulted in a cancellation of all the labs. The lab exercises were still posted on the course website but it didn’t feel as impactful as the initial labs we did have. It sucked to have the course affected in this way but there was nothing that could be done.

Overall my thoughts of this course are very neutral, I didn’t find it super engaging however I did find the technical challenges to be very rewarding once I solved them. I’m looking forward to continuing my studies in computer science.

Saturday, 28 March 2015

Revisiting recursion

This SLOG I’m going to revisit my thoughts on recursion. This SLOG might be a bit shorter because I might be rehashing some old ideas.

My previous thoughts on recursion were quite harsh. My main issues with it were that it's difficult to read, it's hard to create a mental image on how it works, and it is proving difficult to debug. I still agree with my main sentiment, recursion should be avoided whenever possible. However I have toned down my stance on the topic.
I originally found recursion difficult to read. I still 100% agree with this. Despite becoming incredibly familiar with recursive code I still find it a huge pain to read. I am definitely not alone with these thoughts, I have talked to classmates, upper years, as well as professional software developers. I found it incredibly interesting when one of the software developers were told me that recursion is usually frowned upon during most projects. When I asked why, he said that when new people are brought onto a team, recursive code can be very difficult for them to understand how the pre-existing code works.
My next point was that recursive code is difficult to visualize. A work around for this is drawing diagrams. While it is hard to visualize, even the most artistically challenged (AKA me) can draw a crude diagram that represents how an algorithm works. So I find this to be significantly less of an issue than I did previously
My last point was that recursive code is difficult to debug. My experience with minimax is first hand evidence with this. The most frustrated I have been all year was having to debug the minimax algorithm. The main difficulty with going through the code was that it hard to see exactly how the code was looping. With iteration it’s very easy to see how the program loops. With iteration it is usually much easier to see where the code is going to end. With recursion it is exceedingly difficult to see what the code is going to return.
Although I do have some apprehensive thoughts about recursion, I can see how it is very useful. As I’ve been working with recursive code more and more throughout the semester I have gotten more comfortable working with it. Recursion in some instances how for easier manipulation of abstract data structures such as binary trees, linked lists, and many others. So while I find it challenging to work with I do accept that it is needed.

Tuesday, 17 March 2015

Trials and Tribulations - Term Test 2

This past week we wrote our second midterm test, I am going to write about my thoughts of the test.

The test was composed of three questions, question one was regarding the possible height of binary trees. Question two was writing a function utilizing binary search trees with integer elements and returning a list of integers that are even and found between a given interval. The third question was to write a function using linked lists to remove the first occurrence of a node and adds it to the node following.

To prepare for this test I completed all the tutorial questions, I reviewed all my notes from class, and I experimented with the code written in class. I felt very comfortable with the concepts of recursion and binary trees. I had very few problems with writing code that traversed the branches and manipulated trees. Every problem I had was fixed with some deep breaths and some thinking.
However I was less comfortable with linked list. I understood how linked lists worked however I kept making mistakes when writing code. I tried to focus much of my studying on reviewing linked lists, however I never really felt comfortable with it.
I breezed through the first question, and quickly moved onto the second. The second question required some thinking and a bit of planning, but with some patience I found what I think is a very effective solution. Finally the third question. My unease with linked lists really effected my mentality with this question. I was really apprehensive with this question. I was unable to create a solution that I was happy with.
In the future I think I will try to prepare better for the final exam. I will try to ask my professor, a TA, my classmates, or even an upper year student for some clarification. Overall I think I did very well on this test, I am just a bit unhappy with how I did on the third question.


Thursday, 12 March 2015

Trials and tribulations - Assignment 2

Last week we finished assignment two, so this week I am going to write about my experience with working on it.

Assignment 2 was split into basically two problems, the game Tippy, and the strategy Minimax. Tippy was not exceedingly difficult. I found it mainly to be time consuming. I found that a little planning before starting allowed me to easily complete this part of the assignment. My main technical challenge with Tippy was figuring out the algorithm and writing code for determining who the winner was. I do not know why I found it difficult, even with drawing diagrams and visually solving it multiple times I couldn’t implement it. After a couple attempts I manage to successfully implement it.

The main technical challenge was implementing Minimax. I found the description given in class and found in the assignment handout to not be sufficient, so I had to do some research to fully understand how minimax works. I found this video,


to be extremely helpful. After watching this it took a little more reading, some discussion with some classmates, and some more views of the video until I fully understood how the algorithm was supposed to work. So now that I know what I’m trying to implement it was time to go into the planning stage. I drew diagrams, wrote some test code, and discussed the problem with a friend. After doing this I felt ready to start coding.
I wrote code which I thought it should in theory work, when I started to run some tests on it, not only did it return the wrong move, it went way too fast. Using some print statements I found that it was not traversing the tree correctly. After fixing this problem I ran it again, now it was running for the correct length of time, however it was still returning the wrong value. At least it was what I thought to be the wrong value. In tippy on a 3-by-3 board the middle position (1,1) in the strongest move. After a lot of time, testing and hair pulling I finally realized that my original algorithm needed some slight tweaking in order for it to work. Finally! I had it working. The elation I felt when all my test cases passed was such a relief!


Sunday, 8 March 2015

Object Orientated Programming (OOP)

I missed class last week due to feeling unwell so I'll discuss my experience with object orientated programming.

I first learned about object orientated programming when I first started to learn programming in high school. It was describe to me as the four pillars of object orientated programming; abstraction, encapsulation, inheritance, and polymorphism. While we haven't yet referred to object orientated programming as with respect to the "four pillars" we have at least briefly talked about them.

We have specifically talked about abstraction (abstract data types) and inheritance (subclass). We have sort of merged inheritance and polymorphism. Polymorphism is when a subclass can share functionality with it's parent class and also define functions of it's own. However but not vice versa. We have already exploited this multiple times without discussing it as it's own characteristic of OOP.

We have only very briefly and simplistically discussed encapsulation. The best way I can think to describe encapsulation is that your putting a "shell" around objects to simplify their uses. This shell separates, or encapsulates, objects, functions, and data from one another. One of the most, if not the most common uses of encapsulation is that of data hiding. Encapsulation does not mean data hiding, but it allows for it.

I think it's very important to talk about the four pillars of object orientated programming. When I was first learning about these "four pillars" I found it very difficult to wrap my head around. But as I gained more experience as a programmer it opened my eyes to how important these characteristics of OOP actually are.

Friday, 27 February 2015

Recursion and why I don't like it

Recursion is a computer programming technique that is very similar to dividing and conquering. By breaking down the problem into smaller and smaller problems recursion can be a very effective tool to solve problems. My main issues I have with recursion are that it's difficult to read, it's hard to create a mental image on how it works, and it is proving difficult to debug. I propose iteration should be used whenever possible.

When reviewing code that was written in lecture, code found online, and collaborating with friends it can be very difficult to fully understand how the program works. I think this is because with how the code is displayed. With iteration you can see exactly what the algorithm is looping over and what is happening in each loop. With recursion it is difficult to see when your loop is going to end.

My next point also goes in hand with my previous one, it is very difficult to create a mental of map of how a program is looping recursively. This may be a matter of familiarity but I personally find it insanely simpler to visualize a iteration.

When given buggy code that utilizes recursion it can be very challenging to find where exactly the problem is. With iteration debugging can be hard, but using breakpoints, tracking variables and other simplistic strategies, it is easier to find the exact where there's a problem.

I have also experienced and read about cases where recursive loops can spiral out of control. Eating up time and memory. While recursion in some instance maybe better in some instances, I think it's a safer strategy to use iteration where ever possible.

Thursday, 22 January 2015

Why Should Geeks Write?

Why should geeks write? Well why shouldn’t they? A quick google search of geek gives me the definition that’s geeks are people that are knowledgeable and obsessive enthusiasts. Shouldn’t that be the number one reason that they should write? They are passionate about a topic, whether its programing, math, chemistry, etc. They should try and share this knowledge with other people, they should try and share their passion with other people. Not only is it beneficial for their readers, but also beneficial for themselves. Writing is a form of expression, and sharing your passion with other people is a very enriching thing.