A Funny Java Flavoured Look at the World

Wednesday, May 10, 2006

A Java developer working in Flash and it's not pretty

I have been working in Flash this week and it's so different from Java that I usually give up trying to write good object orientated code and just write code that works and get the job done.

Firstly with Flash the way everything is worded and set out I find really confusing, you have to drag components onto a "stage" and then "publish" them. I know this are small things and that the stage is just the design area and publish them is just compiling and running but the problems I have is that I often get stuck and I'm not sure what to logically do next.

I basically work by copying other examples in the code. For those that have never used flash (the way the company I work for does it) basically you have the visual bit which is called the .fla and then you name an action script file .as with the same name. Action script is just like Java script really so it's not to bad.

I admit I haven't done much GUI programming except with JSP'S so I think that why I find it difficult is because of the event listeners and the style of code. One of the things I find most confusing is understanding the work flow, in some ways most of the code acts a bit like an applet because you have an init() method and then you register for events etc.

The code I am looking at is often very messy. I don't know if this is the style or the person who wrote it but the mix of class and method scope variable seems very random and with some design put in place but there are some very long methods and global variables knocking about. Making changes to existing code can be a nightmare and you have to hope that it basically means just changing one method.

I also haven't got anything to unit test the code yet, I have had a quick look and there seems to be one unit testing framework, As Unit. I downloaded but haven't had a chance to test it out yet.

I don't mind writing programs in Flash but at the moment I am finding it a frustrating because my knowledge of Flash and the actual code base is found wanting that I am not confident to Refactoring any of the old code and am yet not quite sure how to do it, so I am really just copying and repeating the current style of code. I think this is probably a common activity that a lot of developers do when they have to fix bugs in code they are not use to.

Hopefully with more experience of both Flash and the code I should soon be able to start writing code that is easier to change.

4 Comments:

  • Try this Eclipse plugin - nothing compared to what we're used to in Java but it's the best out there:

    http://fdt.powerflasher.com/flashsite/flash.htm

    For a command line compiler many use this:

    http://www.mtasc.org/


    Also, I wouldn't put any actionscript on the stage or attached to components since it wil result in a mess. Do things programmatically. Colin Mook's book on Actionscript 2 is a good read for that. Also a great library to help is:

    http://www.alex-uhlmann.de/flash/animationpackage/

    Hope this is useful

    By Anonymous Anonymous, at Thu May 11, 01:50:00 am 2006  

  • Interesting website with a lot of resources and detailed explanations.
    »

    By Anonymous Anonymous, at Fri May 19, 08:17:00 am 2006  

  • Hi! Just want to say what a nice site. Bye, see you soon.
    »

    By Anonymous Anonymous, at Fri May 19, 08:54:00 am 2006  

  • Interesting website with a lot of resources and detailed explanations.
    »

    By Anonymous Anonymous, at Fri May 19, 07:05:00 pm 2006  

Post a Comment

<< Home