ActionScript is not Java!!
Or neither any langıage is really like another..
When learning a new language (not programming literally a new language), the best thing is not to compare it with other languages and your native language unless they are really very very common. Each language has its own grammar, own way to express things and different prononciation. If you try to learn the new langauge base on another one, you will probably end up speaking french as an english men or vice versa. Languages have their own tradition, heritage and culture, which will greatly differ from one to other.
Programming languages are also same. You may object this saying some of them share the same basics, which I also agree (ex. java and c#) but they still differ. If you move from one to another with your native tradions you will never look like a native speaker on your new platform. Its not wrong to use either camel case or hungarian case depending on your tradion but it will definitely reveal where you come from, and for sure you will seem like some one out of the community. Curly braces are also the same, you can use them just after the declaration or the next line but with other classes or methods written by others around you will definitly seem and english men in new york.
I face this issue when I try to teach Flex to someone from Java or .Net background. It is hard to accept your beloved arrayList to act a bit differently although its still looking quite same. If you are just playing with the language then its fine, but if you are seriously interested then here comes the problem. Actually more serious problems are ahead if you do not realize you are in a new world. Here is a great example from Chet who is a Java and Flex expert and used to work in Swing team.
Basically his examples shows the difference of variable decleration and scopes between java and flex.
What do you think this prints out?
var i:int; for (i = 0; i < 2; ++i) { var blah:Object; trace("blah = " + blah); blah = i; }Or how about this?
for (i = 0; i < 2; ++i) { var blarg:Object = null; trace("blarg = " + blarg); blarg = i; }
In actionscript the scope of the variables blah and blarg is function level, which is different than Java. In Java we would expect the reference to be renewed in each iteration. However in Flex since each iteration refers to the same object it is not null anymore after first loop. Which will result an output of;
The first example prints out:
blah = null blah = 0and the second example prints out:
blarg = null blarg = null
For more details go and check his post! But you might have already noticed him placing the curly braces in the new line which is not a Java tradition but which is in actionscript.
Always try to consume as much of the culture of a new language, first it will let you to be a native speaker (or at least close to be), second you will understand how it works better and finally being multi cultural will extend your ways to think and remember no language is just perfect.
i had to learn actionscript3 last year. it took 1-2 weeks to learn it, i say it is not really difficult. However, i agree, even it resembles Java it is different. here is my pros and cons.
Cons
- it is slow.
- editors are terrible.
- the user space is mostly using old actionscript, which is very different.
- Sequence functions are not so good. try removing an item from an array using an index.
- too much tied to Adobe Flash whatever the name silly application.
Pros
- it is easy to learn
- functions, delegates.
- built in xml support.
i think Javafx is more comparable to Actionscript3. and it kicks ass.
And here is the project i involved using action script.
http://code.google.com/p/yaz-dostum/
Like or Dislike:
0
0
I am not comparing, and actually I am saying you should not compare languages, they are just apples and oranges. I don’t really agree on the following;
- It is not slow, actually flex builder (or flash builder) is doing great and it has a great editor. However if you mean Flash CS, I don’t even think it has a proper as editor yet.
- Being tied to Flash?? well yes just like java being tied to JVM. Thats something normal and expected.
- JavaFX kicks ass?? Honestly i wish it does because I would be very glad to stay in JVM instead of using flash on client side and I am a big supporter of them (i blogged, present, screencast about JavaFX and even won an Amazon certificate from Sun). However, JavaFX still does not really a competitor, it is not going bad but definitly not mature enough yet. Tell me would you really take the risk of using JavaFX if you had the responsibility of a real enterprise project?
Like or Dislike:
1
1
Yes, when i said “being tied to Flash” i meant the pile of turd called FlashCS.
i would not use neither of them for an enterprise application. Flash, and JavaFX for me only good for things you cannot do well with html-javascript and now html5. Such as games, highly interactive 2D, complex animations, 3D, physics.
About the JavaFx issue, i should have said “JavaFx script” in my post, not “JavaFx”, i was comparing the languages, i can safely compare them. it does not matter if Javafx is not mature yet. it is better.
Yes ActionScript and Adobe Runtime is slow in my opinion, it sucks as much as Javascript. i am not talking about graphics speed, i talk about actual code. in enterprise if you deal with only forms and tables yes maybe you would not feel it. for anything a little complicated you are dead in the water.
Also, what i dealt with was a game, not an enterprise application. So that it is a different domain. Maybe my misunderstanding comes from that.
good luck,
Like or Dislike:
0
0