Objective C, JavaScript

rafael on 2003-04-30T13:48:46

This article about Objective C on the O'Reilly Network discusses (and advocates) the advantages of having a non-statically typed object language (as opposed, typically, to C++). Most of the points also apply to Perl, esp. to Perl 6.

I've also found (this is not new) an interesting paper, that explains that JavaScript is the world's most misunderstood programming language. This guy appears to have other interesting language resources about JavaScript as well. Quoting :

... JavaScript has more in common with functional languages like Lisp or Scheme than with C or Java. It has arrays instead of lists and objects instead of property lists. Functions are first class. It has closures. You get lambdas without having to balance all those parens.


/me concurs

broquaint on 2003-04-30T15:20:06

JavaScript is the world's most misunderstood programming language
Hear, hear!

really misunderstood

jmm on 2003-04-30T15:45:41

I don't understand it in the slightest. Never have had any need to.

I don't mind Javascript so much as it's domain

jordan on 2003-04-30T16:11:32

Web scripting...

To have Javascript enabled on your browser, you really should stay plugged in to the various Certs and patches that may arise due to security problems. I hate the nagging feeling that I'm never quite safe when browsing... There's always that 0-day exploit that will get me some day.

Sure, some things have been found in HTML, forms in particular, that are similar, but I feel a lot safer knowing that the site isn't executing code behind my back.

The other thing I hate about Web Scripting is that, with HTML and browsers, we've finally hit upon a Least Common Denominator User Interface that is nearly universally available and can be made to fit 95% of the applications we use daily. Sure, it's klunky for a lot of those applications, but it does work, which says a lot in the world of computer applications. Then, Web Scipting comes along and throws all kinds of odd curves and wrenches in.

You have to be worried about language versions, and platform specific features, and security (see above) and a hundred other things. When something doesn't work, you don't know if it's the site, your setup or both.

For various reasons, I sometimes need to fall back to a text-mode browser sometimes. For example, sometimes I can ssh into a site, but their policy doesn't allow me to get HTTP access from a machine that has a web application. If it's straight HTML, lynx or w3m works pretty well here. The next alternative is to tunnel X through ssh and run an X-Windows based browser. This works, but it's a lot more hassle.

Then, there's another BIG issue. ADA and Section 508 compliance. If you do very much in web scripting, it's increasingly difficult to meet standards for making your pages accessible to the disabled. In many environments, you have to make two versions or make your pages work with scripting disabled. If it's going to work with scripting disabled, why bother with the scripting at all?

Last, web scripting interferes with a wonderful application domain that I love for it's simplicity and power. Web Automation from Perl programs can be used to automate practically anything today that has a Web Interface, and more and more everything has some kind of Web Interface. Hey, automation is what I do for a living and a hobby. Web Scripting gets in the way, making it more difficult at a minimum and sometimes impossible to implement Web Automation.

Most of the time, Javascript pages can be figured out and some sort of Web Automation can be applied to them. This is far less true of certain Java applications. Javascript still makes it harder, though.

There is only one feature that I consider a "must have" that I've ever seen implemented in Javascript. That is the checkbox that checks a whole list of boxes in a table. Then, you can go down and uncheck specific items you wish not to have checked for some operation. THAT'S REALLY NICE. I'm willing to tolerate this as it doesn't interfere with Web Automation or 508 compliance at all. I still have the security issues of running Javascript in my browser, but I can turn it on and off for this feature. I think that this "check all" feature could be added to a future HTML standard and we wouldn't need web scripting at all.

I mean, really, what for? Fancy rollovers? Hey, I was really impressed with some of those in 1997, but I'm over it now. I have to say that I do like various 'tree-view' implementations I've seen implemented in Javascript, but I could live without them. You can implement the tree-views in CGI, too, but that's a lot klunkier than implementing them in the browser. I think some sort of tree-view could be added pretty easily to HTML.

Re:I don't mind Javascript so much as it's domain

rafael on 2003-04-30T20:46:47

Most excellent points and I agree with you, mostly. Here are some comments :

1. Tree-views and fancy rollovers can be implemented without scripting, in pure CSS (of course this requires recent browsers, but also this degrades nicely, unlike script-based implementations.)

2. The article I linked to discusses JavaScript from the point of view of language design : as it says, Lisp in C's Clothing, with that unusual function-are-objects approach. Quoting again : JavaScript is well suited to a large class of non-Web-related applications but in practice JavaScript is only implemented in browsers, and moreover, most of the people writing in JavaScript are not programmers, read : "most of the code written in JavaScript is ten times worse than Matt's Scripts".

3. There's a specific field where JavaScript is very useful : intranet applications. My day job is to work on a large intranet application for hospitals and other medical offices. As a software editor, we can impose a specific browser on the client platforms, and impose to enable JavaScript on it. And the huge possibilities of JavaScript (the ones that are never used on the web) helps us to design a friendlier interface than the average web application. For example, most of it can be operated only with the keyboard. It provides also useful visual indicators and auto-modifying forms; etc, etc. I used to hate JavaScript, and I begin slowly to appreciate it, since I have this job. Alas, it's difficult to write maintainable JavaScript.

Re:I don't mind Javascript so much as it's domain

lachoy on 2003-05-01T00:36:55

I think it's also well-suited as an easily embeddable generic scripting language, saving application developers the work of creating yet another half-baked domain specific environment. It's used in Dreamweaver (or at least it was the last time I looked) and these guys seem to be having a productive time with it as well.

Javascript vs. Perl

bart on 2003-05-05T14:07:59

Javascript is actually quite similar to Perl. It (only) has one-dimensional arrays. It has hashes, in Javascript known as "objects". Any parameter to a sub/function is optional. It even has native regular expressions — unlike PHP, where a regexp is a string.

IMO, one of the major differences between Javascript and Perl, is the OO system. And that isn't a bad thing: Javascript has a very interesting view on the world of objects.

I don't think you can learn proper Javascript off the web. There's just too many junk tutorials around, all focussing on those silly webpage effects. You pretty much need a good book. The "Javascript" book from O'Reilly was really helpful to me, but I'm sure the must be others.