Sunday, 22 February 2015

Slog # 4: Object-Oriented Programming Concepts


Object-oriented programming in python involves the use of "classes" and "objects. This is a very important topic in computer science.


A Few Concepts: 

It is very important to understand the difference between a method and a function. A function is code that is called by it's name while a method is called by the name associated with object (usually self). "Self" is the basis of the object-oriented programming in python covered thus far.

Other important concepts include understanding the _init_ method. This is a special method which creates a new instance of the class. Another special method is _str_ which creates a printable string representation, while _repr_ creates a string representation that can be evaluated.


Overall, these are a few important concepts to understand in object-oriented programming in python.


Feel free to leave a comment.


Until next time, learn about yourSELF!

Monday, 9 February 2015

Slog # 3: Recursion

Recursion is an important topic in computer science. A function is RECURSIVE if it calls itself. A substitute for recursion when solving problems is using "looping" (iteration).

Why use RECURSION?

While recursion may appear mysterious at first, it is quite useful in computer science as it is concise and elegant whereas a solution involving iteration is complex and inelegant.


First steps with RECURSION:

To understand recursion, it is important to first learn to trace a recursive call. Trace a few examples with the smallest possible input. Once confident that recursion works for all problems of this size, it is best to check the next largest input. Confidence is key!
It is also important to consider "size". When tracing recursive calls, smaller code creates problems and it is important to study/examine this behavior.


Overall, recursion may take time to understand but examples will help with understanding greatly!


Feel free to leave a comment.

Until next time, will you believe? 

Monday, 2 February 2015

Slog # 2: Impressions

Time has flown by quickly and many topics have been covered. There has been a development in understanding classes - parent and child classes, self, the _init_ method, _str_ and _repr_ method. Parent and child classes led to discussion of inheritance. While understanding this material is essential, it makes more sense when used thus emphasizing the importance of PRACTICE! 

Practicing a number of times with various examples is when one can truly understand the meaning of these topics. Practice means, at least, close to perfect (understanding)!




Please feel free to leave a comment. 


Until next time, keep PRACTICING!