Archive for the 'Flex' Category
I have been looking for something like this for long time and i think i wasted a lot more time looking for this, than the time to took me to build it, its actually a very simple way of laying our the components, but very powerful when you are writing corporate or form based applications. The question is simple, how can we have a multi colum form component, i am wrting a Form component that will have a more powerfull layout, holds data, reset and validate the content, but this time i just wanted to share this way to layout a multi column form, i will share the full component once is done, otherways the post will get too long. So this basic layout has to modes, one is Column mode and the other one is Direction mode ( dont orget to right click to see the source code).
Its basically reusing the form component and aligning them using boxes, i don’t know how useful is this for you, but if you are interested on the full component, let me know.
Adobe is working on a project that will allow us to run code written in other languages like Java, C and C++ inside the Flash plug-in. We know that ActionScript is the programming language of the Flash Player runtime, so the idea is basically cross-compile the code to ActionScript.
To tell you the truth i don’t know if this will be beneficial or will just become complicated and buggy, but while we get to see the results of this project, is plain to see that the Adobe guys are trying to get closer to all type of developers and is another sign that Flash/Flex technologies are here to stay.
Take a look at this link to read the article.
When a developer was born with the web application mind set, is not that easy to move to a Rich Internet Application architecture. Is hard to make that change because they are way too used to stuff the request with data, to then be able to write it to the client browser as HTML and keep the state on the server side session.
When I say Rich Internet Applications, I am not just talking about Flex, there are some other JavaScript/HTML frameworks that provides some type of RIA architecture, for those that have been using something like that or any other type of desktop applications, this stateful client might sound familiar.
Because right now I have been working with JSF I always use it as an example to compare standard web applications with RIA, but it would be the same with Struts or any other web development framework, so for example:
When you have a JSF application, the only thing that the final user will get to his browser will be html pages, some JavaScript files, images, images, etc. But that’s it, nothing else. The user will click a button that will submit the whole page, then the JSF servlet will get the request, execute the life cycle, then execute the action where the developer will have some logic and then the response will be sent to the client as another html page. After all this, the only thing that the user will see is a flashing on the screen, coming back with another page, but we all know that a lot of things happened during that time, and the most important thing that we want to point here is that we managed the transaction on the server, leaving the data and everything related to that current user instance on a server side session, sending to the client ONLY the data needed to manage that next screen transaction, all the screens, data and resources are stored on the server, and if something is needed, we have to make a call from the client to the server to get that something.
Now, in a Flex application is totally different, when we build a Flex application everything will get packaged on a single .swf file, which is basically the same type of file that you load when you go to a flash website. Inside that file you typically will have everything needed by the client, screens, resources, and sometimes even static data. So this is basically going to perform better than a typical web application because the transactions will be less expensive, we are not sending the whole page back and forth, we are going to query the server only for data, so the request/response will be faster, then that data will be stored on the client, changed, manipulated, then when is ready, will be sent back to the server, not that the state will be on the client not on the server. Some people claim that this will make the application chatty, but I don’t agree, is the same kind of problem you will have with any other web application, if is not well designed and well coded, then yes, any application can become chatty. With the appropriate RIA framework as Flex and good design, the performance and usability of this type of application will be dramatically improved.
If you are a JEE, interested on Flex, one thing i will tell you, you have an advantage because currently Flex developers have realize that in Java we have been sucessfull with our patterns, so you will find a lot of things that will sound familiat to you, like DTO, VO, Proxy, etc, so I would suggest you to start with the basics of flex and actionscript, then jump to BlazeDS that will give you the ability to communicate with your serverside objects, take a look at the Cairngorm (I get it was not a marketing person that named that framework ) that seems to be a good option if you are planning to use it on a large applications, the only thing that I don’t like about them is that they are following the command event pattern, that at the end it might lead you to a lot of files because you have to have one class per command button ( I am working on another way to do that, so I will be posting later about it), and take a look at the DAOFlex that give you and idea of how this work.
If you have any question do not hesitate to write me.
I have been working with Blaze and Data Services for some time, but i remember the pain to understand if it was going to be a separate web application that communicates with my other web application with my other web application, how i had to deploy it, how it works, so here is a very small explanation for this:
First, BlazeDS is not a separate web application, is just a bunch of jar files that you have to drop in your WEB-INF folder in certain structure, then you have to configure so when you make a call from a Flex application, the Flex servlet will become your controller that will manage the transaction to the configured RemoteObject, will convert the ActionScript Obejct to Java object if necessary execute the transaction and return the response back to your Flex application.
For example, lets say you have a Web application that manage Customers and uses Struts or JSF or any other client and you use DTO’s to represent your data, your folder structure would be like this:
Now, you want to use BlazeDS? Just extract the blazeds.war in a temp folder, then move everything your application root folder except the web.xml (you don’t want to override yours, right?..;-) ), this will add some files in your lib folder and create a flex folder, that’s it, after that it should look like this:
Now, the trick is in the configuration, copy the content of the web.xml in your application web.xml. Ok now see what you are adding to you web.xml, you are adding a servlet that will catch all the request made to /messagebroker/*, that means all the requests made with a RemoteObject from your Flex application.
We will talk about that transaction in a different post, but this is a diagram of how this would work.
Some time ago I worked on building a Swing framework that was going to be used to build some applications at work, it wasn’t..:-s, you know the reason, the business changed their mind and decided to go thin!!!.. thats another story, but for those that worked on Swing you know that if you go deep on Swing you learn a lot, and i never though that 5 years later I was going to use all that on a new technology.
Now I am working on building a framework on top of Flex, the main reason for that is to simplify the developers coding and to keep the application source code clean, following guidelines and standards, so while researching and playing with Flex I realized that Swing and Flex are very similar, bot are event based frameworks and the basic idea of how they run on the browser is very similar but in different technologies, so to help others understand Flex I usually compare Flex to Swing, I know, I know, the comparison is ridiculous, actually I like Flex better for many reasons that I will explain later, but the way to code it is very similar (if you do everything with actionscript), basically you create a container and then you add children, then you add listeners and so on and so forth. To tell you the truth its been very easy to get into Flex thanks to Swing.
Now I have one question for those that used Swing before, do you remember the memory problems we used to have with it? Just Google it and you will see hundreds of results with the same type of problems, objects that keep referenced by others and the garbage collection never release them, listeners that never get removed and keep listening forever, etc, etc. Also you will find a lot of ways to avoid those problems (after so many years dealing with them), there are some advices about using weak listeners, there some guidelines to develop Swing applications and there are a lot of tools to find the problems. For Flex there is a profiler, but i bet is not perfect yet, meanwhile we have to be really careful developing our applications.
One of the most common memory leak issues in Swing is : Unknown or unwanted object references, and guess what?… thats the most common problem in Flex application too.
Now, I am wondering if we could use some of those guidelines to build Flex applications.









