Thursday, 5 December 2013

OBJECT MODEL COMPONENTS PART 2

Attribute:

An attribute is a data value held by objects in a class. Each attribute has a 
value for each object instance. This value should be a pure data value, not an 
object. Attributes are listed in the second part of the class box. Attributes may 
or may not be shown; it depends on the level of detail desired. Each attribute 
name may be followed by the optional details such as type and default value. 
An object model should generally distinguish independent base attributes 
from dependent derived attributes. A derived attribute is that which is derived 
from other attributes. For example, age is a derived attribute, as it can be 
derived from date-of-birth and current-date attributes. 

operation

An operation is a function or transformation that may be applied to or by 
objects in a class. Operations are listed in the third part of the class box. 
Operations may or may not be shown; it depends on the level of detail 
desired. Each operation may be followed by optional details such as argument 
list and result type. The name and type of each argument may be given. An 
empty argument list in parentheses shows explicitly that there are no 
arguments. All objects in a class share the same operations. Each operation 
has a target object as an implicit argument. An operation may have 
arguments in addition to its target object, which parameterize the operation. 
The behavior of the operation depends on the class of its target. 
The same operation may be defined for several different classes. However, the
signature (i.e. output type and formal parameter list) must be the same

polymorphism 

An operation may be polymorphic in nature. A polymorphic operation means 
that the same operation takes on different forms in different/same classes. 
Overloading of operators, overloading of functions and overriding of functions 
provided by object-oriented programming languages are all examples of 
polymorphic operations. A method is the implementation of an operation for a 
class. The method depends only on the class of the target object. 


Share it Please

0 comments:

Post a Comment

Copyright @ 2013 Learn About Computers and Programming. Designed by Templateism | Love for The Globe Press