|
Overlooked concepts and mistakes
What follows are some concepts to keep in mind and mistakes to avoid while developing your GDMO. These are concepts
detailed in both X.720 and X.722.
Default Value Definitions
Defining default values to attributes is advantageous for several reasons. It reduces the amount of code necessary
by the manager to issue a create. It also leaves the values of some attributes to be determined later. Eventhough
GDMO specifies an ASN.1 methodology to use default values, many object modellers miss it.
This example will show a plausible, but incorrect way of modelling a default value:
DefaultPunchInTime ::= 19960101000000.0
DefaultNameString ::= ""
DefaultCounter ::= 0
PunchInTime ::= GeneralisedTimeString
FirstName ::= GraphicString
Couter ::= Integer
Now the way GDMO recommends defining default values:
DefaultPunchInTime ::= {none NULL}
DefaultNameString ::= {none NULL}
DefaultCounter ::= {notStarted NULL}
PunchInTime ::= CHOICE {
none NULL,
actual GeneralisedTimeString
}
FirstName ::= CHOICE {
none NULL,
name GraphicString
}
Counter ::= CHOICE {
notStarted NULL,
running Integer
}
Do you see the difference in the two approaches? Do you see why one approach is also easier to understand during
implementation by the programmers?
The difference in the two approaches is that one provides a bogus default value that has to be hard coded somewhere
during the programming effort. The first example does not accurately represent the attributes. The time example
does not represent the fact that when the object is created there is no punch in time available. Neither does it
represent that no first name has been provided. The second example provides explicit declarations that values have
not been provided.
The Counter example is diversly different in both examples. In the first example, a value of zero is the default
value but tells the user nothing about the state of the counter. This creates ambiguity about the value itself.
Certainly, a second attribute could be added that represents the state of the counter. The second example shows
how the state of the counter is represented at the same time as it's current value.
Naming
Descriptive names are predominant in GDMO. Sometimes, long drawn out names are used. Likewise, within the code,
programmers will duplicate the names. This provides a methodology of flipping from code to GDMO without any ambiguity.
One common complaint is the length of the names. Many people will start to model their objects with abbreviations.
This is not recommended. Abbreviations are subjective. Likewise, when people read your GDMO subjectiveness creates
confusion.
Remember too that your GDMO will most likely be read by an international community. What may seem to be an obvious
abbreviation to you will not seem so to someone whose native language is not English. Likewise, I try to encourage
the same effort of programmers to not abbreviate variable names in the code. If you are too lazy to type it out
then you probably should not be doing the work.
|