2013年10月19日星期六

csc148_slog_oop

    In the first three weeks of the CSC148, we learned the basic ideas of the object-oriented-programming. Object-oriented programming is a programming paradigm which focuses on classes and objects rather than constructing programs in a bunch of functions and data. Class will have attributes(data) and methods(functions) inside it and object is the instance of class.
    Object-oriented programming is the mainstream of programming currently. I think one of the reason is that the prototype of OOP is from the real world. In real world, all the things can fall into many categories, and it's just the idea of class. In real world, all the things have both attributes and functionality(e.g. dogs have 4 feet, dogs can bark), that is the idea of attributes and methods.
    Another important concept of OOP is inheritence. It comes from the real world too.Typically, in the taxonomy of animals, we human not only has the attributes of primate, but also has the attributes of mammal. By saying primate is a subclass of mammal, we will certainly know that human has the attributes of mammal without indicating them. In OOP, inheritence will make the code more concise and reduce the duplicate.
    Above all, OOP can enhance the readability of the programs and makes it easier to construct programs. That's why it is useful for computer scientists.

没有评论:

发表评论