Desktop Application Programming

•15Feb07 • 2 Comments

There has been an interesting discussion going on about the future of desktop applications, involving John Gruber, Jesper, and Daniel Jalkut, with many comments form other luminaries in the Mac programming world. There were a number of themes in the conversation, but the one that struck a chord with me came from this quote from John Gruber:

I think a few years from now, desktop application programming is going to look more like web programming does now, with most of the lines of code written in scripting languages, and the performance-sensitive parts written in C / C++ / Objective-C.

Now I have a lot of respect for John and the other folks involved in this conversation, but I have to say that this whole line of reasoning suffers from several flaws:

  1. First of all, what John is predicting has already happened to a good extent. On the server side, languages like C have long been supplanted, first by Java (JSP, J2EE, etc.) and .NET (ASP.NET, etc.), more recently by PHP, Ruby on Rails, and so forth. On the desktop, many games have a substantial portion of their functionality implemented in dynamic languages like Lua (a.k.a. scripting languages, but I hate that term). Adobe’s Lightroom has a substantial amount of code written in Lua as well. Safari and Firefox contains functionality implemented in JavaScript (not to mention Dashboard) and the next version of Firefox will use JavaScript extensively. Most of the Adobe CS2 applications have extensive ExtendScript interfaces. Photoshop CS3 allows extensibility via Flash/ActionScript. And so on and so on. The trend is for less and less of the code to be written in C/C++ over time.

  2. John qualified his prediction with the statement that “most of the lines of code” would be written in scripting languages. The inadequecies of measuring LOC are well known so I won’t belabor them here. A better measure would be to compare the number of man hours spent developing C/C++ code vs. the number of hours developing dynamic language code, or the percentage of functionality implemented in dynamic languages, or some such. My prediction is that any one of those measures will show a continuing trend towards dynamic languages over time.

  3. It assumes, incorrectly, that dropping down into native C/C++ is the only/best way to get good performance. This is often not the case: JIT-ed languages can often outperform native code on certain types of algorithms, particularly those that benefit from whole-program optimization. That said, there are certain types of operations that do perform better in C/C++ than in current implementations of dynamic languages, and dropping down into C/C++ is often the most expedient way of correcting those problems.

  4. A more compelling reason for dropping down into C/C++ is that there is so much good C/C++ code out there that it doesn’t make sense to rewrite. Look at Lightroom, for example: it heavily leverages Adobe’s decades of work on image processing. I don’t have hard numbers, but I wouldn’t be surprised if a majority of the new code in Lightroom was written in Lua. I expect more and more applications to evolve in this manner: taking an existing code base and building new functionality onto it using dynamic languages.

  5. It ignores the problems associated with scaling existing C/C++ code into “our megacore teraflop future”. When you think about things like Intel’s recently announced 80-core system, the massive parallelization available in GPUs, and so on, leveraging existing single-threaded C code (even when using MMX intrinsics) suddenly doesn’t seem so compelling compared to code written in languages that were built for parallelism like Haskell and Erlang, especially when combined with a multicore-aware JIT compiler. There is a ton of good discussion going on in this area lately.

  6. Can’t comment on this without mentioning Apollo. Desktop applications built on top of a high quality JIT compiler, with security, portability, and good performance.

Bottom line is that the future is here. Desktop application programming is not what it once was. Dynamic languages are an integral part of programming applications today, and will be even more so in the future due to the advent of massive parallelism.

SuperFetch Rocks!

•12Feb07 • Comments Off on SuperFetch Rocks!

I’ve been using Vista as my main OS on my desktop PC for quite some time now – knowing what Vista can and can’t do is part of my job. One thing I’ve really been impressed by is the SuperFetch feature, which intelligent preloads application code into memory based on a machine learning algorithm.

Now Patrick Schmid of TG Daily has done some benchmarking on the performance effects of SuperFetch and ReadyBoost on application launch times, using Outlook, iTunes, and Acrobat as sample applications. Its an interesting article, well worth a read. His conclusions, though: he recommends buying a 1GB machine then buying a USB Flash memory stick. I’m not sure I’d agree: he didn’t actually test with 2GB of RAM.

Based on my experience with a 2GB machine, I recommend that as the way to go if you can afford it. PhotoShop CS3 launches a lot faster than CS2 did, but with SuperFetch it starts up super quickly – sweet! I’m told that an x64 machine with 4GB+ of memory is even more impressive when launching PhotoShop. 🙂

Kudos to the team(s) at Microsoft who pulled off this nice piece of applied research.

ECMAScript the Next Big Programming Language

•12Feb07 • Comments Off on ECMAScript the Next Big Programming Language

Steve Yegge of Google has an interesting post up on his blog about The Next Big Language. In it, he discusses what he feels are the necessary criteria for a successful programming language, but doesn’t actually name the language he thinks will be it. What is most fun about the article is reading the comments from people trying to guess the language he is discussing: so far ECMAScript (aka ActionScript 3) as implemented by Flash/Flex/Apollo/Tamarin seems to be the leading contender, though Groovy is also mentioned a fair bit.

For my part, I’m not sure I agree with all of his criteria, especially the ones around static typing and the “Kitchen Sink”. That said, I find the fact that people are focusing on dynamic languages as the next big thing to be very encouraging.

Jobs on DRM: The Elephant in the Room

•06Feb07 • 4 Comments

Today Steve Jobs posted a blog-style message on the Apple website about iTunes and DRM. It was a highly polished, well written piece. Many people have written about it: some have speculated about whether or not Jobs has enough clout to make it happen; others have pointed out that this is really a way for Apple to position itself against European arguments against iTunes/iPod lock-in; others have questioned how sincere Jobs really is in asking the labels to change without really making any changes on its own unilaterally. Personally, I think all these people have good points, but despite all that I think the statement was a good move for Apple and the industry. I hope Jobs continues to discus things in the open instead of retreating back into the Infinite Loop bunker.

That said, I find it interesting that no one is pointing out what Jobs didn’t say anything about: DRM and video. Last time I checked, Apple also sold TV shows, music videos, and films on iTunes Music Store, and they are all protected by FairPlay DRM. Why didn’t Jobs make the same courageous stand against DRM on video? Unfortunately, the answer isn’t very pretty: Apple doesn’t have anywhere near the same clout in the movie and TV business that it has in music, and has only signed film deals with two of the major studios as a result. Taking a stand against DRM for movies would anger the same people he is trying to make deals with. So much for courageous principles – the people who think his message was mostly about positioning in Europe are spot on.

[Update 2-6-2007] I just realized that I kind of cribbed the title from my post from Tim Bray, who posted an article that used it as a subhead only two weeks ago. Credit where credit is due… I’ve also added a digg link as an experiment, and corrected a few typos.

digg_url = ‘http://blogs.adobe.com/shebanation/2007/02/jobs_drm_elephant.html’;