Five ‘s Weblog

October 19, 2007

What is real object-oriented?

Filed under: Five's thought — by powerdream5 @ 9:19 pm
Tags: , ,

       From the first time I touched C++ (although C++ is not considered a pure OOP language), I have studied OOP language for more than 4 years. But one question has beed confusing me. What is real object-oriented? Sometimes, it seems that I get the answer, but sometiems, I lost myself again.

10_19_2_2007.jpg

     When I started learning OOP language, I compared it with C. Because OOP language has classes and C dones’t have. Therefore, I thought that this character is the biggest difference which can help me distinguish OOP language and NO-OOP language. It is obvious that I made a mistake. I just focused on the differences of appearance between OOP and NO-OOP. In fact, there are a lot of programmer who code in procedure-oriented way when they are using OOP language. I don’t want to deny I am one of them.

       Along with getting more knowledge about OOP, I had to change my opinions about it. It is well known that inheritence, polymorphism and encapsulation are the basics of the OOP. Design patterns take fully adavantage of these merits of OOP language. Therefore, I thought the essence of OOP is applying the characteristics to programming(designing and coding).

       I believed I was right until I heard about anemia model. We can use all kinds of design patterns to realize the business logic, but the persistence classes, which are pojo(plain and old java object), just have a series of properties and pairs of gettter and setter method. According to Martin Flower, Anemia model is based on transaction script(procedure-oriented), because we separate the behaviors and properties of a object. In contrast, we need to combine the behaviors and properties of a object into a class in the OOP world.

      Therefore, I still have no answer to the question that what is real object_oriented. Perhaps I will not get the answer until I stop programming, because I don’t care about the answer any more at that time!

10_19_1_2007.jpg

Advertisements

Create a free website or blog at WordPress.com.