Ramblings from the creator of HomeSite, TopStyle, FeedDemon and Glassboard Android.

Thursday, July 09, 2009

Why I Use Delphi

Every now and then someone will ask why I develop my software using Delphi. After all, there are more "modern" languages for Windows like C#. And besides, Delphi is going to die eventually, right?

Funny thing is, 15 years ago when I was developing HomeSite I was getting razzed by some geeks for using a development tool that they said would soon disappear. And yet 15 years later I'm still going strong writing software in Delphi.

Here's why:

Speed. Delphi isn't an interpreted language – it compiles to machine code, making it exceptionally fast. Delphi's string handling is particularly fast, which is important when developing a string-heavy application (such as HomeSite, TopStyle or FeedDemon).

No runtime. Languages such as C# and VB.NET require the .NET runtime, which is a separate 20MB+ download for customers that don't already have it. I don't want to worry about whether potential customers have the .NET runtime installed, or have the correct version installed – I just want them to download my software and use it without any additional headaches. The latest version of FeedDemon is a mere 3.4MB download (yes, download size still matters), and no additional download is required.

Startup time. Related to the above, well-designed Delphi applications start quickly because they don't have to wait for any runtime to load (assuming it's not already loaded). To me, this is a critical benefit. Applications that take a long time to load have a low perceived performance, regardless of how fast they are once they're loaded.

It's not created by Microsoft. Don't take this as vague Microsoft bashing, because I like much of what Microsoft does (if I didn't, I wouldn't write software for Windows). However, past experience with Microsoft development tools has taught me that they're willing to sacrifice the needs of developers in order to push forward their agenda. I like the fact that Delphi is created by a group of dedicated programmers whose single goal is to make it the best development tool possible.

I realize that many Windows developers are put off by the fact that ownership of Delphi has changed hands so many times, but I see that as a testament to how strong the Delphi community is. By many accounts, the latest version of Delphi is the best yet, so if you're writing software for Windows and are lucky enough to be able to choose your development tool, you should give Delphi serious consideration.

BTW, I'm far from the only one to develop a popular application with Delphi – for example, Skype, Ad-Aware and Macromedia Captivate were also developed with Delphi, and there are plenty of other well-known Delphi applications.

I remember earlier editions of Delphi were relatively inexpensive, and thus readily accessible to 'hobbyist programmers'. Delphi 2009 Professional is, as far as I can see, the least expensive at $900. That sort of price will just see enthusiasts heading toward Visual Studio express editions...

1) Unless you're optimizing like crazy, Delphi apps are slower than any other. FeedDemon was a slow pain to use, and then I switched to RSSOwl. (That's Java AND using the Eclipse framework) A JAVA app is outpacing a Delphi app. The only truely fast Delphi app I used was anything by Jordan Russell.

2) Price$. Delphi's goin down the drain unle$$ they make an expre$$ edition or at lea$t make the price$ less in$ane.

Having written extensive applications in both (though not in Delphi in 4.5 years) I like both a lot. But your points about the .Net runtime are outdated. Four years ago that may have been the case but not so anymore.

.Net was included as part of service pack updates in Windows XP and is installed by default in Vista and Windows 7. We haven't packaged the framework with an installer for 3 years now and I haven't seen one issue where someone needs to even know what the .net framework is.

Speed - we run our entire backend system on managed code. Now if you have to do a lot of COM interop with other Windows applicaitons (say Office or Windows RSS Store) then yes, the Marshalling back and forth is painfully slow. But for our content retrieval services and SMTP service, POP service, heck the entire infrastructure the NewsGator API is built on is all .Net handling 400-600 requests per second.

Additionally, .Net isn't a runtime dependent language like Java. Once compiled down to MSIL it runs as native code.

Yes, Delphi is nice, but .Net has come a long way in four years. And with Silverlight, its going even further.

The runtime size for .Net 1.1 and 2.0 were around 23MB, but it's gotten a little bigger. The redistributable size for 3.0 is 51MB and 3.5 SP1 is more than 230MB. In my experience, I can't count on customers having the right version of the framework installed.

Speed is more of an issue for client apps (slow WinForms, starting the .Net runtime, JITing) as opposed to server applications with no front end and are long running, so startup time isn't as much of a factor. I'm more concerned with .Net's higher memory usage and how apps behave when memory pressure forces a garbage collection.

I don't know what Calvin's smoking, but Redmond called and they want to order some more of it.

Delphi is fast, and functional. If you get paid a salary, or contractor's rates to write software for customers, that runs on Windows, the price of Delphi is insignificant. My annual economic output exceeds my salary, and my salary exceeds the cost of delphi by between 25 and 50 times depending on which edition of Delphi I was to purchase. To my employer's view, Delphi costs them less than the cost of running our office coffee machine and supplying milk and cream for coffee, for a year.

Without either one (coffee or Delphi) our operations would come to a halt.

I've also earned my crust from Delphi development for well over a decade, but Embarcadero do need to respect their customers more (this is one area that they surely should be able to beat MS hands down on?!). Specifically, respect the roadmaps they throw out. Even more specifically, when you say you're going to deliver 64bit Delphi, deliver it!

Having failed on multiple occasions to deliver on their 64bit roadmap we are now faced with even further delays due to changed priorities whilst Microsoft release Operating systems (Win 2008 R2) that are 64 bit ONLY. A native development tool that wants to be taken seriously MUST be able to deliver to such platforms. Never mind the fluff of the yet to be released windows 7 gesture support and the even bigger gamble of producing "son of Kylix".

Don't me wrong, I hope it all comes off (I do make my living from Delphi after all), I just wish they'd make sure they had their show laces tied before they tried to run...

@Nick Harris: You're correct that the .NET runtime is pre-installed with XP SP2 and Vista, but these are older versions of the runtime. If you want to take advantage of the latest .NET features, you still have to ensure that your end users have the correct version installed.

I do agree that .NET is great for server-side apps - I should've made it clear in my post that I was referring strictly to client apps. I think ASP.NET is really slick, and it makes many other web development frameworks look archaic by comparison.

I program like many I suspect in dotNet as well as Delphi and I even tackle Eclipse from time to time. dotNet while an impressive architecture in some ways is a royal pain when working with multiple versions of IIS, Windows and dotNet in the field. It sucks to have to test a single app written in a single language across a dozen or more environments. Seemingly each version of Windows, each version of dotNet and each version of IIS interact differently. As for Java (especially Eclipse) wow what a horrible IDE and as for performance Java is horrible by comparison. Watching data flow through tiers and classes before it finally hits assembler is like watching paint dry often making debugging even more difficult. As for language structure and Pascal being outdated, C is the basis for Java and C#. C is pretty much as old and besides it is too easily obfuscated then you have case sensitivity... who thought that was a good idea? I like that Delphi is in a readable language without the verbosity of BASIC, is very easy to learn and most importantly is powerful enough to write itself. Still waiting for Java and C# to pull that off and not look like something baked up over a weekend. When it comes to WinForms Delphi has no equal. I can accept the basic argument that WinForms is destined to die a slow death but in the meantime I like using the best tool in the toolbox to get jobs done.

"Delphi is fantastic for WinForms but not so great for a multi-threaded Windows Service".
That's funny because writing a multi-threaded service in Delphi is very much alike writing it in C/C++. It's low level programming and API calls. Are C/C++ "not so great" for writing multi-threaded services? The only drawback it's the developer has not a web server spawning worker threads on his behalf - it's up to his skill to write a good multithreaded application.

I think they both have their place. If I want to make sure that an application will do okay on older computers (some businesses keep computers until they die, no regular refreshes at all) then Delphi is the obvious choice. If you can't trust that there's going to be I/T staff, then Delphi is nice once again. "Drop the program on the network and make shortcuts on everyone's desktop" is a powerful marketing tool.

That being said, on a current computer I can create a DevExpress VCL and .NET app in an Outlook type layout with calendar controls and all and both perform fine IMHO. If a client has good computers and some I/T expertise locally (to deal with .NET framework updates and the like) then the case for Delphi has never been weaker. You have 64 bit, generics actually work and since everything's an object you can use them more easily, speed is acceptable, soon the parallel framework will help you take advantage of the multiple cores even better than you can now.

Delphi needs that 64 bit compiler out ASAP, and having a good parallel framework in place to leverage all the cores would rock. But the most serious problem for the future that I see is Smart Phones. They don't have a solution for them. That's a problem. But all together it's still a joy to program in Delphi. I don't get that same feeling in .NET...

"the NewsGator API is built on is all .Net handling 400-600 requests per second."

FWIW that isn't really a figure to brag about: that's what servers built at the turn of the century (2001 to be precise) could handle, on much less powerful hardware than what we have today, and the network was the bottleneck back then, not the CPU.

We wrote our latest software-as-a-service, Nefsis entirely in Delphi 2007 (http://www.nefsis.com). This type of application, capable of showing 24 real-time videos at 30 frames per sec. on the screen, while allowing all of them to VoIP in full duplex (with echo cancellation) and share their live desktop at the same time, with high definition resolution is not possible with .Net code, sorry.

And while the HTTPListener class under .Net is a great and fast handler of http traffic, our backend service, also running in Delphi is capable of moving 500Mb/sec at a time, and is not CPU bound at all - once again sorry, can't do that with .Net. Our application I think it the best example of a super-high performance product in Delphi that cannot be matched by other platforms. It fully leverages all the cores (up to 8 of the desktop) and leverages the full Intel chipset capability all from Delphi (MMX, SSE3/4) - sorry can't do that with .Net. We just finished converting to Delphi 2009 for full Unicode support - all native code and since our customers can now use Unicode and don't require a 20MB+ runtime to join a meeting as with .Net.

@Nick Harris: Our core software is implemented as a fully multithreaded DCOM server living in a service and it's written in Delphi. I don't find the language/framework of any limitation.

Perhaps the biggest trouble with Delphi is that it's not a "hip" language anymore, so it's very hard to find pro devs who are willing to work in Delphi. That may not be a problem for a mISV, but it affect even small software shops like us.

That, and the uncertain future of Delphi (just see how many times 64-bit was postponed - come on...) is making us to regret we invested so much in Delphi.

The .Net run time still a problem, for example I have version 2 and 3.5 Installed on My laptop, I downloaded very small application "MyToDo" which is 600KB only, when I was trying to install it was trying to download .Net framework from internet, I think it was require V 1.1 or what ever, and didn't allow me to install without downloading the framework.

I closed setup and deleted it, and will never try to install any program will do the same, so here's Delphi shine.

Amen to that Nick. We develop real-time DSP software using Delphi and wrote an internal test version using .Net. It was just not able to cope with the real-time demands placed on it by our software. .Net is good at using and natively connecting to other .Net systems/assemblies, outside that its sub-optimal. (for example .Net MySQL connectivity performance is utterly woeful)

Also every now and then MS pushes some new technology down developers throats link WPF or LINQ that once you stop to think "why do I need this" you realize they are superfluous, this quite aside from the fact that their performance is terrible.

The fact that you feel compelled to defend Delphi reveals why it's not the platform of choice for most developers. It's not a market leader and has a waning (though enthusiastic) user base. As a user I really couldn't care less what you wrote it in as long as it works. As a business owner I'd be significantly more concerned. I'd be willing to bet 100 bucks that .NET will be around in 10 years. I wouldn't bet a nickle that Delphi will be around next year (not that I want it to go away I (like others) just don't believe it's going to be around in the face of greater competition from big players over the long haul). I think you'd admit that the very long, painful, search for a developer to take over topstyle was exacerbated by the fact that it was written in Delphi. Not trying to troll - would be interested in objective response if any think I'm way off base here.

Those are the advantages of Delphi, but the Delphi Haters Blog gives some of the downsides - its worth reading both.

Personally I'm content using either C# / .NET or Delphi - both have their fair share of issues and advantages.

To those who think .NET is npothing but "the big engine that can't" just look at Paint.net. Having to get the framework (3.5 I think) hasn't been a block to many people downloading and using this program.

For the future though Embracardo (or whoever) have a real problem getting a return on Delphi though, which is why the cost is so high (and hard to justify vs. VS Express) and why the free editions have not been updated in ages.

As a final question - why do you say "by all accounts the latest versions are..." - I take it you don't use those versions ?

"To those who think .NET is nothing but "the big engine that can't" just look at Paint.net. Having to get the framework (3.5 I think) hasn't been a block to many people downloading and using this program."

Hmm, that's not quite the way the Paint.NET folks themselves see it... :