What would you call this object ?

Posted by jmls on 05-Apr-2010 14:26

I am creating a class (foo) for a single purpose - it contains only properties and is designed to be passed around as a parameter instead of a temp-table record or a buffer handle

Is there any special names for this kind of class ?

data.foo()

properties.foo()

wadaymachallit.foo()

Imsurehtatdrhurshwillhavesomecommenttomakeaboutthis.foo()

Julian

All Replies

Posted by Peter Judge on 05-Apr-2010 14:28

jmls wrote:

I am creating a class (foo) for a single purpose - it contains only properties and is designed to be passed around as a parameter instead of a temp-table record or a buffer handle

Is there any special names for this kind of class ?

data.foo()

properties.foo()

wadaymachallit.foo()

Imsurehtatdrhurshwillhavesomecommenttomakeaboutthis.foo()

Julian

What's common about the properties? That should be at least somewhat suggestive of a name.

And out of curiosity, how is it being passed (and where)?

-- peter

Posted by jmls on 05-Apr-2010 14:38

They are all related to a specific function. For example, the class below is used for answermachine records

USING Progress.Lang.*.

CLASS pbx.data.AnswerMachine:

  DEF PUBLIC PROPERTY MailBox AS INT NO-UNDO GET . SET .

  DEF PUBLIC PROPERTY MailboxName       AS CHAR NO-UNDO GET . SET .

  DEF PUBLIC PROPERTY AnswerMachineGUID AS CHAR NO-UNDO GET . SET .

  DEF PUBLIC PROPERTY EmailAddress      AS CHAR NO-UNDO GET . SET .

  DEF PUBLIC PROPERTY Password          AS CHAR NO-UNDO GET . SET .

END CLASS.

The phone system makes a request for answermachine data via webspeed - rather than the agent reading the database directly, it calls a method in a library and returns a class of "pbx.data.AnswerMachine", which the agent that interrogate the properties of and send back the relevant information,

This is a simplistic example (but, for example, email address may be generated from a set of business rules in the library method rather than a field in the AnswerMachine table)

/* webspeed agent */

....

DEF VAR Answer1 AS CLASS pbx.data.AnswerMachine NO-UNDO.

Answer1 = pbx.lib.AnswerMachine:Instance:Get(get-field("ANSWERMACHINEGUID")).

{&out} SUBSTITUTE("&1:&2",Answer1:MailboxName,Answer1:EmailAddress).

DELETE OBJECT Answer1.

...

Posted by Thomas Mercer-Hursh on 05-Apr-2010 14:47

An object with properties and no behavior is called a Value Object.

Posted by jmls on 05-Apr-2010 14:54

ah hah. Thanks.

What about if this class has either a getter on a property or a method that manipulates only the properties of said class ?

Posted by jmls on 05-Apr-2010 14:56
Posted by Thomas Mercer-Hursh on 05-Apr-2010 15:04

Yes

Posted by Thomas Mercer-Hursh on 05-Apr-2010 15:06

If you add behavior, it won't be a pure value object any more.  But, that doesn't mean that you can't have logic in properties, e.g., different properties for degrees or radians, computed from the same value.

Posted by jmls on 05-Apr-2010 15:07

OK! I officially lay claim to being the person that has produced the shortest ever response from Thomas

No-one can ever beat that - except a "No" I suppose ...

Posted by Thomas Mercer-Hursh on 05-Apr-2010 15:29

Don't forget that Tom B. has had a couple of completely blank replies recently ...

Posted by jmls on 05-Apr-2010 15:34

that only counts if you were genuinely speechless

Posted by Admin on 05-Apr-2010 15:36

Parameter object is also a common term.

This thread is closed