JavaScript Inventor Speaks Out
Anonymous Coward writes "Brendan, on his mozillazine blog talks about JavaScript 1, 2, and in between in light of DHTML and AJAX. In an informal blog entry he answers frequently asked questions such as fixing Unicode in regular expressions, multi-threading, weak numeric typing, and obfuscating code."
Honestly. Why should you be able to? Amazon SELLS books. It's not an on-line library. That's not the service they are offering.
"Who are in control, they are not in control of anything - they don't even control themselves!" - Glen Beck
Code obfuscation isn't really a "feature" per se. I think the main problem is what you've mentioned -- that a lot of folks don't believe in the "Open Source" philosophy and yet use such scripting languages that by their very nature, are "open source." (PERL rants aside)
It's writing code and hoping nobody else can understand, modify, improve, or possibly circumvent it. To be perfectly honest, I don't think code should be more obfuscated than it already is. The simpler and easier to understand, the better.
I did run into a vbscript worm once that did something like rotX itself when transporting (with a random shift, I believe, to try to avoid AV fingerprinting), then decode and execute upon launch. I must say that was pretty neat in a sick sort of way.
The reason so many stayed away from Javascript was the revealing code. Any browser could have you peek at the developer's work. I knew alot of developers that had a problem with that. They would rather write a slow piece of shit java applet compiled. Javascript was always lightning fast.
I mostly agree, but we do need Javascript. If you look at the Strict XHTML spec, there is no target="" attribute allowed on anchor tags. So if you want to open a link in a new browser, the official way to do it requires client-script (something about targetting is a browser behavior not a document structure semantic, so it should be script, not html):
<a href="http://www.slashdot.org" onclick="window.open(this.href,'_blank');return false;">Slashdot</a>
So you can argue that XHTML blows, or that you shouldn't open links in a new window, but if you decide you want to be standards compliant, you are going to need some client script. This is not the only example.
-David
No web page should ever open up a new browser window when the user clicks on a link. That's rude! The world wide web is a set of documents, not an application. Web pages should not be making decisions of that sort for the user.
Painters mask the meaning of paintings all the time. If they were completely obvious art would be dull.
But seriously, it's not like a painter masking the meaning of a painting; it's like a painter masking the method of the painting -- how he achieved the results. And, really, no painter (or coder) should be _forced_ to tell you how he does his work, especially if he's trying to make a profit off the process.
Blah blah blah. There are situations where that's actually the most user-friendly thing to do, like when you're editing or entering information and need to display detailed instructions without losing the form, along with some other situations.
You can do this with CSS, and without having to call back to the server for the "help" content as another web page
Define your help notes as divs which are hidden (display:none). Then you have your "help" hyperlinks point to those divs, which can then become visible (because they have the focus a different CSS rule applies and they can get display:block or whatever).
Opening new windows is almost always a bad idea. "User-friendly" depends not just on the technique but also on the user. For some people it may work, in some circumstances, but for other people (people with visual impairments, for instance) it is never friendly.
All I know is that [javascript] has pissed me off more than any other "top 5" languages in the work place.
And how many other languages do you use to write client-side code for web browsers? The problem is that the browsers don't all implement the same standards for their internal object models... but this is a result of using JavaScript to implement differing browser APIs, not a failure in JS itself. It's like saying that ANSI C is lousy because the same code for a graphical app will create errors if you compile it under Windows, Linux, and Mac. The language is fine it's just that those platforms, much like the browsers, implement different graphics APIs.
Want to improve your Karma? Instead of "Post Anonymously", try the "Post Humously" option.
somewhat like that amazon fiasco that prevents the same user from viewing all the pages of a book.
If Amazon didn't at least attempt to prevent you from accessing every page of each book, they'd be unable to offer the service at all as there's no way the publishers would agree to it. They'd essentially be providing a mechanism to get the text of the book for free.
If enough people piss about with it, Amazon *will* be forced to either withdraw the service, or just put up (say) five pages of each book and leave it at that, which would greatly reduce its usefulness.
It's official. Most of you are morons.
People are confusing the language and its more popular set of libraries.
Javascript is a language
The DHTML DOM (window, document, location, etc...) is merely an API. When you code in another environment, there is another API. For exemple, when ASP uses JScript (and not JavaScript, but it's pretty similar), APIs are such as ADODB, file system access, db access, etc...
Write boring code, not shiny code!
It never ceases to amaze me how people can do sometimes extensive work with JavaScript and still not spot what an elegant and powerful language it is. Sure, most of that work is about doing meaningless browser-related stuff and wrestling with bad APIs, but come on. I really do expect from an averagely talented real IT person to be able to separate that from the langauge, and be able to recognise the things it can do that their normal language can't. Its almost single-abstraction design that turns out to be able to do just about everything and still look nice and procedural and newbie-friendly totally rocks.
sudo ergo sum
Finally somebody who isn't a total dickhead speaks up on the Ajax craze.
..."
"With DHTML and AJAX hot (or hot again; we've been here before, and I don't like either acronym)
Bingo!
The man's right on.
We suffer more in our imagination than in reality. - Seneca