9.3. How Do You Create One?

Again, you will see varying locations for creating value objects, and you will also see varying names for the package that contains the value object classes. "Flex 3: Introducing Cairngorm" (cited in earlier chapters) creates in the valueObjects package, as shown in (Figure 9-1).

Figure 9.1. Figure 9-1

The Cairngorm store creates them in a vo package, as shown in (Figure 9-2).

Figure 9.2. Figure 9-2

The general naming convention is to prefix the letters VO with the name of the object represented.

Since implementing the IValueObject interface is optional, creating a value object is basically the same as creating any other class in Flex. After you have created the class, you simply add the public properties to it. If you are using the value object as a data transfer object, you need to make sure that these properties match the remote object to which they correspond.

Get Professional Cairngorm™ now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.