What exactly is your goal for the pages, to output to HTML/CSS or a Flash application? Flex handle XML extremely well, but its predominately a front-end platform, rather than a middle tier for processing data.
Yes, Flex can output to SWF (SWC as well), so once compiled they are quite similar to Flash-created SWFs. The difference is that it's a programming-oriented way to develop Flash applications, rather than a visual one, and is often done in Eclipse using the Flex Eclipse plugin.
The language is not the same, though, but most Java developers feel at home in ActionScript given the similar syntax.
Sai Hegde wrote:Also, I think it's best use Flex for UI purposes and integrate them with server side logic through BlazeDS, Adobe LifeCycle DS or others. This reduces the size of your swf file greatly.
Not sure I follow what you are saying here - how does BlazeDS or LCDS reduce the size of the SWF? The normal pattern for reducing download size is to break a single SWF in to components and load them on demand.
To play devil's advocate a bit - why not? You write code to be more loosely coupled this way - which is a big reason why some people prefer weakly typed languages. Assuming good, test driven development practices, and a design that follows a well understood pattern, what do you have to fear?
For the original question... I suppose you have multiple options. I personally would create a "widget project" separately, as it's own project and development lifecycle. This would allow you to be able to add them to any page you are generating as a dependency somehow.
The other thing I think I hear you wondering about is if it's possible to use Java to actually build the component. To me this means using Java (or groovy ) to generate Flex MXML and Actionscript. Depending on the complexity of the component, I guess you could do that. HOWEVER, I fear it would be too messy coupling projects together when you can simply pull the flex component in as a "prebuilt dependency" (SWF, SWC) when generating the page.
Joined: Oct 23, 2010
Sai Hegde wrote:My bad!!!
I meant to say do not process business logic on the client... I have come across many naive developers doing that.
My two cents.. I feel that a "Rich Application" does care about business logic. If nothing beyond basic webapp capabilities is required for a project, Flex may not be the right choice. A plain old webapp framework should be considered instead to deliver everything the customer needs. However, if something more than just stuffing simple html forms and divs with data with the occasional AJAX call is required, then Flex is a viable option.
Flex has a place for business logic pertinent to the user's experience or the view. The concern should fall mainly in the way you design your Flex module. In the book, Flex on Java, we demonstrate using the MVP design pattern for keeping the code clean. This is a pretty clean design pattern common for stateful and rich applications.
Flex enables developers to build business objects that know how to manage state, communicate intelligently with a server-side, and provide captivating view components. All with unit tests.