Saturday, 1 March 2014

Towers of Hanoi

This week we went over the concept behind the Towers of Hanoi. The only back ground information I have on them is the version of the puzzle I played as a kid. The most efficient number of moves was definitely not the main goal - instead simply moving all the rings was the objective. 
With more of an in depth look at them, concept behind the Towers of Hanoi to be really interesting.  It is one big logic puzzle, very similar to programming.It also reminds me of programming in the sense that you are trying to complete the given problem in the most efficient way (i.e.: least amount of code) and in the least amount of time (similarly to how programmers want to run the most efficient code). 

I took the time to read up on the background of the Tower of Hanoi puzzle. The most basic way to solve the puzzle requires 2^(n-1) moves, n being the number of rings. This how ever does not provide the most efficient way to move the rings. The most interesting part is that there is no actual formula to provide the most efficient way to move all the rings. 
There are Ph.d level scholar articles written about proving the most efficient way to move the rings. It will be interesting to see how completing this assignment will give me more insight in regards to the Tower of Hanoi. 



Friday, 28 February 2014

PostingError

A little late, but I guess late is better than never! This blog covers material covered during week #4, which is the week that we had Exercise #2 due. 

I found this exercise easy enough... or at least part 1. That part of the code ran first shot - how ever problems arose when I tried implementing the second part. For some reason, it would run for me when I tried it in the python shell yet it failed the majority of the auto-testers. I know my error was in the way I implemented the return statement and how it caught the wrong exception due to the inheritance of other Exceptions.  Time to read up on inheritance... 

Thursday, 23 January 2014

Object-oriented programming! (creative title to come)

Welcome back!

So here is the first academic blog of the semester. This one requires us to mention the concept of object-oriented programming so here it goes:

Object-oriented programming is a new concept to me. Through research I have discovered that it is in many ways an extension, or modification, of older programming techniques such as structured programming and abstract data types. It carries over many similarities – and in some cases inherits the same characteristics.

Where it differs is in the actual format of the program. Objected-oriented programs organize their code and data around one central unit, otherwise known as an ‘object’. These objects, or classes, provide a template for programmers to add code which can modify the data in a clear, organized fashion. Code which modifies data, or performs a required task is called a method. 


 I enjoy working with Python, an objected-oriented programming, because it allows for a visually clear and organized way to program. I find it easy to logically follow the concept of a class. Take, for example, the concept of a class food; Vegetables would be a subclass of food, on which we could employ various methods such as cooking, eating, preparing etc.  In many ways, such as the example above, it allows programmers to consider objects as they would in the real world; making it simpler and more straightforward to implement new methods and functions within the given object much as they would in real life.  

Object- oriented programming, like most programs provides both positive and negative aspects to the programmer. If the good outweighs the bad is something, I believe, is based off personal preference and experience. Then again, I am not familiar with other programming styles, making me biased towards this one.  Who knows, maybe one day I will learn to program in a different style and look back at this blog and wonder why I ever enjoyed programming in Python.

Hey - the awkward first post

Good afternoon!

I figured I needed a first post.. although I wasn't sure what to write in it. So here goes nothing! 

As someone who did not really enjoy CSC108 last semester, I am pleasantly surprised by how much I am currently enjoying this class. To say programming doesn’t come easily to me would be an understatement. The computer labs in the Bahen center became my home last semester – whenever we had assignments due I would literally camp out!

I walked in to my first two labs of this semester dreading them – and found myself enjoying the challenge they presented. As an added bonus I also managed to code a working program both times in the allotted two hour time slot. Yay!

Part of course requires us to keep a blog going about our thoughts and ideas about different topics pertaining to the material covered.  That part starts in the next post!