tag:blogger.com,1999:blog-7290642316743338665.post6753813678145387810..comments2023-09-20T05:23:44.886-05:00Comments on behind the times: Adobe Flex First Thoughts: Part IHamlet D'Arcyhttp://www.blogger.com/profile/04008870357169725586noreply@blogger.comBlogger4125tag:blogger.com,1999:blog-7290642316743338665.post-15370381880793164462007-09-23T20:31:00.000-05:002007-09-23T20:31:00.000-05:00I'm not saying the flex support and community is ...I'm not saying the flex support and community is bad in absolute terms... only as a relative quantity comparison to JavaScript. There are more books, resumes, conferences, and forums that reference Javascript than ActionScript. http://www.googlebattle.com/index.php?domain=actionscript&domain2=javascript&submit=Go%21<BR/><BR/>A comparison of quality would be a lot harder!Hamlet D'Arcyhttps://www.blogger.com/profile/04008870357169725586noreply@blogger.comtag:blogger.com,1999:blog-7290642316743338665.post-84825404749412173162007-09-22T20:34:00.000-05:002007-09-22T20:34:00.000-05:00Hi,I think the community around Flex and AS3 is pr...Hi,<BR/><BR/>I think the community around Flex and AS3 is probably quite a bit larger than you may realize. <BR/><BR/>Suggest you check out the community at FlexCoders: http://tech.groups.yahoo.com/group/flexcoders/ (900 messages in last 7 days).<BR/><BR/>There is also a good blog aggregator with 100+ Flex related blogs here: http://snipurl.com/1r3mo<BR/><BR/>There are also many articles here:<BR/>http://www.adobe.com/devnet/flex/<BR/><BR/>HTH,<BR/>David<BR/>DavidUnknownhttps://www.blogger.com/profile/02026942526724551813noreply@blogger.comtag:blogger.com,1999:blog-7290642316743338665.post-88882846392903976092007-09-22T08:05:00.000-05:002007-09-22T08:05:00.000-05:00Great information Tom, thanks!Ben also pointed me ...Great information Tom, thanks!<BR/><BR/>Ben also pointed me to a product called Cairngorm that he uses for a Flex DAO layer, as well as other services: http://labs.adobe.com/wiki/index.php/Cairngorm<BR/><BR/>This framework might alleviate my DAO layer concerns as well. <BR/><BR/>As for the typing... I understand the pain, and have found myself cursing at many PHP runtime errors in my time. I'm not sure I completely buy the argument that type safety can be achieved through the rigorous adherence to unit testing. This is because I'm not sure that it is always appropriate to write unit tests for everything. The principle of "unit test everything but could possibly break" has a different answer in a dynamic language than a static language. Something as simple as: <BR/><BR/>var myArray:Array = new Number[];<BR/><BR/>could break! Egads!<BR/><BR/>Thank you tons for my first comment ever.Hamlet D'Arcyhttps://www.blogger.com/profile/04008870357169725586noreply@blogger.comtag:blogger.com,1999:blog-7290642316743338665.post-84575576454799877172007-09-21T10:12:00.000-05:002007-09-21T10:12:00.000-05:00Hi Hamlet,Hope you don't mind that this comment is...Hi Hamlet,<BR/><BR/>Hope you don't mind that this comment is going to be rather LOOOOONG.<BR/><BR/>Nice post! I agreed with most of it. Since I attended the 2-day training with you, I can see why you might be unclear on a few points (i'll list those below). Part of the problem with the 2-day training is that it was all based off of a single example that was gradually enhanced with each new lesson. So we didn't really get an opportunity to explore the various ways you can build applications in Flex. If you have a chance to experiment a little more with Flex, there are some really good lessons included in the help section of Flex Builder 2 (or 3 beta). Also the ActionScript cookbook that Ryan has is pretty good and is completely ActionScript based (no mxml).<BR/><BR/>The first point is just a quick clarification on pricing. Unless there is some sort of discount I'm unaware of, Adobe lists the cost of Flex as $499 and add another $250 to $300 if you want it bundled with Charting. The server side (Data Services 2) is actually free for the first license, which can be a steal for small businesses. The other nice thing is since Flex is client side technology, you don't even really need to purchase this server side at all for larger businesses since you can simply pass XML using SOAP or Restlets to access the database. That's one of the reasons that Ryan asked Justin to cover the E4X stuff during the 2-day training. This obviously won't be as fast as using DS2 but for small amounts of data it should be sufficient.<BR/><BR/>I agree with you about embedding code in MXML being bad and was a little disappointed in the training example for not using a better approach to this. This definitely is not the only way to code in Flex and I hope that the coding standards document that Ben is working on will address this. Just like ASP and JSP can either embed code or reference code, the same is true with MXML. Also, just like JSP is compiled into java classes, MXML is compiled into ActionScript classes. In fact, you are not even required to use MXML at all. Even better, you can do everything in an ActionScript project (no MXML) that you can in a Flex project (with MXML). The only downside is you won't be able to use the neat UI Editor that you mentioned.<BR/><BR/>Auto-resizing actually works great in Flex, but obviously you won't be able to do this in "absolute" mode. In HTML, you can set tables, images, etc. to be either fixed pixel width (same as absolute) or percentage width (same as auto-resizing). In Flex, it's the same idea but you have even more flexibility to auto-resize some things you can't in HTML, such as fonts. Since the examples in the 2-day training were all "absolute" based, the auto-resize was not covered very well. He talked about it BRIEFLY when he was describing the "anchor checkboxes" and drawing diagrams with the marker. It would have been a lot better if he could have demonstrated this in a lab exercise.<BR/><BR/>Before I start to sound like I'm trying to "sell you" on Flex, there was one point you made in favor of Flex that I actually see as a downside. This might be more of a programmer preference than a misunderstanding, but I really think the change from a loosely typed language (ActionScript 2) to a more strongly typed language (ActionScript 3) was a step in the right direction for Adobe, but I don't think they went quite far enough. Consider the following line of ActionScript code:<BR/><BR/><I>var myArray:Array = new Number[];</I><BR/><BR/>This line will compile just fine but generate the following cryptic runtime error EVERY time the array is referenced.<BR/><BR/><I>TypeError: Error #1007: Instantiation attempted on a non-constructor.</I><BR/><BR/>I know compile errors can be a pain, but what if you had this line of code buried deep in a section that is rarely ever called? Wouldn't you rather know about problems like this earlier on before your product is shipped and discovered by the users? Even in java, ClassCast Exceptions are fairly common errors users get when a programmer wasn't being careful enough.<BR/><BR/>Also consider the runtime performance of a loosely typed language versus a strongly typed language. Since all arrays are loosely typed in ActionScript, here is a really simple example that shows Java arrays are 60 times faster than ActionScript arrays. JavaScript (also loosely typed) is even worse.<BR/><BR/> <BR/><B>Java:</B><BR/><BR/><I>public class ArrayTest {<BR/> public static void main(String[] args) {<BR/> int[] arr = new int[10000000];<BR/><BR/> //write test time is 31 milliseconds<BR/> long start1 = System.currentTimeMillis();<BR/> for (int i=0; i<10000000; i++) {<BR/> arr[i] = 1;<BR/> }<BR/> long finish1 = System.currentTimeMillis();<BR/> System.out.println("write test time: "+(finish1-start1));<BR/><BR/> //read test time is 16 milliseconds<BR/> long start2 = System.currentTimeMillis();<BR/> for (int j=0; j<10000000; j++) {<BR/> int temp = arr[j];<BR/> }<BR/> long finish2 = System.currentTimeMillis();<BR/><BR/> System.out.println("read test time: "+(finish2-start2)); <BR/> }<BR/>}</I><BR/><BR/><BR/><B>ActionScript:</B><BR/><BR/><I>package {<BR/> import flash.display.Sprite;<BR/><BR/> public class ArrayTest extends Sprite {<BR/> public function ArrayTest() {<BR/> var arr:Array = new Array(10000000);<BR/><BR/> //write test time is 1702 milliseconds<BR/> var start1:Date = new Date();<BR/> for (var i:int=0; i<10000000; i++) {<BR/> arr[i] = 1;<BR/> }<BR/> var finish1:Date = new Date();<BR/> trace("write test time: "+(finish1.time-start1.time));<BR/> <BR/> //read test time is 1155 milliseconds<BR/> var start2:Date = new Date();<BR/> for (var j:int=0; j<10000000; j++) {<BR/> var temp:int = arr[j];<BR/> }<BR/><BR/> var finish2:Date = new Date();<BR/> trace("read test time: "+(finish2.time-start2.time)); <BR/> }<BR/> }<BR/>}</I>Anonymoushttps://www.blogger.com/profile/00106162254544602575noreply@blogger.com