No thanks, Atlas, I'll take my JavaScript straight

JavaScript is an easy language, full stop. It isn't perfect, but if I had to teach a language to eager newbies, I'd prefer JavaScript over C# or Java. But apparently, some folks think JavaScript is too hard. With Atlas, you are encouraged to use helper libraries so that you can write code like this.

  Type.registerNamespace("Demo");

  Demo.Person = function(firstName, lastName, emailAddress) {
      var _firstName = firstName;
      var _lastName = lastName;
      var _emailAddress = emailAddress;
    
      this.getFirstName = function() {
          return _firstName;
      }
    
      ...
    
      this.dispose = function() {
          alert('bye ' + this.getName());
      }
  }
  Type.registerClass('Demo.Person', null, Web.IDisposable);

Without Atlas, I'd be forced to this:

  Demo = new Object();
  Demo.Person = function(options) {
    this.firstName = options.firstName;
    this.lastName = options.lastName;
    this.emailAddress = options.emailAddress;
  }

The plain old JavaScript looks easier to me. I guess all those accessor methods and busywork code make the Atlasized version more "scalable" or "enterprise". :-)

Humor aside, there is a serious question here. Does it help to make one language look like another, like the C#-izing of JavaScript shown above? If it does help, is it a short-run, "training wheels" kind of thing, or a long run plan? If you're building Ajax apps, drop a comment and let us know what you think.

Ad: Fortunately, there's more to Atlas than the misguided C# veneer. We'll be talking about some of the better parts at the Pragmatic Studio in Reston, VA, Feb 9-11.

Get In Touch