[flexcoders] Re: Value Objects
Just realized I replied with the wrong subject line. Here is my reply: Tim Rowe wrote: The use of 'VO's in Flex has always confused me, largely because as everyone I've spoken to has explained it, all a 'Value' object is is just a Model object - therefore WTF are they being referred to as 'VO's when 'Object' (or Model object) would suffice. Tim, I have always thought of a model and a VO or DTO differently. I think this is a good quick explanation: http://en.wikipedia.org/wiki/Data_Transfer_Object From an MVC perspective, I think a model class contains information sure, but it can and often does contain methods to run logic on data, to retrieve data, to broadcast that data is ready or changed, etc. A Value Object (VO) or Data Transfer Object (DTO) (two terms for the same thing, I usually call them VOs because you don't always transfer them per se) are simple classes that only contain properties that can be get and/or set. They do not contain methods, constructors, or any other form of logic. They are dumb in a sense, only serving as information repositories. There is good logic in this I think. I use them all the time. And I don't think they are only for moving data around in, they are useful in single session storing of information. So often a model contains references to (say in as a property which could be the VO directly or several in an Array or ArrayCollection) and also may change data within VOs, as well as broadcast when something changes. That's my perspective anyway. Jason Merrill Bank of AmericaGlobal Learning Shared Services Solutions Development Monthly meetings on the Adobe Flash platform for rich media experiences - join the Bank of America Flash Platform Community
[flexcoders] Re: Value Objects
Ironically upon reluctantly plunging back online today in a quest for VO understanding I came across this post: http://www.advantexllc.com/blog/post.cfm/how-oo-almost-destroyed-my-business Now let me first SHOUT a sincere thankyou to all community members who contribute their expertise to these forums. Second I want to stress my frustration is similar to the above poster in the requirement to learn so extensively at the expense of getting things done. That said, even my limited experience in HTML revealed the need of big apps such as the one I am attempting to have an architecture. So, rather than continuing to understand VOs as a building block toward implementing an architecture I've decided to tepidly take on one of Cairngorm/MVC/Swiz -- actually Mate is the leader after the first hour of reading fwiw. Yet (in no small part because the decision above could be a blind alley) I would appreciate continued feedback on a few conclusions I set out below (hopefully) for the benefit of future readers. 1.) MVC needs to be understood in the context that all three building blocks of a web app (Database -- WebServer/CF -- Frontend/Flex) might each contain some of all three MVC aspects (ie model exists both on View and obviously at dbase). Hence for example a CF architecture like cfonwheels is potentially both supplementary to and redundant to a flex architecture. Similar assertions apply to my intention to push (some) business logic past from CF into MySql Stored Procedures. For better or worse though, many existing architectures focus solely on their layer (DB/WebServer/View). 2.) Implementing any architecture infers learning and then working with a great deal of other peoples sometimes poorly documented code. Yet this to an extent is not that different from using say MXML -- which I probably am semantically wrong to say but is arguably an architecture itself. Regardless, architectures add overhead to non-large apps (presumably there is an economy of scale effect). 3.) Boiling everything down, the need is to manage DBase -- View interactions. JSP/CF can assign properties to DB elements which Flex/AS can map to for increased efficiencies. Cost/Benefit of CF included, are JSP a more programmically straightforward option?? As always, thanks in advance.
Re: [flexcoders] Re: Value Objects
At 03:49 PM 5/28/2009, you wrote: 3.) Boiling everything down, the need is to manage DBase -- View interactions. JSP/CF can assign properties to DB elements which Flex/AS can map to for increased efficiencies. Cost/Benefit of CF included, are JSP a more programmically straightforward option?? Being relatively new to Flex, I'm probably not qualified to answer this question, but in my (admittedly limited) experience, I've found CF to be the more straightforward approach, albeit the more expensive one, when compared to JSP. FlexBuilder just makes it so easy (especially with the CFEclipse add-on) to work with your CF server-side stuff at the same time you're coding in Flex. And the CF-wizards that are included with FlexBuilder are so easy to use -- only a few clicks to create the CF VO to go with your Action-Script VO, with minimal changes needed in the wizard-generated CF code to make it work. I just find woking with CF to be a ton easier than working with JSP, I guess is what I'm trying to say. FlexBuilder was created by Adobe, so they're probably biased towards CF, which is probably why working with CF within FlexBuilder is easier out-of-the-box. But it works well for me. Just a newbie's $0.02 worth. Laurence MacNeill Mableton, Georgia, USA
[flexcoders] Re: Value Objects
Partly this reads like a troll, but assuming this is genuine, this is how I read your question below (and obviously I could be wrong): Gee, I've come from a background of building houses. I'm trying to learn this stuff you all use to build tall buildings. What is the advantage of all that stuff? I never had to do that to build a house and it is pissing me off... Your right, you don't need to use DTOs/VOs to build a house. If you only need/want to keep building houses don't use them. If you need/want to build scalable, distributed systems, then I'd suggest you keep asking questions, but maybe switch your tone a bit --- In flexcoders@yahoogroups.com, mikeashields mikeashie...@... wrote: Yes, the nomenclature is disconcerting. I reviewed your link however am unfamiliar with java/jsp and thus couldn't necessarily follow. Nonetheless it seemed to say that mapping flex properties to the database properties (returned via jsp/cfusion) offers various advantages -- mostly related to strict typing. Fair enough, but insofar as by using Stored Procedures I (think I) am able to push a great deal of the BizLogic/ControllerLayer right to the database (ie NOT the cfusion or even Flex/ViewLayer), what the hell do I care??? I'm so newbie that I hesitate to presume/assert anything but A.) this VO stuff is really boggling/pissing me off and B.) isn't it an imposition to make the view/Flex process/organize the returned data? Why not just throw results into sharedObjects (aka Flash cookies) on the hard drive? Maybe I'm missing something . . .
[flexcoders] Re: Value Objects
good point
[flexcoders] Re: Value Objects
eepers! I will give you that the houses/building analogy is correct though in defense of my perhaps indefensible tone, I honestly can't believe the difficulty I am having trying to pick up the concepts from existing materials. IMHO there seems to be only house-builders or skyscraper architects -- with a dirth of construction foremen able to explain exactly where to put/attach the iron scaffolding. Rather than continuing the analogy I'm going to look for a(nother) tall building . . . . --- In flexcoders@yahoogroups.com, jgamacheteam345 jgama...@... wrote: Partly this reads like a troll, but assuming this is genuine, this is how I read your question below (and obviously I could be wrong): Gee, I've come from a background of building houses. I'm trying to learn this stuff you all use to build tall buildings. What is the advantage of all that stuff? I never had to do that to build a house and it is pissing me off... Your right, you don't need to use DTOs/VOs to build a house. If you only need/want to keep building houses don't use them. If you need/want to build scalable, distributed systems, then I'd suggest you keep asking questions, but maybe switch your tone a bit --- In flexcoders@yahoogroups.com, mikeashields mikeashields@ wrote: Yes, the nomenclature is disconcerting. I reviewed your link however am unfamiliar with java/jsp and thus couldn't necessarily follow. Nonetheless it seemed to say that mapping flex properties to the database properties (returned via jsp/cfusion) offers various advantages -- mostly related to strict typing. Fair enough, but insofar as by using Stored Procedures I (think I) am able to push a great deal of the BizLogic/ControllerLayer right to the database (ie NOT the cfusion or even Flex/ViewLayer), what the hell do I care??? I'm so newbie that I hesitate to presume/assert anything but A.) this VO stuff is really boggling/pissing me off and B.) isn't it an imposition to make the view/Flex process/organize the returned data? Why not just throw results into sharedObjects (aka Flash cookies) on the hard drive? Maybe I'm missing something . . .
[flexcoders] Re: Value Objects
Yes, the nomenclature is disconcerting. I reviewed your link however am unfamiliar with java/jsp and thus couldn't necessarily follow. Nonetheless it seemed to say that mapping flex properties to the database properties (returned via jsp/cfusion) offers various advantages -- mostly related to strict typing. Fair enough, but insofar as by using Stored Procedures I (think I) am able to push a great deal of the BizLogic/ControllerLayer right to the database (ie NOT the cfusion or even Flex/ViewLayer), what the hell do I care??? I'm so newbie that I hesitate to presume/assert anything but A.) this VO stuff is really boggling/pissing me off and B.) isn't it an imposition to make the view/Flex process/organize the returned data? Why not just throw results into sharedObjects (aka Flash cookies) on the hard drive? Maybe I'm missing something . . .
[flexcoders] Re: Value objects
Hi Abdul, One more thing I had noticed that the private variables with getter and setter methods run fine with Java. What I understood is that for Java the flash gateway calls the get/set method and return the object. Is this a problem with gateway for CF? Thanks, Deepak --- In flexcoders@yahoogroups.com, Abdul Qabiz [EMAIL PROTECTED] wrote: Well, I don't see anything you are doing in getters/setters except setting values. I know, if you are a OO purist then you might want to have getters/setters everywhere. For me, it makes sense wherever it is required, f.ex. where you want to validate the data before setting it or returing it. In case of ValueObject, we generally don't have a much business-logic inside them, so getters/setters dont make much sense. -abdul From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of deepu_verma Sent: Wednesday, January 25, 2006 1:46 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: Value objects Thanks for the Reply But don't you think by declaring the variables as public we are defeating the object encapsulation concept. And moreover then there would be no need to define the getter and setter methods for the class. Thanks and Regards dv --- In flexcoders@yahoogroups.com, Abdul Qabiz [EMAIL PROTECTED] wrote: Hi, There are two things:- * I think, variables in actionscript should be in captial-case because the Coldfusion remoting adapter sends all variables in capital case. * Second, though I am not sure, variables in actionscript should be public. Use the following code and let us know if it works. -abdul import org.nevis.cairngorm.vo.ValueObject; class com.macromedia.webreqapp.vo.UserVO implements ValueObject { public static var registered:Boolean = Object.registerClass(webreqapp.webrequest.vo.user, com.macromedia.webreqapp.vo.UserVO ); public function setUserID(userID:Number):Void { this.USERID = userID; } public function getUserID():Number { return USERID } public function setName(name:String):Void { this.NAME = NAME; } public function getName():String { return NAME; } public function setEmail(email:String):Void { this.EMAIL = email; } public function getEmail():String { return EMAIL; } public function setPassword(password:String):Void { this.PASSWORD = password; } public function getPassword():String { return PASSWORD; } public function setRole(role:String):Void { this.ROLE = role; } public function getRole():String { return ROLE; } public var USERID:Number; public var NAME:String; public var EMAIL:String; public var PASSWORD:String; public var ROLE:String; } From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of deepu_verma Sent: Tuesday, January 24, 2006 5:58 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Value objects I am stuck up with how to map VO between flex and Coldfusion My AS class is import org.nevis.cairngorm.vo.ValueObject; class com.macromedia.webreqapp.vo.UserVO implements ValueObject { public static var registered:Boolean = Object.registerClass(webreqapp.webrequest.vo.user, com.macromedia.webreqapp.vo.UserVO ); public function setUserID(userID:Number):Void { this.userID = userID; } public function getUserID(Void):Number { return userID } public function setName(name:String):Void { this.name = name; } public function getName(Void):String { return name; } public function setEmail(email:String):Void { this.email = email; } public function getEmail(Void):String { return email; } public function setPassword(password:String):Void { this.password = password; } public function getPassword(Void):String { return password; } public function setRole(role:String):Void { this.role = role; } public function getRole(Void):String { return role; } private var userID:Number; private var name:String; public var email:String
[flexcoders] Re: Value objects
Thanks for the Reply But don't you think by declaring the variables as public we are defeating the object encapsulation concept. And moreover then there would be no need to define the getter and setter methods for the class. Thanks and Regards dv --- In flexcoders@yahoogroups.com, Abdul Qabiz [EMAIL PROTECTED] wrote: Hi, There are two things:- * I think, variables in actionscript should be in captial-case because the Coldfusion remoting adapter sends all variables in capital case. * Second, though I am not sure, variables in actionscript should be public. Use the following code and let us know if it works. -abdul import org.nevis.cairngorm.vo.ValueObject; class com.macromedia.webreqapp.vo.UserVO implements ValueObject { public static var registered:Boolean = Object.registerClass(webreqapp.webrequest.vo.user, com.macromedia.webreqapp.vo.UserVO ); public function setUserID(userID:Number):Void { this.USERID = userID; } public function getUserID():Number { return USERID } public function setName(name:String):Void { this.NAME = NAME; } public function getName():String { return NAME; } public function setEmail(email:String):Void { this.EMAIL = email; } public function getEmail():String { return EMAIL; } public function setPassword(password:String):Void { this.PASSWORD = password; } public function getPassword():String { return PASSWORD; } public function setRole(role:String):Void { this.ROLE = role; } public function getRole():String { return ROLE; } public var USERID:Number; public var NAME:String; public var EMAIL:String; public var PASSWORD:String; public var ROLE:String; } From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of deepu_verma Sent: Tuesday, January 24, 2006 5:58 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Value objects I am stuck up with how to map VO between flex and Coldfusion My AS class is import org.nevis.cairngorm.vo.ValueObject; class com.macromedia.webreqapp.vo.UserVO implements ValueObject { public static var registered:Boolean = Object.registerClass(webreqapp.webrequest.vo.user, com.macromedia.webreqapp.vo.UserVO ); public function setUserID(userID:Number):Void { this.userID = userID; } public function getUserID(Void):Number { return userID } public function setName(name:String):Void { this.name = name; } public function getName(Void):String { return name; } public function setEmail(email:String):Void { this.email = email; } public function getEmail(Void):String { return email; } public function setPassword(password:String):Void { this.password = password; } public function getPassword(Void):String { return password; } public function setRole(role:String):Void { this.role = role; } public function getRole(Void):String { return role; } private var userID:Number; private var name:String; public var email:String; private var password:String; private var role:String; } My coldfusion code is cffunction name=signin access=remote cfargument name=user type=any required=yes cfobject type=JAVA class=flashgateway.io.ASObject name=myclass action=CREATE cfset myObj = myclass.init() cfset myobj.setType(com.macromedia.webreqapp.vo.UserVO) cfset myobj.put(email, test) cfset myobj.put(password, test) cfreturn myobj /cffunction How will the returned data from CF be automatically mapped to the flash VO. Any help is greatly appreciated Thanks Deepak -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com SPONSORED LINKS Web site design development http://groups.yahoo.com/gads?t=msk=Web+site+design+developmentw1=Web+ site+design+developmentw2=Computer+software+developmentw3=Software+des ign+and+developmentw4=Macromedia+flexw5=Software+development+best+prac ticec=5s=166.sig=L-4QTvxB_quFDtMyhrQaHQ Computer software development
RE: [flexcoders] Re: Value objects
Well, I don't see anything you are doing in getters/setters except setting values. I know, if you are a OO purist then you might want to have getters/setters everywhere. For me, it makes sense wherever it is required, f.ex. where you want to validate the data before setting it or returing it. In case of ValueObject, we generally don't have a much business-logic inside them, so getters/setters dont make much sense. -abdul From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of deepu_vermaSent: Wednesday, January 25, 2006 1:46 AMTo: flexcoders@yahoogroups.comSubject: [flexcoders] Re: Value objects Thanks for the ReplyBut don't you think by declaring the variables as public we aredefeating the object encapsulation concept.And moreover then there would be no need to define the getter andsetter methods for the class.Thanks and Regardsdv--- In flexcoders@yahoogroups.com, "Abdul Qabiz" [EMAIL PROTECTED] wrote: Hi, There are two things:- * I think, variables in actionscript should be in captial-case because the Coldfusion remoting adapter sends all variables in capital case. * Second, though I am not sure, variables in actionscript should be public. Use the following code and let us know if it works. -abdul import org.nevis.cairngorm.vo.ValueObject; class com.macromedia.webreqapp.vo.UserVO implements ValueObject { public static var registered:Boolean = Object.registerClass("webreqapp.webrequest.vo.user", com.macromedia.webreqapp.vo.UserVO ); public function setUserID(userID:Number):Void { this.USERID = userID; } public function getUserID():Number { return USERID } public function setName(name:String):Void { this.NAME = NAME; } public function getName():String { return NAME; } public function setEmail(email:String):Void { this.EMAIL = email; } public function getEmail():String { return EMAIL; } public function setPassword(password:String):Void { this.PASSWORD = password; } public function getPassword():String { return PASSWORD; } public function setRole(role:String):Void { this.ROLE = role; } public function getRole():String { return ROLE; } public var USERID:Number; public var NAME:String; public var EMAIL:String; public var PASSWORD:String; public var ROLE:String; } From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of deepu_verma Sent: Tuesday, January 24, 2006 5:58 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Value objects I am stuck up with how to map VO between flex and Coldfusion My AS class is import org.nevis.cairngorm.vo.ValueObject; class com.macromedia.webreqapp.vo.UserVO implements ValueObject { public static var registered:Boolean = Object.registerClass("webreqapp.webrequest.vo.user", com.macromedia.webreqapp.vo.UserVO ); public function setUserID(userID:Number):Void { this.userID = userID; } public function getUserID(Void):Number { return userID } public function setName(name:String):Void { this.name = name; } public function getName(Void):String { return name; } public function setEmail(email:String):Void { this.email = email; } public function getEmail(Void):String { return email; } public function setPassword(password:String):Void { this.password = password; } public function getPassword(Void):String { return password; } public function setRole(role:String):Void { this.role = role; } public function getRole(Void):String { return role; } private var userID:Number; private var name:String; public var email:String; private var password:String; private var role:String; } My coldfusion code is cffunction name="signin" access="remote" cfargument name="user" type="any" required="yes" cfobject type="JAVA" class="flashgateway.io.ASObject" name="myclass" action="" cfset myObj = myclass.init() cfset myobj.setType("com.macromedia.webreqapp.vo.UserVO") cfset myobj.put("email", "test") cfset myobj.put("password", "test") cfreturn myobj /cffunction How will the returned data from CF be automatically mapped to the flash VO. Any help is greatly appreciated Thanks Deepak -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com SPONSORED LINKS Web site design development http://groups.yahoo.com/gads?t=msk=Web+site+design+developmentw1=Web+ site+design+developmentw2=Computer+software+developmentw3=Software+des ign+and+developmentw4=Macromedia+flexw5=Software+development+best+prac ticec=5s=166.sig=L-4QTvxB_quFDtMyhrQaHQ Computer software development http://groups.yahoo.com/gads?t=msk=Computer+software+developmen