Is Adobe Copying JavaFX For Next Flex Version?

@psynixis

Is Adobe worried about JavaFX? They’re ripping off JavaFX Script features for next Flex version; and calling the JavaFX rip-off parts “Fx”!

about 9 minutes ago from web


Yes, I’m reblogging my own, somewhat overly dramatic tweets.  Don’t worry, I won’t make a habit of it!  Anyway, I guess the point is – Flex code looks a little bit of a mess next to JavaFX Script.  Presumably, Adobe must have realized they needed to do something about it when they saw how JavaFX Script was developing.

That said, I’m not quite sure why Adobe is apparently so insecure that it needs to not only to copy the new kid on the block in terms of technology, but to copy its name too: believe it or not, Adobe is actually calling its JavaFX “copy cat” features “Fx” (Update: see the comments, Adobe decided to dump the Fx pre-fixes on 13 Feb). It all seems a bit odd. Makes me think less of Adobe than I did before, and concerned for its ability to genuinely innovate.

By way of example of why Adobe might have felt the need to “enhance” Flex  to match the capabilities of JavaFX Script, here’s an here’s an ultra simple piece of code in the current version of Flex (written by the talented Chet Haase of Adobe); followed by a piece of JavaFX Script code that does the exact same thing (written by me).

The Flex Version

public class GraphicsCanvas extends Canvas {
    private var xStart:Number, yStart:Number, xEnd:Number, yEnd:Number;
    private var hasLine:Boolean = false;

    public function GraphicsCanvas(){
        super();
        addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
    }

    private function mouseDownHandler(event:MouseEvent):void {
        xStart = event.localX;
        yStart = event.localY;
        xEnd = event.localX;
        yEnd = event.localY;
        addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);
        addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
        hasLine = true;
        invalidateDisplayList();
    }

    private function mouseMoveHandler(event:MouseEvent):void {
        xEnd = event.localX;
        yEnd = event.localY;
        invalidateDisplayList();
    }

    private function mouseUpHandler(event:MouseEvent):void {
        xEnd = event.localX;
        yEnd = event.localY;
        removeEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);
        removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
        invalidateDisplayList();
    }

    override protected function updateDisplayList(unscaledWidth:Number,
         unscaledHeight:Number):void {
        super.updateDisplayList(unscaledWidth, unscaledHeight);
        if (hasLine) {
            graphics.clear();
            graphics.lineStyle(0, 0x0, 1);
            graphics.moveTo(xStart, yStart);
            graphics.lineTo(xEnd, yEnd);
        }
    }
}  

The JavaFX Version

NB This code updated 22 February in response to comment #18 by yop828

public class GraphicsCanvas extends CustomNode {

    var startx: Number;
    var starty: Number;
    var endx: Number;
    var endy: Number;

    public override function create(): Node {
        return Group {
            content: [

                Rectangle {
                    x: 0
                    y: 0
                    width: 400
                    height: 400
                    fill: Color.WHITE

                    onMousePressed: function(m: MouseEvent): Void {
                        startx = m.x;
                        starty = m.y;
                        endx = m.x;
                        endy = m.y;
                    }
                    onMouseDragged: function(m: MouseEvent): Void {
                        endx = m.x;
                        endy = m.y;
                    }
                }
                Line {
                    startX: bind startx
                    startY: bind starty
                    endX: bind endx
                    endY: bind endy
                }
            ]
        };
    }
}

Even if you don’t program yourself, I think it’s pretty clear which language looks the most simple and most elegant. It will be interesting to see what the syntax for the new Flex “JavaFX-like” features ends up looking like…

Comments

  1. Andrew Shebanow wrote:

    Dude! Chill out! Flex has been using the Fx abbreviation for quite a while. In fact, FlexBuilder 3’s icon says Fx on it, and it did so before Sun even announced JavaFX.

    Furthermore, they have already decided to remove those Fx prefixes and use namespaces, because prefixes are old fashioned and developers didn’t like it:

    See: http://www.adobeforums.com/webx/.59b7e849

    Lastly, I don’t mean to be snide, but I have to tell you that Adobe’s Flash and Flex teams have bigger things to worry about than competition from JavaFX. Its really Silverlight’s feature set they are reacting to, not JavaFX.

  2. simon wrote:

    Andrew, thanks for commenting!

    “(Adobe) already decided to remove those Fx prefixes” meaning on the 13 February. I missed that. It was a little late coming; but good decision, though.

    So, the Flash and Flex teams are worried about Silverlight? And they have to play catch-up to innovations from the Silverlight team? Interesting stuff. That’s not the impression that the Adobe leadership is giving at the moment. The Adobe CFO, Mark Garrett, was quoted as saying last week that, “The push to adoption (of Silverlight) has really fizzled out in the last 6-9 months, I’d say…We’re innovating ahead of them, and they have not been able to catch up.”

    I guess your attitude to JavaFX suggests that developers shouldn’t be hoping for JavaFX support on the Palm Pre anytime soon? Ho hum, never mind ;-) Pity though…

  3. Sebastien Arbogast wrote:

    Cool! Another troll post. What’s good is that your statement is so ridiculous that no one can take it seriously.

    “They’re ripping off JavaFX Script features for next Flex version”

    Come on! What features are you talking about? At least be more specific! You mean the incredible component library in JavaFX? Oh no, you mean the very clear syntax that seems very familiar to Java developers? Ah, I know, something like Flash Catalyst? Or a remoting protocol as performant as AMF? Rah, help me!

  4. Jacko wrote:

    For Web development, Flex currently is superior to JavaFX.

  5. simon wrote:

    Yes, Sebastien, it does sound like you need some help. Perhaps you might consider learning some manners as a starting point? Still, I’ll disregard your apparent lack of interpersonal skills, and answer your question.

    I was talking about some key features in the forthcoming version of Flex aka “Gumbo”. You know – the features that look *just* *like* some of the key features of JavaFX Script. Specifically, the ability to animate or otherwise change arbitrary objects and data types simply by changing their properties. That’s as opposed to changing only user interface components and numbers which is how Flex works now.

    By the way, I was also making the point that I think JavaFX Script syntax is clearer than the Flex/ActionScript syntax. It seems from your comment that you don’t agree. Never mind, we can agree to differ.

  6. Mike Azzi. wrote:

    Simon, how dare you criticize the “elegance” of Flex/ActionScript syntax :) ) It is the gold standard in elegance. Just take a look at the piece of code below, and you will see what I mean. But man!!, this syntax is butt ugly!! I really feel sorry for the person who has to deal with such abomination on a daily basis. You know, Adobe can say whatever they want how great flash, and some of the UIs done in it are. But Flex? Please.

  7. Mike Azzi. wrote:

    Sorry! here’s the link:
    http://opensource.adobe.com/wiki/display/flexsdk/ASDoc+in+MXML

  8. rob wrote:

    i can’t wait till flex gets that badass redraw flicker feature whenever you scroll the page. that’s gonna rule!

    in all seriousness……..every language has it’s pros and cons. if you look at another language and see features that you don’t have in your ‘toolbox’ and not get a little envious, then you aren’t passionate about your work. if you had the opportunity to do something about it, would you?

    in no way am i saying that adobe was stealing anything. my opinion is that they were trying to get free marketing out of their code base. i have no idea it that’s true but that’s my take. very smart but also very annoying to developers. the developers stood up and let them know that they didn’t approve and it got removed.

    do you have any other examples of ‘Gumbo’ stealing from JavaFX?

  9. bluestix wrote:

    It’s so funny.

    Flash started out with weakly typed simple script and worked towards a AS3 which is almost exactly like Java.

    Now Sun comes out with JavaFX script which looks almost exactly like Actionscript 1.

    Hahahaha

  10. Sebastien Arbogast wrote:

    Yeah… manners, right! Focus on the form, since your post has no substance. It really pisses me off when I see people throw out bold statements without any other form of concrete arguments. Show us code, demonstrate how “the ability to animate or otherwise change arbitrary objects and data types simply by changing their properties” is so much more powerful, instead of just stating that it is and expect people to take your word for it. I’m not saying that it’s not, I don’t know JavaFX enough to judge that, but enlighten us.
    But for the moment, all I can say is that those FUD-based comparisons seem like bad faith to me. Sun was a few years late, and now instead of focusing on delivering and catching up with real innovative features, they try to shoot competition in the back with foam bullets. I know you’re not affiliated with Sun, but with posts like this one, you take part in that trend. It’s annoying, that’s all. Nothing to get shocked about, enough to be sarcastic.

  11. bluestix wrote:

    Adobe and Sun need to stop being little babies and team up.

    If you could build Flex UI’s with full access to the Java libraries and run them on the JVM then you would have something useful.

    We had a preview of this with Artemis when AIR was still in Beta.

    It was awesome.

    Then Adobe squashed it.

  12. Sebastien Arbogast wrote:

    @bluestix You’re totally right, but since Sun is always so late about everything (EJB3, modularity, RIAs, just to name a few) and prefer to reinvent the wheel, it seems like Adobe has gone for a much more innovative collaboration with SpringSource instead: see Spring-Flex BlazeDS integration and Spring Actionscript. Now I know, it doesn’t run on the JVM, but IMHO, that’s the best collaboration they could come up with given the comparative penetration rates of Flash player and Java plugin.

  13. simon wrote:

    @Mike – ActionScript is one thing, but you’ve now raised the spectre that is MXML! Arrrrrrggghhhh…

    @Rob – LOL! @ flicker redraw on scrolling… You do know, though, that JavaFX doesn’t even *need* you to scroll to have bad-ass redraw flicker? Awesome, or WHAT?!

    Other examples? Well, I wasn’t just talking about the “Fx” “naming thing” in my blog. I was actually talking primarily, about the major new forthcoming features in Gumbo to do with animation of arbitrary objects simply be changing properties (see below).

    @Sebastien

    Sure – by all means, don’t take my word that the new features in Gumbo – arbitrary object and type animation, including reversing and repetition behaviors – are going to be important. Instead, take the word of a member of the Flex SDK team… The video linked below has some Gumbo examples:

    http://graphics-geek.blogspot.com/2009/02/video-gumbo-effects.html

    This is a major part of Gumbo; and all these things were pioneered in JavaFX.

  14. Guest wrote:

    Wait… JavaFx has ‘Stage’ and ‘Scene’ and Adobe is stealing from Sun? hahahaha. And you are comparing a rectangle with a layout container called Canvas. Want a rectangle in Flash/Flex? r=new Rectangle (x,y,h,w).

  15. simon wrote:

    @Guest

    Not really. What I was comparing was how Flex/ActionScript and JavaFX Script deal with event handling and updating the graphics.

    The point is this. There are significant differences in the ways that the scene graphs of the two platforms can be modified; and, as a result, how events that deal with graphics need to be handled. You should be able to see that these rather different approaches result in simpler, more elegant code in JavaFX Script vs Flex/ActionScript.

  16. Sean wrote:

    @Simon – Dude, your “Flex” example isn’t even in MXML. You betray your utter ignorance with every single sentence. Try to do a little research next time.

  17. simon wrote:

    @Sean – Are you a spam bot? No? It must be another person with no interpersonal skills that could benefit from learning some manners, then. Excellent! You know, I really am starting to think Adobe attracts rather third-rate kinds of people to its developer platforms.

    I have to confess some surprise about your comment, given that you profess to be an expert on Flex. You do know it’s somewhat laughable to make a statement like, “It’s not even in MXML”. Do you think MXML is a programming language? It’s not – it’s a markup language. The clue’s in the name. The programming language of Flex is ActionScript, which is what the above example is written in.

    Of course, this is not “my” Flex example, as you so delightfully put it. The example was written by a member of the Flex SDK team (you really should consider learning to read properly – I said it was Chet’s code in the blog). It’s an example of creating a custom Flex component, based around extending the Flex MX Canvas component. Specifically it’s about, and I quote, “The use of Flash graphics objects in Flex applications, covering drawing directly into the Graphics object for custom rendering.”

    See:

    http://graphics-geek.blogspot.com/2008/11/video-custom-flash-graphics.html

    Perhaps you think the Flex SDK team doesn’t understand their own platform? Did you not know you use ActionScript to program Flex applications? Do you even know what ActionScript is, I wonder?

    Anyway, if you remain convinced that the above example is nothing to do with Flex, and is just some random code in a random language, I suggest you take it up with the the Flex SDK team…

    By the way, I don’t claim to be an expert in Flex at all. Far from it. So I’m more than willing to be put right where I’m wrong. I think I can just about manage to recognize a bit of ActionScript when I see it though ;-)

  18. yop828 wrote:

    Hi everyone

    I can be wrong but it seems to me the AS3 code creates a custom component GraphicsCanvas whereas the JavaFx version does not (moreover there are global variables at the beginning of JavaFx version which is not good practice)

  19. simon wrote:

    @yop828 – You are quite right – although, the comparison wasn’t really about creating custom components; rather it’s about custom rendering – see comment #15.

    Thank you for taking the time to read the code! In case it makes things clearer, I’ve amended the code in the JavaFX Script example for you so that it’s now a class that describes a custom component I’ve called GraphicsCanvas.

    BTW, I can see you care about the scope of variables – which is “a good thing”! If you look at the amended JavaFX example, and in case you don’t code in JavaFX Script, you should know that the default scope of variables in JavaFX Script is what’s known as script-private. It’s fine programming practice to define variables with that scope.

  20. Darren wrote:

    @simon, I think the point that Sean was trying to make was that your example has very little to do with what Flex is about. The primary focus of your example is, as you say, manipulating *Flash* drawing objects – the fact that it is in the Flex environment as compared to a straight Flash project is largely incidental in this context – and the syntax for that has not changed much since AS2. Flex is designed in such a way, to my mind at least, that MXML is largely used for layout and AS3 is used for manipulating data although obviously these lines are quite often blurred. So you have chosen an example which is not very indicative at all of creating Flex apps. You should also keep in mind that the syntax exemplified here is largely the way it is so that it is still familiar to the old-school Flash programmers that the Flex team is trying to bring along with them. I think you should check out the Degrafa project for Flex if you are interested in how Flex programmers currently do the same thing in a more modern way.

  21. simon wrote:

    @Darren – An intelligent comment!! Thank you ;-) Degrafa is much more modern, I agree. It’s not actually part of the Flex platform, if I understand correctly. By that, I mean it’s a third-party add-on to Flex. Is that right? I may have misunderstood, so please correct me if I’m wrong.

    Surely, one of the main drivers of the Degrafa project was to try to address the fact that programming custom graphics in Flex isn’t as elegant as it could be: which is one of the main points I’ve been making.

    On the topic of MXML, no matter how hard people try to sell it as being “elegant” and/or “easy to read”, I can’t agree. To quote commenter #6, it’s really “butt ugly”. Just because XML happens to be human-readable, doesn’t mean it should be read by people. It’s a pretty horrible idea, IMHO – it feels like the kind of thing that someone might have thought was cool in 1999, not in 2009.

    That said – Degrafa itself seems to be a good idea, and it’s hardly the Degrafa team’s fault that MXML was the only rational choice for them. I’ll be interested to see if it gets people where they need to go when creating complex apps. Fundamentally, declaratively defining graphical objects and inter-object relationships only gets you so far. So, I think it must be unavoidable that sizeable chunks of ActionScript will still be required to build real apps (and I don’t mean only business logic – I mean plumbing too). I’ll also be interested to see what performance is like on complex apps – I suspect there is quite a lot that has to be done. Not sure how much they will get for free from the Flash run-time, and how much will have to be baked in to Degrafa. It may be a non-trivial problem.

    Thanks again for your comment – it seems that Degrafa is a interesting option for people to explore that want to do custom rendering in their Flex apps.

  22. Mike Azzi. wrote:

    @Simon – What really cracks up about MXML is this CDATA ugly hack that you see splattered allover the place. This in itself takes the cake as far as ugliness. I really can’t understand how a self respecting company as Adobe would allow such a monstrosity to be used as a core construct in a programming language. Or how some self respecting developers would even allow themselves to write code in this fashion.

  23. simon wrote:

    @Mike

    I guess I know why Adobe did what they did. For example, forcing the description of the user interface to be declared in a way that (sort of) separates the UI from the main program code, makes the platform much more easily, and cheaply, toolable; using XML as the file format makes it even easier, and cheaper, from the point of view of developing the tools; and not needing a compile step to visualize a UI makes it easy and cheap to use the same file in multiple tools, thereby enabling workflow between designers and developers.

    The ugliness is a problem though – if something looks ugly, it’s usually the wrong answer. The CDATA hack is a bit of a shocker, I agree. I’m not sure if the Adobe folks can see that it’s ugly and hacky, but don’t care; or if they actually think it’s a great idea.

  24. Darren wrote:

    If I have a fair chunk of AS in an MXML component, I put it in a separate file and just have this in my MXML:

    So no CDATA hack and you get the added advantage that the Outline view in Eclipse works as it should for your AS code. I’m not that fussed on the CDATA thing though – Flex Builder auto-completes it for you anyway. Adobe cops a lot of flack for not following standards and then when they do – in this case ensuring that MXML is valid XML – they cop flack for being ugly.

  25. Darren wrote:

    It appears that the tag was stripped out of my comment. Basically, all you need is a simple one-line mx:Script tag with the source attribute pointing to your AS file.

  26. Jvy Loh wrote:

    Simon,

    IMHO, your opinion was quite biased. I am a fan of both Java & Flex platform. When Flex 2 was available, Java only has Swing. Flex 2 was so much better than Swing until Sun decided to have JavaFx to compete with Flex. JavaFx in fact adopted a lot of Flex ideas, like declarative UI, more data binding, etc, and innovate upon. I guess you were all along doing Java, and then JavaFx before you got exposed to Flex 3 or Flex 4, that’s why you think Flex is copying JavaFx, you didnt’ know the history well enough apparently.

    Besides, you code comparison is flawed from the beginning. You should compared MXML to your JavaFx code. Else you are comparing apple to orange.

  27. Jvy Loh wrote:

    @bluestix

    Well, I like Java language. But the biggest problem for Java on the desktop is that the JVM implementation. Now the jvm has gotten better but it is a bit too late to the game. Very few website runs applets anymore. Flash is wildly popular. So running on jvm is like taking a step back. Flex isn’t perfect too. On slower machines, Flex also starts to show the symptom like Swing behind a bit too heavy, you can feel it. I am rather surprised that a generally I feel that Ajax feels very lightweight so far. Each has its pros and cons.

  28. Harry wrote:

    I think that obviously Adobe has a big leed in the web business that Oracle(Sun) would like to have. We all can agree that swing nver really helped in the web arena; but now maybe there will be more open tools for developers which will benifit everyone!!

Post a Comment

Your email is never published nor shared. Required fields are marked *

*

*