Thursday, January 23, 2014

Object-oriented programming

"Python is an object-oriented programming language, which means that it provides features that support object-oriented programming (OOP)." It is a good thing to know these basic knowledges of computer programming. Back in our csc108 class, we had a brief introduction to python programming, just like when we first learned a new subject. We directly learned through typing in the code, but never really discover the basic theory of programming. Remember when you first learned mathematics, people always started teaching you how to do the calculation instead asking you to prove anything. I truly believe that in the course, csc148, we will be learning programming through a more scientific way which makes us closer and closer to a real programmer. 
The first week's content was about an introduction about how python works as an object-oriented programming language. "In object-oriented programming the focus is on the creation of objects which contain both data and functionality together." We create objects by defining its class first. In my opinion, a class is like a name tag, that we assign things into categories with these name tags. By doing this, it will be more easier for programmers to modify or change anything later, since you can always call these names instead of looking through every line of codes. Objects, all that matter in a program, will be created by initializing them under a certain class. We can also add methods to improve the features of these objects. Although we had seen class and method before, this chapter really opens a new gate for me. 
One huge change from csc108 is definitely the writing style. In order to write like a real programmer, I think it is necessary to fellow the standard procedure of writing the code. For instance, we should no longer include the type contract in the dot string, instead, we can state them with the function header. Also, we need to pay attention to details in writing functions. 
During the second and third weeks' lectures, we went over more about defining class, especially two different kinds of data structure 'Stack' and 'Queue'. During the lab2, we discovered that 'Stack' takes far less time than 'Queue' when they process a large amount of data. That being said, 'Queue' can be improved. We were also introduced to a new concept called recursion, according to my understanding, is a way of writing a function that can call itself within that function. I was not very familiar with this concept, so that I need to do some more readings on it and try to build a couple examples of recursion function by myself. 

No comments:

Post a Comment