3 Replies Latest reply on Jan 25, 2009 8:55 PM by erikcw

    Are there any shortcuts for creating Value Object Classes?

    erikcw
      Hi,

      I'm using a Remote Object to connect to my server (pyAMF/Django). I'm getting stuck with the creation of Value Object Classes. It doesn't seem very DRY to have a class on my server representing the data model and then have to recreate that class and all its properties in my Flex app.

      Are there any shortcuts for creating client side VOs from server side data?

      I was thinking about declaring an empty VO class in Flex, and then dynamically assigning/casting my Proxy object to that class. It seems like that approach may cause problems for the Flex compiler though.

      Any hints?

      Thanks!
        • 1. Re: Are there any shortcuts for creating Value Object Classes?
          *gsb* Level 1
          In its simplest form, a Value Object is but that... an Object.
          I do not know the full form of your data, but the transferred remote object could be considered your VO, no?

          • 2. Re: Are there any shortcuts for creating Value Object Classes?
            tptackab
            Oh man, do I feel your pain. I'm not sure what middle-tier technology you're using, but I'm using Java (w/Spring) and I absolutely hate having to create and maintain two sets of VO (aka data transfer - DTO) object for Java and Flex.

            One thing that has helped me in that area is a free tool from Farata Systems called DTO2Fx. If you're using Java and Eclipse, it's a great time saver. You simply install a (very lightweight) Eclipse plugin, add a single annotation to your Java VO classes, and it automatically generates your Flex VOs. It even creates a base and extended version of each VO on the AS3 side so you can add code to the extended VO without fear of having your changes overwritten when it regenerates your Flex VOs.

            Here's a like to thier PDF that gives instructions and a download link. I had it up and running in my application in less than 30 minutes!
            • 3. Re: Are there any shortcuts for creating Value Object Classes?
              erikcw Level 1
              quote:

              Originally posted by: tptackab
              Oh man, do I feel your pain. I'm not sure what middle-tier technology you're using, but I'm using Java (w/Spring) and I absolutely hate having to create and maintain two sets of VO (aka data transfer - DTO) object for Java and Flex.

              One thing that has helped me in that area is a free tool from Farata Systems called DTO2Fx. If you're using Java and Eclipse, it's a great time saver. You simply install a (very lightweight) Eclipse plugin, add a single annotation to your Java VO classes, and it automatically generates your Flex VOs. It even creates a base and extended version of each VO on the AS3 side so you can add code to the extended VO without fear of having your changes overwritten when it regenerates your Flex VOs.

              Here's a like to thier PDF that gives instructions and a download link. I had it up and running in my application in less than 30 minutes!


              I'm using Python/Django serverside (PYAMF is my AMF serializer).