Objects, Roles, Responsibilities, and Collaboration




Paint by Numbers Coffee Clown




Buy at AllPosters.com




My daughter loves to watch Christmas movies not only in Christmas season but the whole year long. I remember one movie she has watched a lot of times (because it is funny) is about a man chosen to be Santa Clause after the other Santa fell down from his roof. The movie was certainly very funny and we were laughing all the time when we watched it. When I am considering Object-Oriented (OO) programming, I am thinking about the movie and the role Santa Clause who plays in Christmas. Almost everybody loves Santa in Christmas because he delivers gifts, happiness, and hope to us. According to the movie, if one Santa falls, another one comes to play. I think this is really wonderful.

In Object-Oriented programming, a program is a collection of interacting objects. A software application behaves and implements responsibilities. Objects in the application plays roles, performing corresponding responsibilities. For example, if we reinvent the North Pole machinery, we will have roles of Santa Clause, elves, and reindeers, etc.. Every role has a certain set of responsibilities to carry out. And every machinery object fulfills one or two roles. If two objects can play a same role, such as Santa Clause, the two objects can replace each other in the application. (If Rudolph the red-nosed reindeer caught cold, Ruby the other reindeer could take his position.) The objects are collaborating in the application just like in the North Pole the objects who play roles such as Santa, elves, and reindeers collaborate to make sure they take care of every kid in the whole world.



" The object has three properties, which makes it a simple, yet powerful model building block. It has state so it can model memory. It has behavior, so that it can model dynamic processes. And it is encapsulated, so that it can hide complexity. "

Comments

Popular posts from this blog

25 Google Interview Questions

Convert LaTeX to HTML

Art of Software Development