?

Log in

No account? Create an account
kvetch kvetch javascript kvetch - The Mad Schemes of Dr. Tectonic [entries|archive|friends|userinfo]
Beemer

[ userinfo | livejournal userinfo ]
[ archive | journal archive ]

kvetch kvetch javascript kvetch [Nov. 27th, 2006|04:14 pm]
Beemer
[Tags|]

Okay, all the times I have complained about Java? Multiply them by "annoying" raised to the power of "stupid" when it comes to JavaScript (which, despite the name, is no relation).

Seriously, who wrote this? The javascript runtime engine goes to enough trouble to auto-generate a Radio object that contains all the information for a set of radiobuttons in a form, and will let you programmatically alter their state and has event handlers for gaining and losing focus, but it doesn't bother to actually figure out what the current selected value is, despite the fact that that selecting it is, like, the entire point of radiobuttons even existing, and is therefore the single most likely to be used piece of information about the damn thing?!?

WTF! Dude!

Addendum: Who wrote this? Brenden Eich wrote this. He is a big dope.
LinkReply

Comments:
[User Picture]From: tdjohnsn
2006-11-27 11:22 pm (UTC)
javascript was the turning point for me way-back-when when I could have choosen to become a web coder rather than sticking with graphic design. I was following a tutorial on making roll over buttons. Two worked, one didn't. Hours of staring at the code did not result in a solution. I could break the other two, but not get that one to work.

I tell my students that if you need scripting that is not being written for you by what ever web design program you are working in (assuming you can't avoid it entirely) you should just pay someone one lots of money to do it while being very nice to them.

And make them cookies.
(Reply) (Thread)
From: toosuto
2006-11-28 08:50 am (UTC)
amen. (and beer/liqour too)
(Reply) (Parent) (Thread)
[User Picture]From: flwyd
2006-11-28 12:24 am (UTC)
JavaScript The Language (let's call it JeckylScript) is actually an interesting language. If I remember correctly, Classes are just prototypes that create objects. Functions are objects and you can assign functions to prototypes (to give them to all objects of that type) or to individual objects (if you want something to behave differently). Functions can either take named arguments or lists, making "do this to everything" easy to write. You've got runtime type conversions, simple member access and assignment, events and watchpoints, and quick access to most of the data you need.

JavaScript implementations (let's call it Interhyde Explorer) suck a giant salty moldy potato. They name common objects differently. They implement queer subsets of whatever standard you want to propose and the workaround for one implementation doesn't work at all on another implementation. There is a good debugger, but it doesn't work on the implementations that deviate far from standards, so you have no way to figure out just what completely standards compliat piece of code you wrote broke other than popping up an alert dialog after every line.

JavaScript programmers (let's call them l0sers) learned how to program by reading a 20-page tutorial and looking at other l0sers' web pages. They don't realize how evil and despicable Interhyde Explorer is. They don't know what a prototype-based language is. They don't know why "passing a function" is cool.

Software engineers who write JavaScript (c.f. Google) are aware of the theoretical underpinning beneath JeckylScript's features. They also realize that you use HTTP headers to determine a user's browser type and deliver a JeckylScript file designed for that Interhyde Explorer implementation rather than having conditional logic based on browser detection inside every function. They also realize that if you have your JeckylScript call a HolmesService you can have a real programming environment do the important work.

Framework designers who create JavaScript hooks (c.f. Konfabulator, Apple's Dashboard, recent Yahoo! desktop offerings) realize that if you provide a single implementation and provide a rich API, JavaScript authors can spend less time running in panic from hyde and instead make usable interactive components.

JavaScript is sort of like a nice kid with a few problems who got introduced to drugs and had no parental supervision at a critical point in his life. He's made some better friends and kicked most of his habits, but his past still haunts him.
(Reply) (Thread)
[User Picture]From: da_lj
2006-11-28 03:17 pm (UTC)
Thanks. That was good for a grin.
(Reply) (Parent) (Thread)
[User Picture]From: beartech420
2006-11-28 01:09 am (UTC)
don't you also have the benefit that javascript is a scripted languegue? you can find how other people have done stuff and cut and paste.
(Reply) (Thread)
[User Picture]From: dr_tectonic
2006-11-28 05:44 am (UTC)
A good plan in theory. Sadly, the average quality of the javascript you can find on the web is pretty low. I do google to see how other people have done this or that, but I always end up rewriting it. *sigh*
(Reply) (Parent) (Thread)
[User Picture]From: beartech420
2006-11-29 01:17 am (UTC)

have you checked these people out?

(Reply) (Parent) (Thread)
[User Picture]From: nematsakis
2006-11-28 03:25 am (UTC)
Feel free to ask me Javascript questions. For the last nine months I have been programming javascript nearly 40 hours a week. My two quick bits of advice are: get Firebug and get Mochikit. I wouldn't program in javascript without either.
(Reply) (Thread)
[User Picture]From: dr_tectonic
2006-11-28 05:40 am (UTC)
I already installed Firebug. I'll have a look for Mochikit tomorrow. Thanks!
(Reply) (Parent) (Thread)
[User Picture]From: backrubbear
2006-11-29 01:36 am (UTC)
I've rather enjoyed the sanity that firebug has brought me in the little javascript that I've done. I'll have to check out the other one.
(Reply) (Parent) (Thread)
[User Picture]From: nematsakis
2006-11-29 03:34 am (UTC)
Mochikit isn't a developer tool but a library. What I like about it is that it contains a lot of useful functions that Javascript doesn't, is cross-browser, and well-documented. If you start wanted to do fancy javascript, like effects and AJAX, you'll realize you need to get a toolkit in order to be most effective. There are others, including Dojo and Prototype, but I believe Mochikit feels the most "designed" of these. Also, be aware that Mochikit (intentionally) shares a lot of python idioms. I view this as a feature.
(Reply) (Parent) (Thread)
[User Picture]From: backrubbear
2006-11-29 01:38 am (UTC)
The biggest problem I've found with javascript is finding a good subset of the objects that are safe to use in multiple browsers. Is it safer to use the radio global and iterate through butons or to iterate through all form controls looking for radio buttons? Should you just give up and use getElementById?

Who knows.

Probably the best thing you can do for javascript is to find a list of the bugs. If you can afford to write your code multiple times, (see elsewhere), write it correct for each browser.

But most importantly, if you can help it, design things so you don't need to use it. Failing gracefully is easy to do, but it takes a few small tricks.
(Reply) (Thread)