Tuesday, 15 October 2013

Object Oriented Programming and Recursion

OOP:

In class we learned about object oriented programming which essentially is a way of representing concepts as objects and then giving these created objects attributes. In my opinion this is useful in two ways one it allows us to represent objects in a very human way i.e. this is a car here are its attributes. And second it is useful to organize our concepts and reduce recursive code.

Recursion:

Recursion is essentially recalling the same method within the method. So instead of iterating over a loop you would call a function that then calls itself until certain parameters are met. I like this method of programming because it is a very human way of thinking about problems, however I understand that a lot of computer programmers are wary of efficiency problems. Our teacher has yet to give a satisfactory answer on how these problems can be overcome though he insures they can be.

Hello World!

I figured I should start my SLOG in the conventional way by welcoming you with one of the simplest programs ever. A program that almost every programmer has made at some point or another and that is the Hello World! program.

Since in the class I am writing this for we use python I'll write the code in that language below:

print('Hello World!')

Now here comes the interesting part that took me about 30 minutes to do, the reasoning is because in this class I am using python3 when I am used to python 2.7 where the code is:

print 'Hello World!'

Anyways welcome to my slog