Spring ActionScript at the Devoxx Conference

ActionScript, Conferences, Flex, Spring ActionScript 1 Comment »

devoxxOn November 18th, I’ll be doing a presentation on Spring ActionScript at this year’s Devoxx conference in Antwerp, Belgium. The conference formerly known as JavaPolis is the biggest European (Java) Developers conference.This 5 day conference has an impressive speaker list each year, lots of quality content and is extremely cheap compared to other conferences. So even with the economic crisis, there is no reason not to be there…

Here’s the abstract of my presentation (link):

Spring ActionScript is an offshoot of Java Spring and brings Inversion of Control to the Flash Platform. Primarily focusing on Flex and AIR development, you’ll learn how this framework can be used to build testable and maintainable applications. We’ll take a look at the different kinds of configuration options and will also see how the minimal MVCS infrastructure fits into an application.

If you’re there and are interested in Flex development, then this session is for you.

I’m currently preparing samples and slides, so if you have anything in particular you would like to see covered, feel free to leave something in the comments. Or if you are attending the conference and would like to meet up, leave a comment as well.

Looking forward to seeing you there!


Add to Bloglines - Digg This! - del.icio.us - Stumble It! - Twit This! - Technorati links - Share on Facebook - Feedburner
 

Thoughts on Cairngorm 3 and Application Architecture

AS3Commons, ActionScript, Cairngorm, Design Patterns, Flex, Inversion of Control, Lessons learned, Microsoft, Spring ActionScript 12 Comments »

Cairngorm 3 was recently announced by Tom Sugden and Alex Uhlmann and has now been released in beta on the Adobe Opensource site.

Don’t expect an updated version of the Cairngorm framework as you know it though. Cairngorm 3 is not aiming to be an MVC implementation, and thus moves away from what version 1 and 2 were, but now consists of a set of patterns and practices, together with a series of libraries that can help to solve common problems.

The Patterns & Practices Group at Microsoft have been promoting a similar mindset for quite some time actually: Prism – patterns & practices Composite Application Guidance for WPF

I can only encourage this decision as it is exactly how I personally think about application design and architecture, especially in Flex and AIR applications. This is also what we are trying to do with Spring ActionScript: our main goal is to provide a solid Inversion of Control container that supports multiple configuration options (XML, MXML, metadata driven component scanning, …) and promote it as a foundation to build applications (and frameworks), with or without your favorite MVC framework. Although we are working on a set of base classes that provide infrastructure for your application (under the name MVCS) with Application Events, Controllers, Abstractions for service layers, … by no means do we want to market the Spring ActionScript framework as yet another MVC implementation. (You might wonder why we are calling it MVCS then, and I’m actually wondering the same… I guess marketing and buzzwords in the opensource world are also important. All kidding aside, the name is certainly subject to change).

What’s in a name

Since this is a complete change of direction for the Cairngorm framework (which it actually no longer is) I would have expected a new name. Continuing to use Cairngorm as a name is in my opinion a bad move and will cause major confusion amongst developers and other people involved in the development process. I think the best thing for Adobe, or at least their Technical Services department, would be to let go of the name and choose a new, fresh name that moves away from the past. (Besides that, who can pronounce “Cairngorm”.)

Dependencies

I noticed that some of the modules that Cairngorm 3 provides depend on other libraries/frameworks, and in general the Parsley application framework. While Parsley is certainly a major player amongst the IoC/application frameworks, and I sincerely respect the author’s work, I don’t think this is a good decision. In case you are wondering: Yes, I would say the same thing if they decided to depend on Spring ActionScript.

The usage and choice of a concrete dependency will have consequences for the adoption and integration of the libraries that Cairngorm 3 provides. Think about it: Why would you want to pull in Parsley, perhaps only to use some of its Reflection API, if you are already running on Spring ActionScript or any other IoC container?

We, the Spring ActionScript team, have actually questioned ourselves about this in the past and have therefore decided to move all the common and reusable code from Spring ActionScript into a set of libraries known as the AS3Commons project. In that respect, I’m a bit disappointed that for instance the AS3Commons Reflect library is not used for reflection purposes, since I think it is more abstracted and unintrusive than a subset of an all-encompassing application framework. Perhaps this may be our fault of not promoting the libraries and the project enough. However, I certainly think that AS3Commons could be a wonderful project and would help to provide common libraries not only to Flex and AIR developers, but to ActionScript 3 developers in general, if it were embraced by the community.

Flex and MVC

Given that RIA technolgies are still evolving at a very fast pace, it is really remarkable to see the huge amount of MVC implementations appear. Not specifically aimed at Cairngorm (at least the previous versions), but rather at almost all MVC architectures available for Flex development, my personal feeling and experience is that the use of MVC architectures in the Adobe RIA space is almost a dogmatic thing and is not needed in most cases. The problem is that people just take an MVC framework as it is and implement it in their applications. More than often not questioning whether or not its usage is justified. Things that could easily and cleverly be solved are ripped apart across layers of the architecture, introducing levels of indirection that are in most cases not needed. The only thing they add is complexity and counter-intuitive development practices.

One of the main arguments for using an MVC framework is that the code is “easy to understand”. Of course the code will be easy to understand if you have been developing with the framework of choice for the N-th time or if you have been digging into the code for a serious amount of time, but ask a newcomer to look at the code and try to explain to you what it is actually doing… I think you’ll be surprised by the responses.

I’m not saying that the use of a particular MVC framework is de facto a bad thing, but the “religious” use and the blind adoption and implementation make a framework a killer for your application. I would encourage everyone to start their next project without an MVC framework and just use the Flex framework with a healthy knowledge of design and presentation patterns. And even if you are using an MVC implementation, think about each layer you introduce, why you need it and the pros and cons it brings.

Conclusion

It’s good to see that Adobe is rethinking their approach to RIA architecture and development practices. I also hope that they will be more open to community input and feedback than they were in the past. Although they did several attempts at engaging the community, I don’t think they really succeeded in that. If not open enough, people will just continue to fork the “framework” and provide extensions that will end up in alternative implementations anyway.

I’m looking forward to seeing how all of this evolves.


Add to Bloglines - Digg This! - del.icio.us - Stumble It! - Twit This! - Technorati links - Share on Facebook - Feedburner
 

Spring ActionScript 0.8.1 Released

ActionScript, Air, Flash, Flex, Spring ActionScript 4 Comments »

Dear Community,

I’m pleased to announce that the Spring ActionScript 0.8.1 release is now available.

Download | API Documentation | HTML Docs | PDF Docs | Changelog

This release includes the Spring ActionScript framework, the Cairngorm extensions and the PureMVC extensions and is mainly a bugfix release based on user feedback, for which we are very grateful.

Besides a series of bugfixes, we have also refactored the stage wiring system a bit so it now enables you to extend it with custom functionality. Two proof-of-concept implementations were added, namely the LocalizationStageProcessor and the SimpleSecurityStageProcessor.

LocalizationStageProcessor

This first processor enables you to assign resource values to components that are added to the stage, thus removing the need to add binding code for components at design-time. The values are assigned on a simple ‘configuration-by-name’ basis: a resource string in the form ‘myButton_label=Click me’ will assign the value ‘Click me’ to the label property of a stage component with the id ‘myButton’.

There’s a small sample app as well showcasing the localization processor.

SimpleSecurityStageProcessor

The second processor is slightly more elaborate and offers runtime security/authorization functionality.

There’s also a small sample application for this processor.

Basically what this processor does is create an ISecurityManager instance for a given component that is added to the stage. (Whether or not this creation will be considered is determined by the approval result of an IObjectSelector). This ISecurityManager holds a list of role and right names that are applicable for the specified stage component and is able to block access to the component after evaluation of these security rules.

The way to block access is determined by the AccessStrategy enum, that is part of the SimpleStageSecurityManager implementation of the ISecurityManager. It can set the enabled property to false, or visible to false, etc. The implementation of these security interfaces is SIMPLE, hence the names. For now, we didn’t want to include a very elaborate implementation since security can vary very widely from application to application. These interfaces are really meant as a ‘roll-your-own’ package, Spring ActionScript just offers the infrastructure in this case.

Last Words

Although this is a minor release, we would recommend all users to upgrade.

Further, we are always looking for user feedback and input. Be it bug reports, patches, new ideas, etc, all help is welcome. If you think you can contribute to the project in whatever way, don’t hesitate to leave something in the comments or mail me at christophe [DOT] herreman [AT] gmail [DOT] com.


Add to Bloglines - Digg This! - del.icio.us - Stumble It! - Twit This! - Technorati links - Share on Facebook - Feedburner
 

Marking Deprecated Classes and Methods in Flex

ActionScript, Flex, IntelliJ IDEA 4 Comments »

A feature of the Flex SDK is that you can mark deprecated classes and methods via the [Deprecated] metadata tag. The goal of deprecating code is to inform developers that code will disappear in an upcoming release of a library or framework. Developers can then change their code to use the appropriate replacement and prevent problems when upgrading to newer versions. For more info, read How and When to Deprecate APIs.

The need for deprecation comes about because, as a class evolves, its API changes. Methods are renamed for consistency. New and better methods are added. Attributes change. But making such changes introduces a problem. You need to keep the old API around until people make the transition to the new one, but you don't want developers to continue programming to the old API.

Here's an example:

Actionscript:
  1. package org.as3commons.reflect {
  2.  
  3.   [Deprecated(replacement="org.as3commons.lang.ClassUtils", since="1.1")]
  4.   public class ClassUtils {
  5.  
  6.     [Deprecated(replacement="org.as3commons.lang.ClassUtils.forInstance()", since="1.1")]
  7.     public static function forInstance(instance:*, applicationDomain:ApplicationDomain = null):Class {
  8.       // ... method body ommitted
  9.     }
  10.   }
  11. }

Depending on the IDE you are using, you will even get visual hints when you are using deprecated code. Here's how IntelliJ IDEA supports this. (Click to enlarge)

intellij-idea-deprecated-hint

Note that I'm using an early build of the upcoming version 9 of IntelliJ IDEA, codenamed "Maia", in which Flex support has significantly been improved. You can get the prereleases here.

You can also use this on other metadata tags such as Style, but in a slightly different form:

Actionscript:
  1. [Style(name="backgroundColor", type="uint", format="Color", inherit="no", deprecatedReplacement="swatchPanelStyleName", deprecatedSince="3.0")]

For more info on the [Deprecated] metadata tag, see the Flex documentation.

I haven't tested how deprecations are handled in Flex/Flash Builder and the ASDoc system. If anyone knows, don't hesitate to add extra info in the comments and I will update this post.

Update The [Deprecated] metadata tag was posted about some time ago in this blogpost, which made me believe it was undocumented or at least it was at the time of writing. Thanks to Bobby Parker for posting the link to the Flex 3 docs in which the metadata is clearly documented.


Add to Bloglines - Digg This! - del.icio.us - Stumble It! - Twit This! - Technorati links - Share on Facebook - Feedburner
 

Spring ActionScript 0.8 Released

ActionScript, Air, Flash, Flex, Spring ActionScript 15 Comments »

Dear Community,

I'm pleased to announce that the Spring ActionScript 0.8 release is now available.

Download | API Documentation | HTML Docs | PDF Docs | Changelog

This release includes the Spring ActionScript framework, the Cairngorm extensions and the PureMVC extensions.

All libraries are available for download at the following Maven repository: http://projects.yoolab.org/maven/content/repositories/

From now on, we will regularly publish new snapshots of the libraries there.

Direct links to the libraries:
- Spring ActionScript 0.8
- Spring ActionScript Cairngorm 0.8
- Spring ActionScript PureMVC 0.8

Dependencies:
- AS3Commons Lang
- AS3Commons Logging
- AS3Commons Reflect

Note: AS3Commons Lang is a snapshot of 1.0. We will work with a release for the following releases of Spring ActionScript

Besides a series of bugfixes, optimizations and improvements, some of the major changes and enhancements include:

Autowiring support

Using autowiring allows you to inject objects managed by the container into view components and other objects. To autowire a property, annotate it with the [Autowired] metadata tag. The support we build in is pretty enhanced and allows you to customize the autowire behavior in many different ways. Within the Autowired metadata tag you can specify the object name and you can also configure the container to filter autowire candidates using your own filter specifications. Please see the documentation on autowiring for more info.

Custom Namespaces

The XML configuration now supports namespaces and allows you to create custom namespaces yourself. A few namespaces have been added to simplify the configuration of common objects for RMI and Messaging. More info on available namespaces and schemas and creating custom ones can be found in the documentation. The XSD schemas are available http://www.springactionscript.org/schema/

MXML Configuration

We now also support configuration through MXML. The markup is very similar to the regular XML config, but with some slight differences. Please see the documentation on MXML Configuration

AS3Commons

As a side project, we have started the AS3Commons project that offers reusable ActionScript 3.0 libraries. Most of the libraries currently available in AS3Commons are build using code from the Spring ActionScript framework. This means that a lot of code has been removed from Spring ActionScript and is now available for use in projects not using Spring ActionScript. Please note that you might have to update quite some import statements to refer to AS3Commons instead of Spring ActionScript. We apologize for any inconvenience this might cause, but this is only a one-time process.

We hope you find the AS3Commons libraries useful. All libraries (releases and snapshots) can also be found at the Maven repository.

Documentation

The documentation has been tremendously improved in this version. Next to the API documentation, we now provide a reference guide in HTML and PDF format. General info can be found at the project website: www.springactionscript.org

Last Words

If you feel like helping us out, we could certainly use your help. This project is entirely created on a volunteer basis and in our spare (and limited) free time so needless to say that the more people, the faster we can deliver new releases and guarantee the quality of the framework. So if you think you have someting to offer, be it as a developer, tester, documentation writer, sample creator, ... please contact me (christophe [DOT] herreman [AT] gmail [DOT] com) or leave something in the comments. All help is more than welcome.

Enjoy this release and have fun coding!


Add to Bloglines - Digg This! - del.icio.us - Stumble It! - Twit This! - Technorati links - Share on Facebook - Feedburner
 
WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in