On Wed, Oct 8, 2008 at 10:10 AM, Tei oscar.vives@gmail.com wrote:
I am a Internet newbie, so maybe I don't understand the problem.
Desktop programmers often distribute his applications as binary compiled form version of his SRC files.
JavaScript is a scripting language, not a compiled language. It cannot be distributed as a machine-executable binary, because that would be insecure: JavaScript needs to be sandboxed in a way that machine-executable code cannot be. It cannot be distributed as bytecode, the way Java can, because there's no standard JavaScript bytecode. It can only be distributed in source code form.
I don't see what is the problem to distribute a application webpage has a binary file.. or a ofuscated file-optimized file. If having a separate (keyword here is: separate) download for the SRC files. Has programmers of Desktop applications have a separate folder labeled "SRC" with the SRC files of any binary distribution program.
This works for languages like Java or C where the convention is to distribute more optimized forms than source code. The problem with JavaScript is that the entire infrastructure for viewing it and debugging it depends on the fact that it's distributed in source-code form. If an error occurs, the browser will give the line number in the source code: if your source code is minified so it's all on one line, this is useless. Debuggers like Firebug can set break points on individual lines, which again is useless for minified code. All of the above also present the code to you for inspection in source-code form, which is very difficult to read if it's minified, with all spaces and comments removed.
Again, in compiled languages (whether byte-code or machine code) this isn't such an issue. There are established ways of dealing with this: you can compile debug versions and your debugger will automatically use info on the line number and so on to jump to the correct place in the source code. No such facilities exist for JavaScript.
In the long term, the "correct" solution might be for the web community to come up with a standard JavaScript byte-code or something like that, and have debuggers updated to work with that. But that's not an option right now.
I know you can still have poeple that may need the un-ofuscated original (not compiled) src. But he!.. developping sould work on a beta server or something, not on production. People geek enough to need the original src files, could google about it, and download the full src/ folder or something alike.
It's a lot more difficult to reproduce problems on local wikis than to be able to inspect them in-place where they're reported, on production wikis. Moreover, a lot of our JavaScript is put into place by sysops on individual wikis, who mostly don't have access to test wikis. It's not practical to just say "don't give an option to view the readable source code". Yes, this is indeed a peculiarity of web development compared to other types of software development, but that's the facts on the ground.