Today, I begin my journey into a land I nor any of my family has ever ventured. The land of CSC148. I saw the citygates of this land at a distance 3 years ago when I stayed in the land of CSC108 but my stay was a rough and bumpy one. I was young, I was not the Sir P.Jiggly I am today and I could not appreciate all the beauty and wonders it had to offer nor did I particularly care. Ah, the days of my youth. What had occured? What tales did I learn? It is so blurry I cannot remember the events that had happened.
I hope to make this journey a memorable one.The land is ruled by a King named Heap. He is a powerful man but I have heard he is also just.
I have heard strange and scary tales about this land by my brethren that have visited. Some went and returned changed. For then better , but sometimes for the worse. Some visited for a few days but quickly fled to CSC108 while the others ran like mad-men from the land of CSC forever, always looking behind their shoulders . They swear they are chased by some loop demon that will never leave them be.
Am I frightened? Yes of course. But I am also very excited. Let's see what becomes of me at the end of this journey.
Sir P. Jiggly
Monday, 14 October 2013
Recursion
Today's post is on recursion! This was a mind screw for me at first but now I get the concept(and the coding!) In Python recursion involves a function calling itself. Like while or for loops, recursion can be controlled.
Recursive functions can accomplish the same things as loops. They require more memory and are less efficient in a lot of cases. Then why learn / use them in the first place right? There ARE some cases when these functions are in fact appropriate and more effiencient. When solving complex problems, a recursive functions can break down the steps in to smaller more manageable ones(less mind screwing) and make it easier and simpler code.
P.Jiggly
Recursive functions can accomplish the same things as loops. They require more memory and are less efficient in a lot of cases. Then why learn / use them in the first place right? There ARE some cases when these functions are in fact appropriate and more effiencient. When solving complex problems, a recursive functions can break down the steps in to smaller more manageable ones(less mind screwing) and make it easier and simpler code.
P.Jiggly
Object-Oriented Programming
This post is on object -oriented programming. The previously learned way of program invloving procedures or functions is called procedural programming.Object-oriented programming is a way of programming that is centred on creating objects. All objects have data inside them called attributes and procedures of functions called methods. A class is a collection of objects with similar attributes and fuctions. In Python, an objects attributes and methods are specified by a class. Therefore, a class can also be seen as a model or blue-print for creating that object.
Object-oriented is more efficient than procedural programming. It makes it easier to add or modify functions by simply storing them in a class(instead of having to rewrite all your code!)
P.Jiggly
Object-oriented is more efficient than procedural programming. It makes it easier to add or modify functions by simply storing them in a class(instead of having to rewrite all your code!)
P.Jiggly
Subscribe to:
Posts (Atom)