Standing on the shoulders (well, maybe feet) of giants
[ start | index | login or register ]
start > Value Object Collaborations

Value Object Collaborations

Created by Dirk Riehle. Last edited by Dirk Riehle, 2 years and 110 days ago. Viewed 152 times. #4
[diff] [history] [edit] [rdf]
labels
attachments
Superseded by Value Object Collaborations v2.

A client creates new Value instances. Necessary data for initialization is provided as part of the constructor call or through a special initialization protocol. No state-changing methods should be published to clients and be used by them, even if these methods are public.

A Value instance provides information to a client through read-only query methods (a.k.a. observer methods). For what would traditionally be state-changing methods, the value object creates a new instance of its class and initializes it with the data that represent the result of the computation the current method is supposed to carry out.

A client that calls a command method of a value object receives a new Value instance back; it typically drops the old value object and keeps computing with the new value. Most notably, if the value is stored in an attribute of the client, the client replaces the value object representing the attribute’s value with the new value object.

no comments | post comment
Copyright (©) 2006 by Dirk Riehle or the respective authors. All rights reserved.