Spring ActionScript
Upcoming SlideShare
Loading in...5
×

Like this? Share it with your network

Share

Spring ActionScript

  • 9,477 views
Uploaded on

Spring ActionScript presentation files from FlexCamp 2008 in Antwerp (Belgium)

Spring ActionScript presentation files from FlexCamp 2008 in Antwerp (Belgium)

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
9,477
On Slideshare
5,918
From Embeds
3,559
Number of Embeds
9

Actions

Shares
Downloads
114
Comments
0
Likes
5

Embeds 3,559

http://www.herrodius.com 3,539
http://www.slideshare.net 12
http://translate.googleusercontent.com 2
http://74.125.93.104 1
http://209.85.129.132 1
http://74.125.77.132 1
http://webcache.googleusercontent.com 1
http://www.diigo.com 1
http://www.slideee.com 1

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Christophe Herreman www.herrodius.com <Flex:Camp/> Belgium 11 December 2008 Prana goes Spring Introducing Spring ActionScript
  • 2.
    • What is Spring ActionScript ?
    • An Inversion of Control (IoC) Container for ActionScript 3.0
    • Based on Java Spring
    • Current release 0.6
    • Incubated as a Spring extension, working towards a 1.0 release
    June 6, 2009 Spring ActionScript | <flex:camp/> Belgium
  • 3.
    • What is Spring ActionScript ?
    • Cairngorm support
    • PureMVC support
    • Reflection API
    • Several Utilities (Assert, FlexUnitTestCase, …)
    • Domain base classes (Entity, ValueObject, …)
    • AOP, MVCS, …
    June 6, 2009 Spring ActionScript | <flex:camp/> Belgium
  • 4.
    • What is Inversion of Control ?
    • Inversion of Control, also known as IOC, is an object-oriented programming principle that can be used to reduce coupling inherent in computer programs.
    June 6, 2009 Spring ActionScript | <flex:camp/> Belgium
  • 5.
    • Types of Inversion of Control ?
    • Dependency Lookup
      • Dependency Pull
      • Contextualized Dependency Lookup
    • Dependency Injection
      • Constructor Injection
      • Setter Injection (see MXML)
    June 6, 2009 Spring ActionScript | <flex:camp/> Belgium
  • 6.
    • Constructor Injection
    • Class MyClass {
    • public function MyClass(dependency:IDependency) {
    • this.dependency = dependency;
    • }
    • public function doSomething():* {
    • var somethingDone:* = dependency.getSomethingDone();
    • return markAsDone(somethingDone);
    • }
    • }
    • var instance:MyClass = new MyClass(new ConcreteDependency());
    • instance.doSomething();
    June 6, 2009 Spring ActionScript | <flex:camp/> Belgium
  • 7.
    • Setter Injection
    • Class MyClass {
    • private var dependency:IDependency;
    • public function set dependency(value:IDependency):void {
    • this.dependency = value;
    • }
    • public function doSomething():* {
    • var somethingDone:* = dependency.getSomethingDone();
    • return markAsDone(somethingDone);
    • }
    • }
    • var instance:MyClass = new MyClass();
    • instance.dependency = new ConcreteDependency();
    • instance.doSomething();
    June 6, 2009 Spring ActionScript | <flex:camp/> Belgium
  • 8.
    • Inversion of Control?
    • Prefer setter injection
    • Type to interfaces !!!
    • Centralized configuration
    • Maintainability
    • Reusability
    • Testability
    • ...
    • Though counter-intuitive at first !
    June 6, 2009 Spring ActionScript | <flex:camp/> Belgium
  • 9. What is an IoC Container ? Creates and assembles components/objects and manages their lifecycle. Spring ActionScript uses an XML dialect to define the “application context” (what objects are available and how they are related) June 6, 2009 Spring ActionScript | <flex:camp/> Belgium
  • 10. The Application Context // setter injection <objects> <object id=“instance” class=“MyClass”> <property name=“dependency” ref=“dependency”/> </object> <object id=“dependency” class=“ConcreteDependency”/> </objects> June 6, 2009 Spring ActionScript | <flex:camp/> Belgium
  • 11. The Application Context // constructor injection <objects> <object id=“instance” class=“MyClass”> <constructor-arg ref=“dependency”/> </object> <object id=“dependency” class=“ConcreteDependency”/> </objects> June 6, 2009 Spring ActionScript | <flex:camp/> Belgium
  • 12. Working with the IoC container <mx:Application xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot; creationComplete=&quot;onCreationComplete()“> ... private function onCreationComplete():void { _applicationContext = new FlexXMLApplicationContext(“application-context.xml”); _applicationContext.addEventListener(Event.COMPLETE, onApplicationContextComplete); _applicationContext.load(); } private function onApplicationContextComplete(event:Event):void { var instance:MyClass = _applicationContext .getObject(“instance”); } ... </mx:Application> June 6, 2009 Spring ActionScript | <flex:camp/> Belgium
  • 13.
    • Application Contexts
    • XMLApplicationContext
      • AS3 compatible
    • FlexXMLApplicationContext
      • Flex specific: adds support for ArrayCollection, …
    June 6, 2009 Spring ActionScript | <flex:camp/> Belgium
  • 14.
    • IoC Container Conclusion
    • Objects defined in external XML file
    • Loaded at runtime
    • Centralized dependency management
    • Managed by container
    • Deploy your application with different configurations without recompiling!
    June 6, 2009 Spring ActionScript | <flex:camp/> Belgium
  • 15.
    • Resources
    • www.pranaframework.org
    • www.herrodius.com
    • Objects Reference (the IoC container): http://static.springframework.org/spring/docs/2.5.x/reference/beans.html
    • Forum: http://forum.springframework.org/forumdisplay.php?f=60
    • SVN: https://src.springframework.org/svn/se-springactionscript-as
    • FishEye: https://fisheye.springframework.org/browse/se-springactionscript-as
    • Jira: http://jira.springframework.org/browse/SESPRINGACTIONSCRIPTAS
    • WTP: http://download.eclipse.org/webtools/updates/
    June 6, 2009 Spring ActionScript | <flex:camp/> Belgium
  • 16. Questions?