Normally when declare a class type data member in class or when we pass parameters to a method, we assume only one possible use case of this. That is this class need some DATA it is managed like this i.e. by parameter or by declaring it as the data member. We completely ignore the BEHAVIORAL part of the object. These object are not only the DATA CONTAINERS but they carry BEHAVIOR as well. For example we can do following things with an object other then DATA
1. Receiver object can call the methods of passed object.
2. Receiver object can send method of passed object as parameter it own method or to any other object
3. Receiver object itself can subscribe one or more events of passed object and attach its event handlers to them.
4. Receiver object can make other objects to subscribe one or more events of passed and attach their event handlers them.
5. Receiver object can raise one or more events of passed object and cause functionality to be executed in all its subscribers.
6. Passed object can consume receiver’s method as parameter to its own method or it can be passed to any other object’s method as parameter
7. Passed object can subscribe one or more events of the receiver and attach its events handlers to it.
8. There can be a complete Zig-Zag between the Passed object and Receiver object. Receiver already has the reference of the Passed object, Passed object know about the Receiver by using the THIS keyword.
9. There is always a Main program or Start up module that composes the object graph properly and wires the events among the object and inject the dependencies. The resultant object graph is the SOFTWARE that exhibit the required functionality or behavior. This object graph can be expanded by the lazy load technique. The entire object graph should not eager loaded at the start up. It makes the bulky application that takes too many spaces in memory. Also not needed functionality should be eliminated from the object graph.
10. If an object implements 5 interfaces, then it means that object has 5 different VIEWS or WINDOWS by which its data and functionality can be exposed. Or we can say, object has 5 faces or face-lets by which it can expose its functionality. This is the one use of interface. Implementing the interface means, object can be seen like that. We can hide the show the particular sub set of data and functionality by using a particular Interface.
No comments:
Post a Comment