RE: [Flashcoders] Quick question about dynamic groupings
A generic object has no meaning, you lose typecasting and all the benefits of using a custom class, like for example, code completion. Remember anonymous functions in AS1/2 and why they were bad? It's not quite as bad to use generic objects, but still not good practice IMO. With VOs, you know what properties it contains, and that's very useful in situations, like for example, when you attach data to an event and want to use it on the other end. Believe me, VOs are worth the slight extra effort they are to create. Jason Merrill Bank of America Global Learning Learning Performance Solutions Join the Bank of America Flash Platform Community and visit our Instructional Technology Design Blog (note: these are for Bank of America employees only) -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Cor Sent: Monday, April 26, 2010 4:23 PM To: 'Flash Coders List' Subject: RE: [Flashcoders] Quick question about dynamic groupings Hi Jason, Thank you. So the personVO.as should look like this: package { class PersonVO { public var firstName:String; public var lastName:String; public var phoneNumber:Number; public var indicatorColor:uint; } } Now I think I understand what you are doing, but I lost to see the benefit of the VO over doing it with a generic Object. Because it is now in a public array I can address everything. Like this: var personVO:PersonVO = new Object(); personVO.firstName = personnodex...@firstname; etc.. Or maybe I don't understand the VO concept??? Regards Cor -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Merrill, Jason Sent: maandag 26 april 2010 15:52 To: Flash Coders List Subject: RE: [Flashcoders] Quick question about dynamic groupings Could you extend this with an example on the part of: I typically do is load in XML data and create VOs from that (in my Model class) to use in my app. Sure. Here is an example of what the parsing might look like inside your model class. If your XML looked like this: xml people person firstName=Hank lastName=Aaron phoneNumber=7043237564 indicatorColor=0xe39132 / person firstName=Fred lastName=Astaire phoneNumber=9082321214 indicatorColor=0xe73721 / person firstName=Judy lastName=Garland phoneNumber=3107382234 indicatorColor=0xd4e355 / person firstName=Marilyn lastName=Monroe phoneNumber=3107673721 indicatorColor=0xbab5ab / /people /xml Then inside your model class, you may have some code like this (which of course would run after the XML is loaded): public var personVOs:Array = []; //array of PersonVOs private function createPersonVOs():void { for each (var personNodeXML:XML in myXML.people.person) { var personVO:PersonVO = new PersonVO(); personVO.firstName = personnodex...@firstname; personVO.lastName = personnodex...@lastname; personVO.phoneNumber = Number(personnodex...@phonenumber); personVO.indicatorColor = uint(personnodex...@indicatorcolor); personVOs.push(personVO); } } So now, you have personVOs as a public property in your model you can call and get the people information from their VO class. Does that help? Jason Merrill Bank of America Global Learning Learning Performance Solutions Join the Bank of America Flash Platform Community and visit our Instructional Technology Design Blog (note: these are for Bank of America employees only) -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Cor Sent: Saturday, April 24, 2010 6:53 AM To: 'Flash Coders List' Subject: RE: [Flashcoders] Quick question about dynamic groupings Hi Jason, Nice explaination! Thanks! Could you extend this with an example on the part of: I typically do is load in XML data and create VOs from that (in my Model class) to use in my app. Kind regards Cor van Dooren The Netherlands ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Geen virus gevonden in het binnenkomende-bericht. Gecontroleerd door AVG - www.avg.com Versie: 9.0.814 / Virusdatabase: 271.1.1/2833 - datum van uitgifte: 04/24/10 20:31:00 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Quick question about dynamic groupings
Yup - using VOs now - and I have produced documentation with VisDoc that include them as well. Thanks everyone. Eric On Thu, Apr 29, 2010 at 8:23 AM, Merrill, Jason jason.merr...@bankofamerica.com wrote: A generic object has no meaning, you lose typecasting and all the benefits of using a custom class, like for example, code completion. Remember anonymous functions in AS1/2 and why they were bad? It's not quite as bad to use generic objects, but still not good practice IMO. With VOs, you know what properties it contains, and that's very useful in situations, like for example, when you attach data to an event and want to use it on the other end. Believe me, VOs are worth the slight extra effort they are to create. Jason Merrill Bank of America Global Learning Learning Performance Solutions Join the Bank of America Flash Platform Community and visit our Instructional Technology Design Blog (note: these are for Bank of America employees only) -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Cor Sent: Monday, April 26, 2010 4:23 PM To: 'Flash Coders List' Subject: RE: [Flashcoders] Quick question about dynamic groupings Hi Jason, Thank you. So the personVO.as should look like this: package { class PersonVO { public var firstName:String; public var lastName:String; public var phoneNumber:Number; public var indicatorColor:uint; } } Now I think I understand what you are doing, but I lost to see the benefit of the VO over doing it with a generic Object. Because it is now in a public array I can address everything. Like this: var personVO:PersonVO = new Object(); personVO.firstName = personnodex...@firstname; etc.. Or maybe I don't understand the VO concept??? Regards Cor -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Merrill, Jason Sent: maandag 26 april 2010 15:52 To: Flash Coders List Subject: RE: [Flashcoders] Quick question about dynamic groupings Could you extend this with an example on the part of: I typically do is load in XML data and create VOs from that (in my Model class) to use in my app. Sure. Here is an example of what the parsing might look like inside your model class. If your XML looked like this: xml people person firstName=Hank lastName=Aaron phoneNumber=7043237564 indicatorColor=0xe39132 / person firstName=Fred lastName=Astaire phoneNumber=9082321214 indicatorColor=0xe73721 / person firstName=Judy lastName=Garland phoneNumber=3107382234 indicatorColor=0xd4e355 / person firstName=Marilyn lastName=Monroe phoneNumber=3107673721 indicatorColor=0xbab5ab / /people /xml Then inside your model class, you may have some code like this (which of course would run after the XML is loaded): public var personVOs:Array = []; //array of PersonVOs private function createPersonVOs():void { for each (var personNodeXML:XML in myXML.people.person) { var personVO:PersonVO = new PersonVO(); personVO.firstName = personnodex...@firstname; personVO.lastName = personnodex...@lastname; personVO.phoneNumber = Number(personnodex...@phonenumber); personVO.indicatorColor = uint(personnodex...@indicatorcolor); personVOs.push(personVO); } } So now, you have personVOs as a public property in your model you can call and get the people information from their VO class. Does that help? Jason Merrill Bank of America Global Learning Learning Performance Solutions Join the Bank of America Flash Platform Community and visit our Instructional Technology Design Blog (note: these are for Bank of America employees only) -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Cor Sent: Saturday, April 24, 2010 6:53 AM To: 'Flash Coders List' Subject: RE: [Flashcoders] Quick question about dynamic groupings Hi Jason, Nice explaination! Thanks! Could you extend this with an example on the part of: I typically do is load in XML data and create VOs from that (in my Model class) to use in my app. Kind regards Cor van Dooren The Netherlands ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Geen virus gevonden in het binnenkomende-bericht. Gecontroleerd door AVG - www.avg.com Versie: 9.0.814 / Virusdatabase: 271.1.1/2833 - datum van uitgifte: 04/24/10 20:31:00 ___ Flashcoders mailing list
RE: [Flashcoders] Quick question about dynamic groupings
The extra effort is no problem. The way of using VOs in MVC is where my lack of knowledge lays, and I am trying to learn it... And you are helping very well on the way. I just need those little (working) examples to get me on track of fully understanding. And sometimes technical stuff is extra difficult because English is not my native language. Thanks again, Jason. And of course all other participants! Regards Cor -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Merrill, Jason Sent: donderdag 29 april 2010 14:24 To: Flash Coders List Subject: RE: [Flashcoders] Quick question about dynamic groupings A generic object has no meaning, you lose typecasting and all the benefits of using a custom class, like for example, code completion. Remember anonymous functions in AS1/2 and why they were bad? It's not quite as bad to use generic objects, but still not good practice IMO. With VOs, you know what properties it contains, and that's very useful in situations, like for example, when you attach data to an event and want to use it on the other end. Believe me, VOs are worth the slight extra effort they are to create. Jason Merrill Bank of America Global Learning Learning Performance Solutions Join the Bank of America Flash Platform Community and visit our Instructional Technology Design Blog (note: these are for Bank of America employees only) -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Cor Sent: Monday, April 26, 2010 4:23 PM To: 'Flash Coders List' Subject: RE: [Flashcoders] Quick question about dynamic groupings Hi Jason, Thank you. So the personVO.as should look like this: package { class PersonVO { public var firstName:String; public var lastName:String; public var phoneNumber:Number; public var indicatorColor:uint; } } Now I think I understand what you are doing, but I lost to see the benefit of the VO over doing it with a generic Object. Because it is now in a public array I can address everything. Like this: var personVO:PersonVO = new Object(); personVO.firstName = personnodex...@firstname; etc.. Or maybe I don't understand the VO concept??? Regards Cor -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Merrill, Jason Sent: maandag 26 april 2010 15:52 To: Flash Coders List Subject: RE: [Flashcoders] Quick question about dynamic groupings Could you extend this with an example on the part of: I typically do is load in XML data and create VOs from that (in my Model class) to use in my app. Sure. Here is an example of what the parsing might look like inside your model class. If your XML looked like this: xml people person firstName=Hank lastName=Aaron phoneNumber=7043237564 indicatorColor=0xe39132 / person firstName=Fred lastName=Astaire phoneNumber=9082321214 indicatorColor=0xe73721 / person firstName=Judy lastName=Garland phoneNumber=3107382234 indicatorColor=0xd4e355 / person firstName=Marilyn lastName=Monroe phoneNumber=3107673721 indicatorColor=0xbab5ab / /people /xml Then inside your model class, you may have some code like this (which of course would run after the XML is loaded): public var personVOs:Array = []; //array of PersonVOs private function createPersonVOs():void { for each (var personNodeXML:XML in myXML.people.person) { var personVO:PersonVO = new PersonVO(); personVO.firstName = personnodex...@firstname; personVO.lastName = personnodex...@lastname; personVO.phoneNumber = Number(personnodex...@phonenumber); personVO.indicatorColor = uint(personnodex...@indicatorcolor); personVOs.push(personVO); } } So now, you have personVOs as a public property in your model you can call and get the people information from their VO class. Does that help? Jason Merrill Bank of America Global Learning Learning Performance Solutions Join the Bank of America Flash Platform Community and visit our Instructional Technology Design Blog (note: these are for Bank of America employees only) -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Cor Sent: Saturday, April 24, 2010 6:53 AM To: 'Flash Coders List' Subject: RE: [Flashcoders] Quick question about dynamic groupings Hi Jason, Nice explaination! Thanks! Could you extend this with an example on the part of: I typically do is load in XML data and create VOs from that (in my Model class) to use in my app. Kind regards Cor van Dooren The Netherlands
RE: [Flashcoders] Quick question about dynamic groupings
The way of using VOs in MVC is where my lack of knowledge lays VOs are not specific to the MVC pattern, they are just a good way to handle related data, period. Jason Merrill Bank of America Global Learning Learning Performance Solutions Join the Bank of America Flash Platform Community and visit our Instructional Technology Design Blog (note: these are for Bank of America employees only) -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Cor Sent: Thursday, April 29, 2010 10:58 AM To: 'Flash Coders List' Subject: RE: [Flashcoders] Quick question about dynamic groupings The extra effort is no problem. The way of using VOs in MVC is where my lack of knowledge lays, and I am trying to learn it... And you are helping very well on the way. I just need those little (working) examples to get me on track of fully understanding. And sometimes technical stuff is extra difficult because English is not my native language. Thanks again, Jason. And of course all other participants! Regards Cor -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Merrill, Jason Sent: donderdag 29 april 2010 14:24 To: Flash Coders List Subject: RE: [Flashcoders] Quick question about dynamic groupings A generic object has no meaning, you lose typecasting and all the benefits of using a custom class, like for example, code completion. Remember anonymous functions in AS1/2 and why they were bad? It's not quite as bad to use generic objects, but still not good practice IMO. With VOs, you know what properties it contains, and that's very useful in situations, like for example, when you attach data to an event and want to use it on the other end. Believe me, VOs are worth the slight extra effort they are to create. Jason Merrill Bank of America Global Learning Learning Performance Solutions Join the Bank of America Flash Platform Community and visit our Instructional Technology Design Blog (note: these are for Bank of America employees only) -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Cor Sent: Monday, April 26, 2010 4:23 PM To: 'Flash Coders List' Subject: RE: [Flashcoders] Quick question about dynamic groupings Hi Jason, Thank you. So the personVO.as should look like this: package { class PersonVO { public var firstName:String; public var lastName:String; public var phoneNumber:Number; public var indicatorColor:uint; } } Now I think I understand what you are doing, but I lost to see the benefit of the VO over doing it with a generic Object. Because it is now in a public array I can address everything. Like this: var personVO:PersonVO = new Object(); personVO.firstName = personnodex...@firstname; etc.. Or maybe I don't understand the VO concept??? Regards Cor -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Merrill, Jason Sent: maandag 26 april 2010 15:52 To: Flash Coders List Subject: RE: [Flashcoders] Quick question about dynamic groupings Could you extend this with an example on the part of: I typically do is load in XML data and create VOs from that (in my Model class) to use in my app. Sure. Here is an example of what the parsing might look like inside your model class. If your XML looked like this: xml people person firstName=Hank lastName=Aaron phoneNumber=7043237564 indicatorColor=0xe39132 / person firstName=Fred lastName=Astaire phoneNumber=9082321214 indicatorColor=0xe73721 / person firstName=Judy lastName=Garland phoneNumber=3107382234 indicatorColor=0xd4e355 / person firstName=Marilyn lastName=Monroe phoneNumber=3107673721 indicatorColor=0xbab5ab / /people /xml Then inside your model class, you may have some code like this (which of course would run after the XML is loaded): public var personVOs:Array = []; //array of PersonVOs private function createPersonVOs():void { for each (var personNodeXML:XML in myXML.people.person) { var personVO:PersonVO = new PersonVO(); personVO.firstName = personnodex...@firstname; personVO.lastName = personnodex...@lastname; personVO.phoneNumber = Number(personnodex...@phonenumber); personVO.indicatorColor = uint(personnodex...@indicatorcolor); personVOs.push(personVO); } } So now, you have personVOs as a public property in your model you can call and get the people information from their VO class. Does that help? Jason Merrill Bank of America Global Learning Learning Performance Solutions
RE: [Flashcoders] Quick question about dynamic groupings
Could you extend this with an example on the part of: I typically do is load in XML data and create VOs from that (in my Model class) to use in my app. Sure. Here is an example of what the parsing might look like inside your model class. If your XML looked like this: xml people person firstName=Hank lastName=Aaron phoneNumber=7043237564 indicatorColor=0xe39132 / person firstName=Fred lastName=Astaire phoneNumber=9082321214 indicatorColor=0xe73721 / person firstName=Judy lastName=Garland phoneNumber=3107382234 indicatorColor=0xd4e355 / person firstName=Marilyn lastName=Monroe phoneNumber=3107673721 indicatorColor=0xbab5ab / /people /xml Then inside your model class, you may have some code like this (which of course would run after the XML is loaded): public var personVOs:Array = []; //array of PersonVOs private function createPersonVOs():void { for each (var personNodeXML:XML in myXML.people.person) { var personVO:PersonVO = new PersonVO(); personVO.firstName = personnodex...@firstname; personVO.lastName = personnodex...@lastname; personVO.phoneNumber = Number(personnodex...@phonenumber); personVO.indicatorColor = uint(personnodex...@indicatorcolor); personVOs.push(personVO); } } So now, you have personVOs as a public property in your model you can call and get the people information from their VO class. Does that help? Jason Merrill Bank of America Global Learning Learning Performance Solutions Join the Bank of America Flash Platform Community and visit our Instructional Technology Design Blog (note: these are for Bank of America employees only) -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Cor Sent: Saturday, April 24, 2010 6:53 AM To: 'Flash Coders List' Subject: RE: [Flashcoders] Quick question about dynamic groupings Hi Jason, Nice explaination! Thanks! Could you extend this with an example on the part of: I typically do is load in XML data and create VOs from that (in my Model class) to use in my app. Kind regards Cor van Dooren The Netherlands ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] Quick question about dynamic groupings
Hi Jason, Thank you. So the personVO.as should look like this: package { class PersonVO { public var firstName:String; public var lastName:String; public var phoneNumber:Number; public var indicatorColor:uint; } } Now I think I understand what you are doing, but I lost to see the benefit of the VO over doing it with a generic Object. Because it is now in a public array I can address everything. Like this: var personVO:PersonVO = new Object(); personVO.firstName = personnodex...@firstname; etc.. Or maybe I don't understand the VO concept??? Regards Cor -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Merrill, Jason Sent: maandag 26 april 2010 15:52 To: Flash Coders List Subject: RE: [Flashcoders] Quick question about dynamic groupings Could you extend this with an example on the part of: I typically do is load in XML data and create VOs from that (in my Model class) to use in my app. Sure. Here is an example of what the parsing might look like inside your model class. If your XML looked like this: xml people person firstName=Hank lastName=Aaron phoneNumber=7043237564 indicatorColor=0xe39132 / person firstName=Fred lastName=Astaire phoneNumber=9082321214 indicatorColor=0xe73721 / person firstName=Judy lastName=Garland phoneNumber=3107382234 indicatorColor=0xd4e355 / person firstName=Marilyn lastName=Monroe phoneNumber=3107673721 indicatorColor=0xbab5ab / /people /xml Then inside your model class, you may have some code like this (which of course would run after the XML is loaded): public var personVOs:Array = []; //array of PersonVOs private function createPersonVOs():void { for each (var personNodeXML:XML in myXML.people.person) { var personVO:PersonVO = new PersonVO(); personVO.firstName = personnodex...@firstname; personVO.lastName = personnodex...@lastname; personVO.phoneNumber = Number(personnodex...@phonenumber); personVO.indicatorColor = uint(personnodex...@indicatorcolor); personVOs.push(personVO); } } So now, you have personVOs as a public property in your model you can call and get the people information from their VO class. Does that help? Jason Merrill Bank of America Global Learning Learning Performance Solutions Join the Bank of America Flash Platform Community and visit our Instructional Technology Design Blog (note: these are for Bank of America employees only) -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Cor Sent: Saturday, April 24, 2010 6:53 AM To: 'Flash Coders List' Subject: RE: [Flashcoders] Quick question about dynamic groupings Hi Jason, Nice explaination! Thanks! Could you extend this with an example on the part of: I typically do is load in XML data and create VOs from that (in my Model class) to use in my app. Kind regards Cor van Dooren The Netherlands ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Geen virus gevonden in het binnenkomende-bericht. Gecontroleerd door AVG - www.avg.com Versie: 9.0.814 / Virusdatabase: 271.1.1/2833 - datum van uitgifte: 04/24/10 20:31:00 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Quick question about dynamic groupings
So the personVO.as should look like this: package { class PersonVO { public var firstName:String; public var lastName:String; public var phoneNumber:Number; public var indicatorColor:uint; } } Now I think I understand what you are doing, but I lost to see the benefit of the VO over doing it with a generic Object. Well, from the Flex side, the reason you'd use a custom value object instead of a generic object is for strongly typed values, compile-time checking, and code-completion in Flash Builder. I imagine some of those carry over to regular Flash development. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ http://training.figleaf.com/ Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on GSA Schedule, and provides the highest caliber vendor-authorized instruction at our training centers, online, or onsite. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] Quick question about dynamic groupings
Hi Jason, Nice explaination! Thanks! Could you extend this with an example on the part of: I typically do is load in XML data and create VOs from that (in my Model class) to use in my app. Kind regards Cor van Dooren The Netherlands -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Merrill, Jason Sent: vrijdag 23 april 2010 21:52 To: Flash Coders List Subject: RE: [Flashcoders] Quick question about dynamic groupings In my opinion, instead of anonymous objects with values that are not typecast, it's best to create ValueObjects (VOs, also called Data Transfer Objects or DTOs) - which are basically simple classes that have no constructor, no methods at all (maybe a getter or setter if you prefer) - just a class to store public properties. So for those, I would write a VO class like this: package { class MyVO { public var id:int; public var name:String; public var group:Number; } } (you can also set default values this way if you like). If you end up writing functions in your VO classes, you're doing something wrong and missing the point of VOs. Then, all you have to do is create them: var myVO:MyVO = new MyVO(); myVO.id = 4; myVO.name = foo; myVOP.group = 7; Throw those into an array and you're set. You can pass VOs through events, manage them in the model, have your other classes accept VOs, whatever. It's what Cairngorm and other design patterns use to move groups of related data around inside an application. This also allows for code completion on your VO in apps like Flexbuilder and FlashDevelop. What I typically do is load in XML data and create VOs from that (in my Model class) to use in my app. I wouldn't recommend using XML calls throughout your app, because then your app relies on XML and it's structure. With VOs, the data source can change (say you switch from XML to a Webservice) and your app doesn't break. All you have to do is change the parsing of the data into VOs in your model. Jason Merrill Bank of America Global Learning Learning Performance Solutions Join the Bank of America Flash Platform Community and visit our Instructional Technology Design Blog (note: these are for Bank of America employees only) -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Eric E. Dolecki Sent: Friday, April 23, 2010 3:22 PM To: Flash Coders List Subject: [Flashcoders] Quick question about dynamic groupings Hey all, I am beginning the authoring a class to manage objects dynamically. The main functionality is to group/ungroup the objects. I was thinking of starting out by having each object be it's own group. [{id:1, name:foo, group:1}, {id:2, name:bar, group:2}, {id:3, name:mustaine, group:3}]; And then be able to move them in and out of group objects in the class be able to report them back to another class, etc. Is this the best way to handle it - would internal XML be better, or is an array of objects that gets manipulated around a better solution? Eric ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Geen virus gevonden in het binnenkomende-bericht. Gecontroleerd door AVG - www.avg.com Versie: 9.0.814 / Virusdatabase: 271.1.1/2829 - datum van uitgifte: 04/22/10 20:31:00 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Quick question about dynamic groupings
Interesting take - thank you for your feedback. I don't think I would have considered something like that. I think FB4 will like this approach as well. Yes, FB4 will definitely like this approach. In fact, if you're using ColdFusion as the back end, you can use the wizards in FB4 and CFB (which is bundled with FB4) to generate both the server-side (CF) and client-side (AS3) value object representations by just right-clicking on the database table you want to represent. In addition to the value objects, you'll also get a gateway object in charge of translating the value objects to database rows and vice-versa. Then, using the Data/Services tab, you can generate the service calls to fetch the value objects and you can generate bindings between the value objects and the UI components you use to display them. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ http://training.figleaf.com/ Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on GSA Schedule, and provides the highest caliber vendor-authorized instruction at our training centers, online, or onsite. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] Quick question about dynamic groupings
In my opinion, instead of anonymous objects with values that are not typecast, it's best to create ValueObjects (VOs, also called Data Transfer Objects or DTOs) - which are basically simple classes that have no constructor, no methods at all (maybe a getter or setter if you prefer) - just a class to store public properties. So for those, I would write a VO class like this: package { class MyVO { public var id:int; public var name:String; public var group:Number; } } (you can also set default values this way if you like). If you end up writing functions in your VO classes, you're doing something wrong and missing the point of VOs. Then, all you have to do is create them: var myVO:MyVO = new MyVO(); myVO.id = 4; myVO.name = foo; myVOP.group = 7; Throw those into an array and you're set. You can pass VOs through events, manage them in the model, have your other classes accept VOs, whatever. It's what Cairngorm and other design patterns use to move groups of related data around inside an application. This also allows for code completion on your VO in apps like Flexbuilder and FlashDevelop. What I typically do is load in XML data and create VOs from that (in my Model class) to use in my app. I wouldn't recommend using XML calls throughout your app, because then your app relies on XML and it's structure. With VOs, the data source can change (say you switch from XML to a Webservice) and your app doesn't break. All you have to do is change the parsing of the data into VOs in your model. Jason Merrill Bank of America Global Learning Learning Performance Solutions Join the Bank of America Flash Platform Community and visit our Instructional Technology Design Blog (note: these are for Bank of America employees only) -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Eric E. Dolecki Sent: Friday, April 23, 2010 3:22 PM To: Flash Coders List Subject: [Flashcoders] Quick question about dynamic groupings Hey all, I am beginning the authoring a class to manage objects dynamically. The main functionality is to group/ungroup the objects. I was thinking of starting out by having each object be it's own group. [{id:1, name:foo, group:1}, {id:2, name:bar, group:2}, {id:3, name:mustaine, group:3}]; And then be able to move them in and out of group objects in the class be able to report them back to another class, etc. Is this the best way to handle it - would internal XML be better, or is an array of objects that gets manipulated around a better solution? Eric ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Quick question about dynamic groupings
Interesting take - thank you for your feedback. I don't think I would have considered something like that. I think FB4 will like this approach as well. Eric On Fri, Apr 23, 2010 at 3:52 PM, Merrill, Jason jason.merr...@bankofamerica.com wrote: In my opinion, instead of anonymous objects with values that are not typecast, it's best to create ValueObjects (VOs, also called Data Transfer Objects or DTOs) - which are basically simple classes that have no constructor, no methods at all (maybe a getter or setter if you prefer) - just a class to store public properties. So for those, I would write a VO class like this: package { class MyVO { public var id:int; public var name:String; public var group:Number; } } (you can also set default values this way if you like). If you end up writing functions in your VO classes, you're doing something wrong and missing the point of VOs. Then, all you have to do is create them: var myVO:MyVO = new MyVO(); myVO.id = 4; myVO.name = foo; myVOP.group = 7; Throw those into an array and you're set. You can pass VOs through events, manage them in the model, have your other classes accept VOs, whatever. It's what Cairngorm and other design patterns use to move groups of related data around inside an application. This also allows for code completion on your VO in apps like Flexbuilder and FlashDevelop. What I typically do is load in XML data and create VOs from that (in my Model class) to use in my app. I wouldn't recommend using XML calls throughout your app, because then your app relies on XML and it's structure. With VOs, the data source can change (say you switch from XML to a Webservice) and your app doesn't break. All you have to do is change the parsing of the data into VOs in your model. Jason Merrill Bank of America Global Learning Learning Performance Solutions Join the Bank of America Flash Platform Community and visit our Instructional Technology Design Blog (note: these are for Bank of America employees only) -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto: flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Eric E. Dolecki Sent: Friday, April 23, 2010 3:22 PM To: Flash Coders List Subject: [Flashcoders] Quick question about dynamic groupings Hey all, I am beginning the authoring a class to manage objects dynamically. The main functionality is to group/ungroup the objects. I was thinking of starting out by having each object be it's own group. [{id:1, name:foo, group:1}, {id:2, name:bar, group:2}, {id:3, name:mustaine, group:3}]; And then be able to move them in and out of group objects in the class be able to report them back to another class, etc. Is this the best way to handle it - would internal XML be better, or is an array of objects that gets manipulated around a better solution? Eric ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- http://ericd.net Interactive design and development ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders