Delphi For Sale

published: Fri, 10-Feb-2006   |   updated: Sun, 23-Jul-2006
Copper Mountain in summer

If you're a Delphi developer, you must have been living under a remarkably big rock not to heard about the news that Borland is to, er, divest itself of Delphi, the other language compilers, and the other IDEs (which, to be brutal, just don't count). I thought Jeff Duntemann's title by far the funniest and the most incisive (Delphi Dumps Borland). Anyway, never let it be said that I'm too old to jump on a passing bandwagon.

The funny thing is, in the Delphi blogosphere, people are talking about who the white knight might be, who would buy (and how they would) Delphi at retail, how at last Delphi can get rid of the dreadful Borland marketing and sales, who in R&D would be jumping ship to DelphiCo, and indeed what the real name for DelphiCo might be (Marco Cantu sums it all up nicely), but there seem to be some holes in the punditry's arguments.

Of all the blogs I've been reading about this (and I don't pretend to have read them all), none have so far seem to have considered the language.

Delphi is a neat language, but it is very much set in the 90s. It's competing against C++ (in my view, no contest <g>), it's competing against Java and C#, it's competing against VB.NET, it's competing against the dynamic language crowd (Ruby, Python, etc), it's competing against the functional programming set (Haskell, Scheme, ML, etc). Some of these are established competitors, others new, and others upcoming.

It seems to me that it needs to gain some new business-oriented syntax (and damn quickly too), for if it makes certain business application functionality simple and much faster to write then developers will come. Think of Visual Basic originally and then Delphi 1: they solved business problems more simply and quickly than what was available before. This is not only a function of the frameworks available to the developer by the way, but of the language itself.

Think of writing a business application. You have a database, you have some business logic, you have some UI and reporting. It's all pretty easy to knock this up and wire it together. But it's bloody tedious.

Take Ruby on Rails. With a browser front-end this is the arena in which it excels. Unless you have already written a browser app and can copy/paste into a new one, it's mind bogglingly tedious writing one of these things. In Ruby on Rails it is not. It's orders of magnitude faster, because of the language and the framework and the built-in assumptions. It uses an ORM called ActiveRecord that sets up your database for you (oh and it uses dynamic SQL to do it, so there's no having to know SQL and being able to write and debug stored procedures).

And if you do know SQL, writing dynamic SQL is error-prone. The IDE doesn't validate or help you with code completion in these pesky SQL string literals. Wouldn't it be nice to be able to press Ctrl+Space and somehow get the column names, for example?

Take LINQ: Microsoft have decided to show us what they're thinking of to bind queries into the language and framework in .NET 3.0. It's amazing, even now in a very early beta. It uses functional programming concepts, much simplified, to make the whole query process easier. And they support database as well as XML queries.

Think of writing a method. Delphi insists on this model of declaring all your variables in a var block. Even with the support in the IDE for auto-declaring items in the block, it's tedious. I know purists decry it, but do away with the var block and let us declare variables when we need them. Let us declare variables where the compiler infers the type from the expression used to initialize the variable (the C# 3.0 var keyword). Let us declare a class without having to declare it in two parts, the interface and the implementation. Give us the syntactic sugar, like lock, using and others.

Think of writing concurrent or multi-threaded code. It's hard because there's so much to worry about: race conditions and deadlocks and livelocks and lock convoys, let alone the overall design of your processing to take account of modern chipsets with their dual cores and hyperthreading. Delphi needs a way of specifying in the language that methods are multi-threadable (mmm, inventing words, eh?) and the compiler and RTL just take care of all the nasty stuff for you.

And web applications are hard too. Even now we find it hard to program to a model that maintains no state between calls. So we have these grandiose structures to maintain, the session model, cookies, viewstate, URL magic keywords. And we have this bizarre model of when certain things happen on the server and when certain objects will be empty and when they're filled. Yuk. Look up continuation servers: is there a way for Delphi to take these concepts and run with them, or is it going to leave that to the Smalltalk crowd and Seaside? (Let alone the Ruby crowd.)

And there's AJAX, just to really sour the stew. Oh good grief. We have to write this JavaScript stuff (yet another language to learn, along with SQL and XML), we have to map XML HTTP requests to methods on the server, the whole enchilada. Is there something that can be done there? A server translator to translate DelphiScript to JavaScript when the page is rendered?

So, think of your own development work in writing business applications. What problems do you run into continually and you just wish the language would help? And not only help, but make it much easier to do the normal thing as well as faster.

Update: Sun 12-Feb-2006

Erick Sasse, one of my Brazilian readers, emailed me this.

Have you seen Chrome? What do you think about it? Looks like it has all features you would like to see in Delphi. :)

To which I replied: I used Chrome way back when it was in beta for version 1.0. In fact I wrote an article about it at the time for The Delphi Magazine. However, it’s been a while since I’ve looked at it, so I just went to their website and checked out what new stuff they’ve been adding and how it compared to the things I was talking about in my post.

  • There’s no extra support for writing business apps in the manner I was describing (the Ruby on Rails section).
  • Knowing the RemObjects people, I’m going to guess that they’re already playing around with LINQ-like technology.
  • There doesn’t seem to be any support for the IDE to validate the SQL strings as you type them, let alone supporting Intellisense for them.
  • Neato. Type inference. Best thing since sliced bread.
  • I see that there’s an async keyword for helping to write multithreaded code, but I’m not sure without reading the documentation how it’s applied and how it works.
  • The web support is via ASP.NET which suffers from what I was talking about in the last section of the original post.

So, there are definitely some interesting things in there. Enough that I might download and play around with the command line compiler.