Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Pages: [1]
Print
Author Topic: quick VO clarification  (Read 9618 times)
akastar
Newbie
*
Posts: 4


View Profile Email
« on: January 04, 2009, 04:31:27 »

is it good practice to expose a VO to a views?

i.e the proxy manager finds a userVO via some ID and passes that userVO to the View where the view can unpack the name and password etc or is it better that the proxy manager keeps everything on its side and keeps the VO away from the view and passes the name and password.

thanks
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 on: January 04, 2009, 11:54:11 »

Certainly do expose value objects to your view components. The primary benefit of a value object is to act as a data carrier to shuttle data across the tiers of your app.

The VO represents the domain model at its purest, client-side form. And the view has no other purpose than to expose this data to the user, and allow them to interact with and somtimes update it.

But while the view needs to know about the data, we are still trying to separate out our responsibilities into M,V & C tiers, each of which needs to understand the data without knowing too much about each other. So the VO can be thought of as the extend of their shared knowledge about the domain.

That said, obviously its a good thing to work out your  domain model first, since constant churn in VO definition can cause you to be changing code all over the app across all tiers. The domain model is a cross-cutting dependency that is impossible to minimize.

Hope this helps,
-=Cliff>
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #2 on: January 04, 2009, 11:56:19 »

Also, have a look at the Flex EmployeeAdmin demo for an example of how to use VOs (and Enums) in this way.

-=Cliff>
Logged
Pages: [1]
Print