/customers/iconara.net/iconara.net/httpd.www/blog/wp-content/plugins/wp-super-cache/wp-cache-phase1.php Iconara » Flash programming confidential, monday

Flash programming confidential, monday

This week I’m working for a web production company with a little bit of everything. Today I was asked to help in a project where the Flash developer was on paternity leave. The project was overdue and there were things that didn’t work, no huge problems, but things that needed to be fixed. I sat down with the .fla in order to find the relevant part of the project and see how hard it would be to fix. One hour later I gave up.

It wasn’t that it was a particularly bad example of Flash programming, it was just too big, to unorganised and generally just bad style. This like _parent._parent._parent were common, as were repeated code, global variables, meaningless symbol names, etc. There was really no discernible structure, there seemed to have been a though of organising the multitude of symbols in folders, but I found no logic to them. I would say that the little structure there was existed mostly in the head of the author.

And I must stress that this was by no means the worst example of Flash programming I have seen. It wasn’t even bad on that scale. The problem is that the scale of Flash programming quality tops at “nightmare”.

It’s no secret that I consider other Flash programmers to be unacceptably bad programmers. I cannot for the life of me understand why anyone can work with programming day in and day out and not see that placing snipplets of code in different places on the time line and in symbols makes for unmaintainable code. How do they find things? Do they keep everything in their heads? Do they keep track of all global variables and where things are defined?

On the other hand, this little gem I found just after I had given up made my day:

newLocationID = Math.floor(Math.random() * (8 - 0 + 0)) + 0;
Added 2007-06-07:

I should have mentioned another thing: that their websites still work amazes me — and they usually work well, and look great (the looks would be due to a fascistoid designer though). It’s a paradox, how can something that is so bad on the inside still work perfectly?

You could argue that this is proof against my case; that they aren’t bad programmers because they make good sites. I beg to differ, because there is one thing missing from that argument: even though the sites work they probably took an extra week or two in pure debugging time and they are extremely fragile, request one change and it all threatens to fall apart, and that’s even when the original programmer is still around. You get what you pay for and nothing more.

5 Responses to “Flash programming confidential, monday”

  1. borzoj Says:

    the usual way to get a random number from range [x,y): rnd = Math.floor( Math.random()*(y – x))+x substitute x=>0 and y=>8 and you’re almost there. the +0 is still a mystery

  2. Theo Says:

    I would say that the mystery is why he kept the zeroes at all.

  3. zwetan Says:

    > It’s no secret that I consider other Flash > programmers to be unacceptably bad programmers.

    be careful with that :)

    reading your post, if you give up after 1h just because you saw such construct as _parent._parent._parent I would say you maybe a good programmer for long structured project but a bad programmer for dailly hackish flash project

    I don’t what was this particular project, but think about those few things:

    • people coded in flash way before classes (AS2) were there
    • flash does not have only one main entry point (even with Flash9 AS3)
    • if you are time restrained, you don’t really program flash, you hack flash

    I don’t defend sloppy or bad programmer, but still when you see that kind of bad programming you always have to think about how much time the guy had to make something work

    _global, _parent, _lockroot, prototype.addAnythingIwant, etc. are acceptable hacks to make things work fast

  4. Theo Says:

    To say that I gave up because of one piece of bad code would be to misrepresent what I said. I think “no discernible structure” was the major issue. It should not take an hour to understand the structure of a Flash website and to find a particular view in order to be able to change it.

    You are probably right in some respects about why Flash projects are messy and bad. Most Flash programmers live in the past when you couldn’t do very much programming in Flash, and haven’t kept up, or couldn’t keep up.

    But I don’t agree that too little time is an important cause. A good programmer, or a programmer who knows how to program properly, will not write the best code when under pressure, but I have no doubts that it will be more or less obvious when reading the code that he or she knew what he or she was doing. A good programmer knows what actually saves time and what is just short-sightedness that will come back and bite you — for example code duplication.

    When going through other Flash programmers code I don’t think that they really know what they’re doing. They know that one thing does this and another does that, but there is no fundamental understanding. Pressure of course makes this even worse, but I don’t think it changes much.

    You are right in telling me off for generalising about Flash programmers, I know I shouldn’t do it, but really, working as a freelancer I have met two that were good, and so many that have no clue. It makes it hard not to. I have no doubt that there are many good Flash programmers out there, and I would guess that those that came to the platform quite late (as I did) learned to use it in a good way, or knew how to program properly beforehand.

    And I agree that I would be a bad programmer for a “short hackish Flash project”. I have done short Flash projects, but I have never and will never do a hackish project. I just don’t think there is anything to gain from using that approach. It will always come back to you, as soon as there is a requirement change (and there always is) you are screwed because changes take double the time they otherwise would.

  5. Iconara » Flash programming confidential, resolutions Says:

    [...] regular staff was away. I reported my findings in a series called Flash programming confidential (monday, wednesday, weekend). This is a summary of the state of the Flash programming trade, and [...]

Leave a Reply