Archive

Posts Tagged ‘PureMVC’

AS3 framework option #3

January 24th, 2012 5 comments

After analyzing 2 most popular framework both from syntax and performance point of view – I realized that both frameworks is not good enough for me. I work mainly with games and heavy applications that requires both code writing speed and code execution speed. With that knowledge I did what any programmer usually does in such situation – started my own project! where everything will be perfect! it will be fast! it will be comfortable to work with! and sun will shine all day long!

So I started with writing requirements…

Read more…

RobotLegs VS PureMVC: performance battle!

January 6th, 2012 2 comments

We all know that using framework in you application will hurt performance, and Flash has long and sad history of performance problems. I decided to find out how much exactly performance using framework costs us. As in last post I focus on 2 most popular frameworks: RobotLegs and PureMVC.


Run PureMVC tests           [Source code: PureMVCSpeedTest.zip]

I tried to measure 4 things: running commands, getting stuff, creating mediators, communication.
I measured how much time one such action will take, and calculated how much actions you can use in your code to waste 1ms of execution time.

PureMVC VS RobetLegs match-up!

December 14th, 2011 1 comment

Then you start creating bigger applications, or start working in bigger teams – using good framework becomes essential.
I spent good amount of time with 2 currently most popular AS3 frameworks – PureMVC and RobotLegs, and here I will compare pros and cons of both.



Generally both frameworks are very similar! :


RobotLegs and PureMVC Pros:

  • will help divide your code is small units and wire them;
  • will help standardize your code;
  • based on MVC;
  • can be extended to your needs;
  • makes you focus on your fun app instead of focusing on solving architecture puzzles;
  • have big and active communities;



RobotLegs and PureMVC Cons:

  • hurts performance a bit;
  • harder to debug “black box” framework code;
  • couples implementation with framework;



…but RobotLegs: Read more…

Magic there FlashDevelop meets PureMVC

October 6th, 2011 No comments

I work with PureMVC - very popular and flexible framework .

Another tool that lets you enhance your work is FlashDevelop, it’s free, it has amazing templates and snippets to speed your work.

Now imagine what happens then those 2 meet each other. MAGIC HAPPENS!

There are couple of things that makes writing PureMVC not fun. That is:

  • Creating proxies, mediators and commands. They must be written as framework demands it.
  • Getting your mediators and proxies also annoys. It’s lot of typing – all this getting and casting…

Luckily with FlashDevelop file templates and snippets you totally remove the hassle of doing those not fun things in PureMVC!

Class templates: DerilsPureMvcTemplates.zip

this has to be unzipped to :  your “Application files” folder  - …\Templates\ProjectFiles

I will explain couple of things. That is special to my ‘style’ of using PureMVC.

  • I name ‘notice’ for notification object. I use class “Note”,”ViewNote”, “DataNote” as constant holders. I wanted to separate those for quicker typing/code hinting. Just rename it in mediators and commands if you use something else.
  • There are 2 variations of mediator and 2 variations of proxy, one with data/viewComponents sent to super class, and one that just keeps it locally. I rarely set it to super class, but sometimes it’s needed.
  • I don’t bother casting data or viewComponent to it’s data type, and never will, I store them locally with needed type. Cast object every time you need to use it is a total nonsense, the only danger is setting different object for custom and super classes, but that’s easily fixed ovverideng setData/setVeiwComponent functions. What I did in templates.
  • Code style: brackets on the line, package is not intended.

 

Snippets:

Get proxy(I named it “!retrieveProxy”):

var $(EntryPoint)$(CurWord):$(CurWord) = facade.retrieveProxy($(CurWord).NAME) as $(CurWord);

Get mediator(I named it “!retrieveMediator”):

var $(EntryPoint)$(CurWord):$(CurWord) = facade.retrieveMediator($(CurWord).NAME) as $(CurWord);

 

Usage scenario:

  • ctrl+alt+ space to get class hinting
  • write and pick class (mediator or proxy)
  • use one or another snippet (I use keyboard shortcuts through macros)
  • press delete to delete first letter.
  • write deleted letter in lower case.

I create macro to use those snippets and map them on CTRL+ALT+1 and CTRL+ALT+2;

They look like this:

InsertSnippet|!retrieveProxy
InsertSnippet|!retrieveMediator

: initialize note constant quickly.
Depricated. I was using snippet to generate constants quicker:

$(CurWord):String = “$(CurWord)”

but lates FlashDevelop 4.0.0 RC1 does it automaticaly now.

Have fun.

MindScriptAct is Stephen Fry proof thanks to caching by WP Super Cache