The topics this week are Object-Oriented
Programming and Recursion.
Object-Oriented Programming is when one programs code, using objects. Object-Oriented Programming is very useful for computer scientists since it allows for the programmer to use past methods or functions, and implement them into new code. I other words, by using objects, computer programmers can avoid repetition in their code since they can use their previous work to create new functions. I find using objects in code to be very helpful.
Now recursion is something new to me. I can
define recursion to be when a function calls itself, which can be quite
confusing. It took me awhile to wrap my brain around this idea and I am still
not confident about my knowledge on the subject. Recursion can be useful when
solving a very long problem since it breaks down the problem into smaller
pieces that are easier to solve, then puts them together to solve the overall
problem.
My standard, pious, advice for understanding recursion is to first trace it for a base case (no recursion involved). Then the next more complicated case, which probably has a recursive call involving a base case --- treat that call as "solved". Then a slightly more complicated case that involves sub-calls to already solved cases. After a while the meaning of the code becomes a bit more intuitive.
ReplyDeleteThat is a very helpful explanation. I feel as though recursion is becoming more familiar to me now.
ReplyDeleteThanks!
Something to think about, Alessandra: what are the disadvantages of OOP? Can you think of problems that you rather implement in a different paradigm than OOP?
ReplyDeleteI guess that a disadvantage of OOP is that since OOP can be very large, they are also much slower than other types of programs, since there are more lines of code to be executed. As for an example of a problem that I'd rather implement in a different paradigm, I simply do not know. My first experience with programming was CSC108, so I have only ever used python, and I have no knowledge of any other paradigm other than OOP.
ReplyDelete