Currently I am learning how to program windows 8 metro apps using Javascript.
I have some prior experience with javascript, but only with the stuff js was actually designed for: small snippets embedded in HTML code. This is the first time I am developing a complete application in js. And I got to say: the more I learn about it the more I hate it.
-no type safety
-all errors except for the most trivial syntax errors can only be found at runtime when the code in question is executed
-a mistyped member variable of an object, is even silent at runtime, because you needn't declare public member variables of classes, even when using 'use strict'.
-OOP is a joke. Most features which should be standard repertoire of an OOP language are only available through nasty hacks. Most annoying flaw so far: event handlers can't call instance methods*. wtf? how am I supposed to create a proper MVC pattern, when my controllers can't be instanced?
Why do people keep promoting this shit? Sure, you do everything nowadays in a webbrowser, and in a web application, javascript is the only standardized, platform-independent way to have any logic in the client. So you don't get around using JS when you have a web application. But why do people promote this abomination of a language for areas where much more viable alternatives exist? Like stand-alone client applications (windows 8 metro apps) and even server applications (NodeJS).
*They can call them, but they are executed in a static context, not the context of the object, which means that you can't access any member variables.
Name:
Anonymous2011-09-28 13:44
Agreed OP. I sometimes have to use Javascript at work to make in-browser applications, and it's quite painful as a language. Lack of type safety is the most awkward thing, creates a lot of needless code.
It's a relief when I go back to Java at work, and that's saying a lot.
Name:
Anonymous2011-09-28 13:44
Why do people keep promoting this shit? Because the other reasonably fast dynamic languages, such as Lisp and Lua, have very bad marketing reputation.
But why do people promote this abomination of a language for areas where much more viable alternatives exist? Like stand-alone client applications (windows 8 metro apps) and even server applications (NodeJS). Because ``Web developpers'' are too dumb to learn multiple languages for multiple purposes.
I once made a roulette program out of javascript, because I was trying to find a way to beat the system. Figured that all the online ones were closed source, so I couldn't trust them to be fair.
Surprise surprise, I couldn't beat the system.
Name:
Anonymous2011-09-28 13:50
What is your application OP?
Presumably the IE/Windows Javascript interpreter in Windows 8 is faster than previously, or else you're fucked as a developer.
* It's a dynamic language! But I'm used to static types!
* It's a prototypal object model! But I'm used to classical inheritance!
Listen bro, there are problems with Javascript, but all I see here is user error. Clearly you are versed in paradigms that aren't exploited by Javascript. You have to open yourself up to Javascript's mutability to see how its a strengths. All of the problems you cited aren't actually problems if you program Javascript like its Javascript, and not Java, or Python, or Scheme for that matter (the language from which Javascript takes most of its inspiration).
Good books with stupid names you should look at:
Javascript: The Good Parts, Crockford
Secrets of the Javascript Ninja, Resig
>>6
I have a feeling OP is not really using closures, but I disagree that just because the bound object model can be tricky it means you straight up shouldn't use it.
>>17
Don't I know you? Oh yeah you're that douche who let 4 fat juicy elephant cocks penetrate your hot virgin arse. How are the piles? Still full of puss and blood, or did your father manage to lick them clean this time?
- The Javascript type system sucks.
- In a dynamic language, errors happen in runtime. But logic errors always happen in runtime, dynamic or not, so you better get used to debug your code, faggot.
- A mistyped member or variable is set to undefined. It's retarded, live with it.
- OOP is not what you think it is. You are actually clueless. I bet you're wondering how do you define interfaces, abstract methods or where do you put the "throws Exception" bullshite. gb2/javafaggotry.
>>24 - OOP is not what you think it is. You are actually clueless. I bet you're wondering how do you define interfaces, abstract methods or where do you put the "throws Exception" bullshite. gb2/javafaggotry.
That is something you learn and master by your second year of college.
>>24
>- In a dynamic language, errors happen in runtime. But logic errors always happen in runtime, dynamic or not, so you better get used to debug your code, faggot.
Okay, after looking at this statement again, I've come to the conclusion that you're also a dumbass. Psst... you're confusing semenatic errors with... never mind. You suck. Go reread your shit OOP book again.
I think Javascript is my favorite dynamic language. If you are having trouble with the type safety and such, then just program carefullerer. Run your stuff through tons of tests. Consider writing the testing files before you even write the moduleythingymabob. Thoroughly test each moduleithing you make before it is used in anything. Use a lot of discipline when doing OO stuff so your design doesn't get too out there, like modifying classes at run time. If you feel that Javascript is inadequate, you may be able to program a small extension to the language and make appropriate use of it, although this should probably be avoided if the javascript is going to get compiled for something in a phone. Sticking to the core javascript and pretending that it is a more staticy language would probably allow for better optimization.
>>34
I don't understand. Static typing has better operators? Your post looks like bonerlang.
Name:
Anonymous2011-09-29 1:07
>>36
% ghci
Prelude> let (\^.^/) a b = a + b
Prelude> :i \^.^/
(\^.^/) :: (Num a) => a -> a -> a
Prelude> 3 \^.^/ 4
7
Prelude> let (\*^^*/) a b = a - b
Prelude> 7 \*^^*/ 3
4