5 ms·
It's not a purely technical issue. Some languages are more popular than others, popularity means more libraries, frameworks and examples. Languages also attract
by Detrus 16y ago
It's not a purely technical issue. Some languages are more popular than others, popularity means more libraries, frameworks and examples. Languages also attract different audiences, those who code C++, Java and ActionScript 3.0 just love piling on boilerplate code and long names like FactoryBuilderFacadeInterface, ApplicationFacadeDependencyHandler.
Other languages, like Ruby or JavaScript, attract people who shorten document.querySelector(id) to jQuery(id), come up with things like Processing (JVM but short syntax school), CoffeeScript, Rails, NodeJS, etc..
AS 3.0 is an interesting example. It's the language of the Flash plugin, which used to be popular among non-programmers as it allowed them to hack things together concisely, without having to learn about types or classes, since old AS 2.0 looked like JS. This was an audience the makers of Flash wanted to keep, but when AS 3.0 came out it chased them away. Online examples became polluted with design patterns, commands, factories, optimizations, complex best practices, long names. Libraries were targeted at advanced coders, there was nothing like jQuery for AS 3.0. When non-programmers see obj.addEventListener(MouseEvent.CLICK, clickHandler) they start shaking. JS frameworks do obj.on("click", onClick) or obj.click(onClick), few irrelevant details.
The language attracted serious developers who were used to big projects. Adobe released Flex, a gigantic framework reminiscent of the Java world, 300-600KB zipped for web deployment. Years later efforts like http://www.hypeframework.org/ http://www.hypeframework.org/ tried to rekindle some of the old flame but the non-programmers are still using AS 2.0 or switched to JS.
Did AS 3.0 have to be as verbose? Did it need giant frameworks and Java developers? Did it need types? No. The performance improvements from AS 3.0 types were negligible, they can be left out in a non-strict mode and the difference is 2 FPS, maybe. For typical Flash projects, debugging with types isn't necessary. Supposedly the situation improved performance wise for types, but that's the wrong priority.
JS/HTML5 picked the smarter approach. There will be typed arrays for WebGL, they're ugly, which discourages their use unless actually necessary. Type strict mode applied to an entire app means example and open source code will have it, it pushes everyone to use it.
When subtle psychological differences are applied to large groups, they create obvious effects. The current division between typed verbose and dynamic concise emerged from social forces more than technical issues. There are efforts like Google's Go, typed Ruby, dynamic C# 4.0, typed arrays in JS, but they're all recent and it will take time for developers to discover new preferences.
- zwetan 16y ago> those who code C++, Java and ActionScript 3.0 just love piling on > boilerplate code and long names like FactoryBuilderFacadeInterface boilerplate code is not caused by the language, but by the programmer, I know more than few examples of compact/clean/well-named code in C++, Java, AS3, etc. > since old AS 2.0 looked like JS no, that was AS 1.0 AS 2.0 was statically checked at compilation time > [...] but the non-programmers are still using AS 2.0 or switched to JS. it's not a problem of being a non-programmer vs being a programmer, it's a problem of a group of people learning a certain way to program with AS 2.0, and when an update occurs to the language are too lazy to change their habits > Did AS 3.0 have to be as verbose? Did it need giant frameworks and > Java developers? Did it need types? No. You're mixing a bit of everything there AS 3.0 is not verbose, you can still compile it "AS 1.0 style", just use the compiler MXMLC -ES and yes by doing that nothing is statically checked and all built-in classes default to "prototype" mode. (for ex: http://hg.mozilla.org/tamarin-central/file/fbecf6c8a86f/core/Array.as http://hg.mozilla.org/tamarin-central/file/fbecf6c8a86f/core...) For the giant framework part, yes the Flex framework is big, but it does not define what I would call an official AS 3.0 framework, in fact AS 3.0 at the language level is pretty compact, the "real" framework is the Flash Platform API (or if you prefer the native classes available in the Flash Player or AIR). So, again a problem of understanding with types, let be clear about something here, you seem to think that because JavaScript or AS 1.0 does not need to assign types to variables and because they are not statically type checked at compilation or interpretation, that there is no types, sorry they have types. Read those articles from Eric Lippert The JScript Type System, Part One http://blogs.msdn.com/b/ericlippert/archive/2003/11/05/53336.aspx http://blogs.msdn.com/b/ericlippert/archive/2003/11/05/53336... "JScript Classic is a weakly typed language. This means that any value of any type may be assigned to any variable without restriction. It is often said -- inaccurately -- that "JScript has only one type". This is true only in the sense that JScript has no restrictions on what data may be assigned to any variable, and in that sense every variable is "the same type" – namely, the "any possible value" type. However, the statement is misleading because it implies that JScript supports no types at all, when in fact it supports six built-in types. The "weak" in "weakly typed" refers to the weak restrictions on variables, not on the type system per se." There are 8 parts of "The JScript Type System" and mho it is a must read if your language of choice is based on ECMAScript. > The performance improvements from AS 3.0 types were negligible, they can be left out in > a non-strict mode and the difference is 2 FPS, maybe. For typical Flash projects, > debugging with types isn't necessary. Supposedly the situation improved performance > wise for types, but that's the wrong priority. negligible ? OK, first thing first, when you compile AS 1.0/2.0 code, the generated bytecode (in the SWF) is run by the AVM1 (ActionScript Virtual Machine). The Flash Player support 2 VM: AVM1 and AVM2, AVM2 is the Tamarin VM (http://www.mozilla.org/projects/tamarin/ http://www.mozilla.org/projects/tamarin/). So when you compile AS 3.0 code, the generated bytecode is run by the AVM2, which support runtime type annotations and is much much much faster because of that. But let's see hard data http://www.masonchang.com/blog/2008/4/28/tamarin-benchmarks-part-3.html http://www.masonchang.com/blog/2008/4/28/tamarin-benchmarks-... http://www.masonchang.com/blog/2008/4/28/tamarin-benchmarks-now-featuring-type-annotations.html http://www.masonchang.com/blog/2008/4/28/tamarin-benchmarks-... see the difference with and without type annotation ? now if you want all the greedy details of why this AVM2 is much faster you can look at http://www.adobe.com/devnet/actionscript/articles/avm2overview.pdf http://www.adobe.com/devnet/actionscript/articles/avm2overvi...