Sunday 13 October 2013

Recursion and Object Oriented Programming



This week was our first assignment submission. The assignment was quite challenging and also took a bit longer than expected. But it was fun. We worked in teams for the first time in this course. This helped me to make new friends as well as gain some teamwork skills. Other than that, all things are going pretty well. The exercises and labs are easy and interesting. They help us to keep a track of what we learn every week and ensure that we are able to implement those concepts properly. Another thing happening is the midterm, and thus will have to prepare for it also.

There are two topics that have to be discussed this week on the slog:

1) Recursion: Recursion is a process, in which a function is called inside its body,that is,while defining it. This allows us to break the problems into smaller,similar bits that are easier to solve, and then, their solutions can be applied to solve the larger and more complex cases. The most significant benefit of using it is reduction in redundancy of code. This not only helps to make the program shorter, but also reduces the time in writing as well as debugging it by us or anyone else. Moreover, the code sometimes becomes more efficient as well, like in the cases of nested lists and tree traversals.

2) Object Oriented Programming Object Oriented Programming is the method of programming that involves creating of classes that can instantiate objects, having some attributes and methods. The attributes can store some values related to the objects  and allow us to distinguish between objects of the same class by the difference in their attribute values. The methods are the behaviours of the object and allow us to do some tasks with it. The biggest advantage of Object Oriented programming is re-usability. The objects can used by anyone once they are created and one does not have to check for its proper implementation before using it. The encapsulation allows hiding certain parts of the objects, which prevents any undesirable tampering. Furthermore, the size of the code decreases as we don't need to write the functions every time we want to use them. This increases the efficiency and legibility of the code, and decreases the debugging time.

No comments:

Post a Comment