This post originated from an RSS feed registered with Java Buzz
by Ben Hosking.
Original Post: A Java developer working in Flash and it's not pretty
Feed Title: A Funny Java Flavoured Look at the World
Feed URL: http://businesslogs.com/WebLog/RSS.xml
Feed Description: The blog looks at using Java and programming in general as it pops up in life as a Java programmer. It will have links to interesting Java articles and resources. It will also have a lot of SCJP Java 1.5 information and links as I am currently studying
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.