26
Aug
stored in: Code, Flash and tagged:

Gaia and Robotlegs together

I have been doing a fair bit of adventuring in unchartered territory these last couple of months and the main things I have learnt is the concept of using programming frameworks.  I was recommended this combination by a wise person at the beginning of a project a project a few months ago .

About Gaia

Gaia is a fantastic front end framework made by Steven Sacks and has been around quiet some time.  It takes care of all the monotonous things at the start of the project and manages your assets. You simply write a XML for the basic layout of your site, and GAIA Does this for you;

  • Creates a new FlashDevelop Project
  • Creates all FLA (Index,Main,Nav,Preloader etc)
  • A FLA for each page with document Class
  • Some placeholder Page Animations
  • SWFAddress for Routing/Deeplinking
  • Placeholder navigation
  • SEO (yes it works)
  • Asset managment

All in one click, it’s a fantastic tool that I’d recommend, it does however has it’s limitation and uses so it’s not for every project.

After the initial Gaia scaffolding of the, you access Gaia using it’s very well documented API to handle global navigation and the state off the site (e.g. which page you are on ), after that though, you are on your own (which is great!) , Gaia keeps out of your way so you can do whatever you like, it  tries to be non-obstructive and doesn’t tie you down like some other front end frames works I’ve tried to use.

About Robotlegs

I wrote a blog entry on Robotlegs a few weeks ago, I’ve learnt a large amount since then but it’s still relevant to now. I’ll take a quote from there

“Robotlegs is a Framework based upon the MVC (Model View Controller) design pattern, MVC is a universal software architecture pattern that is used within many object oriented programming languages.  The Model is your program state, keeping your program variables and overall keeping the data for your program state. The View is everything that the user users, anything from a Movieclip, to a button to a sound.  And the controller is the medium that connects the view to the model.  There’s a ton of information about the MVC model if you want to know more about it.  What Robotlegs tries to do is help you program your application together, there’s no strict hard rules but more so a blueprint to get you started.”

Full article here

http://www.simtechmedia.com/blog/2010/07/my-experience-so-far-with-robotlegs/

Why use them together?

If you have two fantastic AS3 frameworks than why use them both at the same time?  Do some of their roles double up on each other? I would say yes, but there is definitely solid roles both can play in making a application where both can work in harmony, there is definitely grey area between the two frameworks and how you develop is up the actual developer (at it should be!)

Using both frameworks you can separates all front end visual tasks from your application. In a common scenario a Flash Designer will create all the pages/sections/assets of the website, Gaia itself has no knowledge of what Robotlegs is or is doing , as far as Gaia is concerned, it’s a self contained part of your flash website and is dispatching user interface events, this is pretty typical of what a VIEW does in a MCV type application.

How to use them together

So how do you use both of these technologies together? I won’t go into detail on how to use Robotlegs as there’s many resources out there to do that. Here is my approach on getting things wired together.

The typical setup is have your Context in Main, that way any Robotlegs and Gaia have a direct path to each other.

The next step is to have public functions in your Gaia pages that you would want Robotlegs to have access too, then create a Interface for your Gaia pages to make those functions visible.

Next step adding the Mediator in your Context

mediatorMap.mapView("com.roboGaia.pages.GaiaPage", GaiaPageMediator, IGaiaPage);

Notice I am not importing the Gaia Page class into my Context but a reference to it, this is so Robotlegs is not importing the whole class, just a reference to it. First variable is your Class path to your view, then your mediator , then your interface. Here is how it’s all communication is made between Gaia and Robotlegs.

What’s in the mediator and what’s in the View in this setup?

This is a infamous question that has popped up several times in my travels; where should the listeners for the UI sit, one option is this, the View listeners for its own UI, and sends UIEvent through the interface like so;

Another option is to have the UI listeners in the mediators and have the view be objects with no listeners as such;

I am a fan of the first approach as you don’t need anything to be on the mediators and it makes the mediators a bit lighter, there’s arguments for both approaches but it’s up for personal interpretation.

In Ending…

I hope you have found this entry interesting, this last couple of weeks on this project has taught me quite a bit and I hope someone out there finds some use it in. Feel free to contact me about anything I wrote about in email or twtter

10
Jul

Robotlegs Logo

I’ve been using with Robotlegs these last couple of weeks and jumping on the latest craze that seems to be sweeping through the AS3 development community.  Coming from someone who has never fully implemented a AS3 framework before (but I do understand design patterns and concepts) the learning curve was actually quiet hard.   I’m sure that anyone who is familiar with PureMVC would feel right at home as it seems to continue where PureMVC had left off with a few less of its downfalls.

I took it upon myself to spend a full weekend trying to start a fresh project using it, now that I’ve gotten a firmer grasp of the Robotlegs framework , I can honestly say I don’t know how I could lived without it, makes making any type applications that revolves around dynamic data so much easier to create.

Brief introduction to Robotlegs
Robotlegs is a Framework based upon the MVC (Model View Controller) design pattern.  It is a universal software architecture pattern that is used within many object oriented programming languages.  The Model is your program state, keeping your program varibles and overall keeping the data for your program state. The View is everything that the user users, anything from a movieclip, to a button to a sound.  And the controller is the medium that connects the view to the model.  There’s a ton of information about the MVC model if you want to know more about it.  What Robotlegs tries to do is help you program your application together, there’s no strict hard rules but more so a blueprint to get you started.

Why use a framework at all?
The main reason for me to use a framework is that it saves time,  I don’t think they’ll ever be a situation where you could say ‘you need to use a framework for this project will be impossible to complete’, frameworks are there to assist you, and it makes larger projects much more structured and controlled therefore saving  you (or your employer) time, or gives you more time in making your application better rather than doing your boiler plate stuff (the things you should do but half the time you don’t).

Everything has its place
Even though Robotlegs lets you use the frameworks how you like, there’re best practices you should try to follow while using the it, the beauty the framework is that if it’s not working, most likely your doing something wrong and against the framework flow. (As a wise guy once told me).

Complete decoupling and Strong cohesion
Frameworks makes it much easier to decouple the classes from each other, the view and the model are completely separated and have no idea about each.   The view is very ‘ignorant’ , it has no idea what’s going on, while the model has no idea how the data arrives to it, it has its own responsibility of keeping data it has received valid and has no idea what else is happening in the framework.

Helps collaborated development easier
I am currently working on a project where another developer is working with me on the User Interface elements while I’m working on the data parts, about 98% of the time anything he changes will not break what I’m working on and likewise, this is another benefit of having things decoupled.

Reusable Code
I know us Objected Oriented Programmers try to make classes we can reuse, but for me the hit rate of this has been pretty sparse, I have reused snippets of functions and classes, but no whole classes reused.   But with making Robotlegs classes I believe that the next major project I work on I’ll be able to re-use some of the models, commands and services I create.

Quicker debugging and launch
Another time saving ability is how quickly the debugging process is, soon as a bug comes up you know exactly where the bug comes is and where it’s isolated to, and you less likely run into the problem of breaking something unrelated while debugging.

Conclusion
I know this blog entry has been me banging the Robotlegs war drum a bit hard, but I really do think it’s a great tool for any as3 developer who wishes to ‘take it to the next level’, below are some resources to get you started. – Enjoy

Resources
http://www.robotlegs.org/
- Robot Legs Home page, great resources there
http://johnlindquist.com/2009/11/18/robotlegs-hello-world-video-tutorial/
- Tutorial on Robotlegs by legendary John Lindquist
http://insideria.com/2010/06/robotlegs-for-framework-beginn.html
- Pretty good Starting tutorial on Robotlegs

I’ve been using with Robotlegs these last couple of weeks and jumping on the latest craze that seems to be sweeping through the AS3 development community. Coming from someone who has never fully implemented a AS3 framework before (but I do understand design patterns and concepts) the learning curve was actually quiet hard. I’m sure that anyone who is familiar with PureMVC would feel right at home as it seems to continue where PureMVC had left off with a few less of its downfalls.

Here are my initial reactions of using Robotlegs

I took it upon myself to spend a full weekend trying to start a fresh project using it, now that I’ve gotten a firmer grasp of the Robotlegs framework , I can honestly say I don’t know how I could lived without it, makes making any type applications that revolves around dynamic data so much easier to create.

Brief introduction to Robotlegs

Robotlegs is a Framework started by

Why use a framework at all?

The main reason for me to use a framework is that it saves time, I don’t think they’ll ever be a situation where you could say ‘you need to use a framework for this project will be impossible to complete’, frameworks are there to assist you, and it makes larger projects much more structured and controlled therefore saving you (or your employer) time, or gives you more time in making your application better rather than doing your boiler plate stuff (the things you should do but half the time you don’t).

Everything has its place

Even though Robotlegs lets you use the frameworks how you like, there’re best practices you should try to follow while using the it, the beauty the framework is that if it’s not working, most likely your doing something wrong and against the framework flow. (As a wise guy once told me).

Complete decoupling and Strong cohesion

Frameworks makes it much easier to decouple the classes from each other, the view and the model are completely separated and have no idea about each. The view is very ‘ignorant’ , it has no idea what’s going on, while the model has no idea how the data arrives to it, it has its own responsibility of keeping data it has received valid and has no idea what else is happening in the framework.

Helps collaborated development easier

I am currently working on a project where another developer is working on the User Interface elements while I’m working on the data stuff, about 98% of the time anything he changes we break what I’m working on and likewise, this is another benefit of having things decoupled.

Reusable Code

I know us Objected Oriented Programmers try to make classes we can reuse, but for me to achieve that has pretty sparse, I have reused snippets of functions and classes, but no whole classes I reused. But with making Robotlegs classes I believe that the next major project I work on I’ll be able to re-use some of the models, commands and services I create.

Quicker debugging and launch

Another time saving ability is how quickly the debugging process is, soon as a bug comes up you know exactly where the bug comes is and where it’s isolated to, and you less likely run into the problem of breaking something unrelated while debugging.

Conclusion

I know this blog entry has been me banging the Robotlegs war drum a bit hard, but I really do think it’s a great tool for any as3 developer who wishes to ‘take it to the next level’, below are some resources to get you started. – Enjoy

Resources

http://www.robotlegs.org/
- Robot Legs Home page, great resources there

http://johnlindquist.com/2009/11/18/robotlegs-hello-world-video-tutorial/
- Tutorial on Robotlegs by legendary John Lindquist

http://insideria.com/2010/06/robotlegs-for-framework-beginn.html
- Pretty good Starting tutorial on Robotlegs

08
Jul
stored in: Flash and tagged:

Been too long since I’ve updated my Blog , I promise you I haven’t lost interest! Just been so busy, I will post some of my latest findings very soon

24
Mar
stored in: Flash and tagged:

Here is a screenshot of my first UML chart I made in VISIO for the project I’ve been working on for quiet some time now. (indecat)

I’m really digging it, makes visualising where you are going when making a big program easier

The Program is still far from ideal, I actually would love to try and remake it using a premade framework such as robot legs (everyone is raving about it)

21
Mar
stored in: Travel and tagged:

Just got back not long ago from travelling through Vietnam and Hong Kong! Was pretty good and got some great photos

09
Feb
stored in: Flash and tagged: , , ,

Alright, I have tried to use UML to create a class relationship diagram in the latest build of a project. I’m still trying my hardest to find a tool that is effective with AS3 but so far Visio seems to the goer for now. It’s still missing events and the ability to show/hide attributes and methods which is a major bummer, but i’m sure i’ll figure it out.

01
Feb
stored in: Flash and tagged: , , ,

Apple’s iPad, HTML5 Video, Gaia Flash Framework – JXLTV – Episode #3

http://jessewarden.com/2010/01/apples-ipad-html5-video-gaia-flash-framework-jxltv-episode-3.html

Interesting video blog by industrial pro Jesse warden, he goes into some pretty interesting idea’s and thoughts on the new iPad. He also goes through some new framework called Gaia, which I haven’t heard of before, should be interesting to look into further

30
Jan

There is huge debate on the Flash’s future when devices like the iPad wont support it, it’s safe to assume that the iPad will become popular by the response of the public, given that most apple mobile devices are indeed becoming increasingly popular it does stick in the back of my mind that i’m specialising in a dying trade.
With the looming HTML 5 beta looking to maybe give Flash Video a bit of greif, I should be wondering if I should be touching up on my PHP, Ajax and Html skills?

28
Jan
stored in: General and tagged:

I’ve started using Visio to map out my programs and such, I used to use illustrator to do program diagrams but became very cumbersome when the lines started to mass.  With Visio the lines sort themselves up so I’m focusing on my mind on actual developing instead of making diagrams neat.

10
Jan
stored in: Flash and tagged:

Flash builder 3 is the renamed Flex builder that will take over the rename Flex platform from Adobe.  I have been a light user of the flex platform for quite a while now, using it for smaller projects once a while.  While the learning curve was quiet small because of my previous experience with ActionScript 3 I never liked working with the script editor with Flex builder 2, but with Flash Builder 3, it’s much improved. I was working with a decent sized project and the Flex framework and UI made it pretty comfortable to work with, the script editor was pretty good. I read that the new version of Flash will have better integration for Flash Builder to use as the primary script editor, while this is fantastic , I don’t think it will replace the (imo) better and free FlashDevelop for me anytime soon.