Click here to monitor SSC
  • Av rating:
  • Total votes: 38
  • Total comments: 2
Richard Morris

Doug Crockford: Geek of the Week

17 March 2010

 Doug Crockford is the man behind JavaScript Object Notation (JSON). He is a well-known critic of XML and guides the development of Javascript on the ECMA Standards Committee, as well as being the senior JavaScript architect at Yahoo! He is also  the author of the popular 'JavaScript: The Good Parts'. Richard Morris was dispatched to ask him which the good parts were.

Twelve years ago the World Wide Web Consortium released a set of specifications for the Extensible Markup Language or XML.

It was designed to allow anyone to create tagged documents, with tags describing the contents and by building on the work done with other languages (particularly SGML (Standard Generalized Markup Language) it was intended to be a common platform for data exchange across the rapidly growing internet and become the lingua franca of the connected world but a lot of people find it bulky and ugly.

The same could be said of JavaScript. According to Doug Crockford, considered by many in the development community to be the JavaScript expert, it is a beautiful, elegant, lightweight and highly expressive language which lies buried under a steaming pile of good intentions and blunders.

The very good ideas he says, include functions, loose typing, dynamic objects, and an expressive object literal notation. The awful ideas include a programming model based on global variables.

"I don't understand
a mindset that
undervalues quality.
It doesn't help to make
it fast if you aren't also
making it good."

By sheer coincidence Doug also rails against XML and developed JSON (JavaScript Object Notation) a lightweight data interchange format widely used in Ajax applications, because he found XML extremely verbose and time-consuming to transmit and process on the browser.

A senior JavaScript Architect at Yahoo! Doug has been a programmer since the early 1970s when he took a punch card Fortran course in college after finding it difficult to get into television broadcasting.  Over the course of four decades he has combined computers with media and has worked for numerous companies including: Atari, Lucasfilm and Electric Communities.  A member of JavaScript 2.0 committee at ECMA, Doug is a regular speaker at conferences on advanced JavaScript topics, and prefers to think of himself as a mahatma rather than a guru.

How did you start in programming?
It was at San Francisco State University and it was a program I wrote to disassemble the runtime of the Fortran system on the timesharing system I was using. I was therefore able to read how that system worked and taught myself a lot about programming based on that model. I suppose the biggest change in the way I think about programming now compared to then, is there was probably a decade where efficiency was really important. It was in the early microprocessor era when memory was really small and the CPUs were still really slow. We’d get down into assembly language in order to do games and music and such like to make it fit and fast. We got over that eventually and so today we’re writing big applications in JavaScript that run in a browser. It’s such a profoundly inefficient environment compared to the stuff that we used to do, but Moore’s Law sort of made it okay.
How do think JavaScript could be improved?
Make it smaller. If we could just get it down to what it does really well and remove the features that add little or no value, it’s actually a better language and actually an elegant, beautiful little language. It’s not only a beautiful little language, but it’s also a powerful one, and one that is more widely deployed than any other language in the world of course.
What though are the major problems, are there too many Ajax libraries or are people reimplementing the same things over and over again which has lead to this large bloated mass?
There are too many Ajax libraries and that’s a consequence that JavaScript is so powerful and the need is so profound that they are easy to make, so for a while everyone was making them. I’ve been expecting that we’re going to have a shake-out but it hasn’t happened yet. One thing we are seeing now is that the Ajax libraries are converging. jQuery came up with a notation for using CSS selectors for getting a list of objects from the DOM and then providing methods for manipulating the objects en masse. And that turns out to be a really good idea and it’s something that JavaScipt does very effectively. There’s inefficiency there in that the interface to the DOM is horrible but they hide it all. They’ve really simplified the programming model.
You are quoted as saying that you developed JSON because XML was inexcusably ugly and inefficient but it must have its good parts. What are the particular qualities that you like about it?
The best thing about XML is what it shares with JSON, being human readable. That turns out to be important, not because people should be reading it, because we shouldn't, but because it avoids interoperability problems caused by fussy binary encoding issues.
Beyond that, there is not much to like. It is not very good as a data format. And it is not very good as a document format. If it were a good document format, then wikis would use it.
What are your thoughts on ECMA approving JSON for web applications and what sort of impact do you think this will have on developers?
What ECMA did was approve an edition of ECMAScript that had built in JSON support. This is a good thing for Ajax applications because JSON operations will be faster and more reliable.
When you want to hack up an experiment quickly, do you use JSON? If not, what do you use?
When experimenting, I will hook up buttons to little scripts that simulate the server. That way I can mock up the whole application on the client. The similarity between JSON text and object literals is really helpful there.
I have a couple of unrelated questions here about quality of software. Do you think education is the answer to developing better software and that somehow we get out from the 'we must do it first no matter how buggy it is' way of thinking? And is this thinking innate or produced by culture
I don't understand a mindset that undervalues quality. It doesn't help to make it fast if you aren't also making it good. I think this can be taught, but I don't know why it isn't already universally known.
A lot of people have attacked C++ saying it has become monstrously complex and bulky, difficult to understand, and likely to contain errors for ever. Can you see it remaining in use and if so why?
Once some technology gets into the enterprise, it can take generations to get rid of it. C++ will be with us for a long time still.
Do you think many people working in technology are unaware of its history and have little curiosity about where languages came from?
There are some amazing stories about where languages came from and who did what and what is now considered a mistake and what should be considered a mistake, but hasn’t yet. I think of myself sometimes as an archaeologist of software technology and over the years have accumulated a collection of under appreciated technology, things that I think were really, really good which are significantly in advance of the state of the art that we’re using now.

I keep hoping that we will somehow rediscover some of this stuff and learn to appreciate it and benefit from having done it, but it’s a really slow process. Some folks are really entrenched in the way things are working right now and it’s difficult to move.
What languages are you talking about here?
In particular Lisp and Smalltalk. That’s really brilliant stuff and we’re finally seeing those ideas being factored into modern languages, so we’re doing a lot of work now in JavaScript and trying to modernize that. It turns out that JavaScript already anticipated a bunch of that stuff; it’s got functions which are lexically scoped and first-class, which was brilliant. Now we’re trying to figure out how to get more of the goodness of Smalltalk and Scheme into this language without breaking it. You could argue that we’d be better off if we just threw out everything we’re working on now and go back to Smalltalk and Scheme and we’d probably be better off than we are, but that doesn’t appear to be an option.
One language that came out of that group is Eiffel which was beaten in the object oriented language contest by C++ of course.
I think Eiffel is a much better language than C++ and I liked the precondition, postcondition contract stuff it did. I would like to see that built into my language, whatever language I’m using, but that’s another of those ideas that hasn’t really caught on.
I want to skip to the web again and ask you about the main challenges for browsers in the next decade?
We need to solve the IE6 problem. IE6 used to be the best web browser in the world. But it has not aged well, and it is still surprisingly popular. This is a hardship for developers because it is difficult to develop applications that work well on IE6. Its popularity has been declining, but very slowly. It has been able to hang on because developers have worked hard to support it. I think we need to stop doing that, and instead recommend that the IE6 community move to one of the many superior solutions. I don't think it is out of line to ask people to upgrade their software once a decade.
When you look back at your career on all the things you have done is there one time or a period that stands out among all the others?
When the bubble popped 10 years ago, it looked like there would be no more innovation and that we would be stuck with the web in its underdeveloped state. But things have gotten interesting again. This is a great time.
Richard Morris

Author profile:

Richard Morris is a journalist, author and public relations/public affairs consultant. He has written for a number of UK and US newspapers and magazines and has offered strategic advice to numerous tech companies including Digital Island, Sony and several ISPs. He now specialises in social enterprise and is, among other things, a member of the Big Issue Invest advisory board. Big Issue Invest is the leading provider to high-performing social enterprises & has a strong brand name based on its parent company The Big Issue, described by McKinsey & Co as the most well known and trusted social brand in the UK.

Search for other articles by Richard Morris

Rate this article:   Avg rating: from a total of 38 votes.





Must read
Have Your Say
Do you have an opinion on this article? Then add your comment below:
You must be logged in to post to this forum

Click here to log in.

Subject: XML
Posted by: Steve R. Schroeder (not signed in)
Posted on: Monday, March 22, 2010 at 9:48 AM
Message: And here I thought I was alone in the belief XML is clumsy and overly verbose.

Subject: re: xml
Posted by: BuggyFunBunny (view profile)
Posted on: Monday, March 22, 2010 at 2:21 PM
Message: No, you are not alone; in the vanishingly small minority, alas. My sense is that the smart folks who figured out early on that xml was a waste of time are getting more traction. Part of the reason being that using xml as either data transport or datastore is turning out to be a waste of time for those who attempt to do so; to name one, ACORD is a complete mess.

Anyone who attempts to store data as xml will find it worthless, beyond a siloed application datastore a la VSAM for COBOL.


Top Rated

We don't need Source Control: we're Database Developers
 As part of our long-running series of articles where we ask working database developers how database... Read more...

The Proposals Conundrum
 When you work for a small software development (or any services) company, one of the major challenges... Read more...

David Heinemeier Hansson: Geek of the Week
 Ruby on Rails, the open-source web application framework, grew out of David Heinemeier Hansson's work... Read more...

Alex Payne: Big in the IT Business
 Alex Payne worked on developing Twitter for three years. When he started, it was a small side-project:... Read more...

Seth Godin: Big in the IT Business
 Seth Godin has transformed our understanding of marketing in IT. He invented the concept of 'permission... Read more...

Most Viewed

The Future of Reflector
 Simple Talk asked freelance writer Bob Cramblitt to sit down with the two people behind the agreement... Read more...

Linus Torvalds, Geek of the Week
 Linus Torvalds is remarkable, not only for being the technical genius who wrote Linux, but for then... Read more...

Bad CaRMa
 From hope and euphoria, to desperation, firings and the ultimate demise of a company. Tim Gorman charts... Read more...

Driving up software quality - the role of the tester
 Have you ever wondered what a software tester does? Helen Joyce, test engineer at Red Gate software... Read more...

Don Knuth and the Art of Computer Programming: The Interview
 Fifty years after starting the 'Art of Computer Programming', (TAOCP), Don Knuth is still working hard ... Read more...

Why Join

Over 400,000 Microsoft professionals subscribe to the Simple-Talk technical journal. Join today, it's fast, simple, free and secure.