Enterprise Flex with Anvil
In this post, Anvil project founder Ryan Knight shares about his open source project with InfoQ.com. Anvil is an open source project that was built to help make Enterprise Flex development easier. In addition, it provides a portal environment for running Flex applications.
First, Ryan provided InfoQ an overview of Anvil:
A little bit of history might help explain Anvil. In May 2007 I started a project for Williams Gas Pipelines writing a new Enterprise Flex project. At the time Flex was just starting to be used in the enterprise for large applications. We could see there where going to be a lot of challenges to creating a large application in Flex, so we enlisted the help of James Ward, a Flex Evangelist from Adobe. He provide a lot of the early guidance of how to modularize the application, how to handle events at different layers of the applications, etc. As part of this collaborative effort we decided to start an open source project around this core framework.
What has been nice about having Anvil as part of the core frame work of an actual project, is I have been able to contribute a lot of my work done at Williams to the open source community. Also it has been heavily used, so a lot of the most obvious bugs have been worked out. Also during this time we have met several times with James to get architectural direction and help with coding. What you have today then is a high-level framework that solves some of the biggest challenges developers will face when building large Flex Application. Today Anvil provides a number of useful pieces, such as a layout environment, security that integrates with Spring Security, module loading and management and many other things. It also provides a portal framework based on the Flex MDI project (now part of FlexLib). This provides layout and window management.
Next, Ryan shared how Anvil differs from other Flex frameworks:
Anvil tackles a different set of problems than frameworks like Mate and Cairngorm. Those frameworks address the lower level issues of MVC. Anvil is focused more on the large picture of how do we effectively architect large applications in Flex. In most cases it can be used with other frameworks like Mate. We did find that Cairngorm does not work though, because Cairngorm assumes only one copy of the MVC. With modules you might have the same module loaded multiple times, so in essence you have a micro MVC for each module. This paradigm breaks in Cairngorm for example when a module fires an event to update the model. This update should be isolated to a single module, but Cairngorm propagates the event globally.
On Anvil's licensing:
Apache 2.0 - use as as desired but just let use know what you are doing with it.
Ryan then shared how others can benefit from Anvil:
I have always learned best from the code of others. For example one of the most difficult part of the project was putting together the ant build process. To figure out how to do this I actually copied a lot of ideas from Googles GWT project build process. So even if you already have an application well under way, I think there is a lot that can be learned from Anvil. It was a huge learning curve for use to put together and we faced a number of technical challenges.
For new applications we highly recommend looking at Anvil and seeing if it fits. It can help in providing a simple portal environment in which to display and layout portlets. It also has menu system that allows for the user to choose which portlets to display.
InfoQ then asked Ryan to discuss Flex modules and how Anvil uses them:
This was one of the biggest lessons we learned from James, was how to work with Modules. We have tried to capture these best practices in Anvil by providing utilities to handle module loading and management. Breaking an application into modules provides a number of benefits, such as developers being able to work on isolate parts of the application. This is nice so you don't have to load the entire project into Flex Builder. Anvil also provides the ant scripts to easily compile flex applications. This combined with modules provides another benefit when compiling the entire application, modules allow the compilation to be threaded to speed up compile times.
When it comes to run time and deployment modules have another benefit. A small part of the application can be loaded at startup to provide a quick user response. Then other parts of the application can be loaded on demand in the background. In this way individual modules can be secured or even distributed to different machines for load balancing or fail-over.
Lastly, InfoQ asked Ryan what else our readers need to know:
Right now we are really looking for feedback from the community. We have a lot of ideas of where to take Anvil, but we want to make Anvil useful for a broader audience. I discuss a number of them in a recent video interview I gave to DrunkOnSoftware.com.
Also I have recently joined Gorilla Logic (www.gorillalogic.com) and am looking at how we can incorporate there work on Flex Monkey (http://code.google.com/p/flexmonkey). We are looking at ways to test individual modules in Anvil using Flex Monkey.
Mostly though we would like ideas from the community of what the would find the most useful.
Thanks for your time, Ryan
To get started with Anvil use Ryan's tutorial, An Introduction to Anvil.
Tiago Romero Garcia Mar 01, 2015
How Can We Use Our Creative Power and Technological Opportunity to Address the Challenges of the 21st Century?
Gyorgyi Galik Feb 26, 2015