Tim Anderson’s ITWriting

Tech writing blog

November 9th, 2008

Code for Mac Cocoa in Visual Studio – surprised to see this?

I grabbed this screenshot from a preview just installed:

Cocoa app in Visual Studio

It comes from Delphi Prism, a new product from Embarcadero/Codegear which lets you code for .NET using the Delphi language, an object-oriented version of Pascal. The product is not as new as it first appears. It is based on an existing product from RemObjects, called Oxygene, which it now replaces.

Here’s the story in a nutshell. 2003: Borland, the company which created Delphi, decides (rightly) that .NET is here to stay, and releases Delphi 8, a pure .NET version. Nobody wants it, because it has no advantages to speak of over Win32 Delphi (which is faster), or C#, which is the Microsoft .NET language.

At that time some voices muttered that what Borland should do is to integrate Delphi into Visual Studio, rather than doing its own .NET IDE.  One was Marc Hoffman at RemObjects, only he did more than mutter: his company developed its own implementation of Delphi Pascal for Visual Studio, called Chrome.

Borland soldiers on with Delphi 2005, which does both .NET and Win32 in a single IDE. Developers are happy to have a new Win32 Delphi, but most still don’t see the point of the .NET stuff. Further, Delphi 2005 is buggy; many stick with Delphi 7. Next comes Delphi 2006: more of the same, but less buggy.

There’s a couple of problems with Delphi’s .NET support. First, it is always out-of-date compared to Microsoft’s .NET tools. Second, it has component library schizophrenia. There’s VCL for .NET, based on Delphi’s component and GUI library, but that’s not compatible with .NET components built for Windows Forms. There’s Windows Forms, but that’s not compatible with existing Delphi code. Borland decides to deprecate use of Delphi .NET with Windows Forms. This is really for VCL developers, it says.

Next comes Delphi 2007. Nice product, but where’s .NET? Gone. Nobody seems to mind [and it turns up later in RAD Studio 2007*]. Delphi 2009, gone again. But now there’s Prism, and it is a complete U-turn. Forget VCL.NET. It uses standard .NET libraries, runs in Visual Studio, supports Windows Forms, ASP.NET, WPF, and soon Silverlight. Oh, and it’s based on what that other guy did back in 2004, with some Borland Codegear Embarcadero technology thrown in: dbExpress database framework, client support for DataSnap multi-tier applications, and the Blackfish pure .NET database engine.

Very good; but there’s still that awkward question: why not use C#? The answer, I guess, being either that you love coding in the Delphi language, or you want to use one of the Delphi-compatible libraries.

Or that you want to use Mono, which of course is what enables those tasty Mac options in the New Project dialog above. You can also use C# with Mono – possibly you should, since it is Mono’s core language – but in Prism it comes nicely integrated into Visual Studio. Well, somewhat nicely. In practice there are a few extra steps you need to take to get it working. The recommendation is to run Visual Studio in a VM on a Mac, since Windows cannot run Cocoa applications. And you’re going to be using Apple’s Interface Builder; there’s no GUI designer in Visual Studio itself.

Hardly enterprise-ready then; but still an intriguing development.

*Added correction thanks to John Moshakis’ comment below.

October 6th, 2008

Prism: official Delphi language comes to Visual Studio

Embarcadero is to release Delphi for .NET as a Visual Studio add-on, called Prism. Marco Cantu has a summary. Note that according to this post, which is based on an announcement statement by product manager Nick Hodges at the SDN conference near Amsterdam, there will be:

full support for the .NET framework 3.5 (WinForms, WFP, Silverlight, ASP.NET, WCF, LINQ) … CodeGear will provide Datasnap 2009 integration and dbExpress for ADO.NET support

It looks as if this will be a full alternative language for .NET developers. Note that many of the language changes, such as generics, in the Win32 version of Delphi 2009 seemed to have .NET compatibility in mind. It makes sense for Embarcadero to use Visual Studio to host .NET development tools, just as it uses Eclipse for Java.

There remains an awkward question. What advantage is there in using Delphi (a version of Pascal) rather than C# for .NET development? If this is aimed only at existing Delphi developers migrating code, it will only ever be a niche.

Not good news for RemObjects Oxygene, which is also an Object Pascal add-on for Visual Studio; but Oxygene has some other tricks like Mono support, for running on Linux, which may sustain it.*

I am trying to clarify a couple of points. To what extent, if at all, will Prism support the .NET version of Delphi’s VCL (Visual Component Library), which would not fit smoothly with the Visual Studio design tools? Even if VCL.NET applications work, you would probably be better off using Delphi’s own IDE for them. Code ported from Win32 Delphi will likely use the VCL, so this is tough to get right. And what is the future of Delphi for .NET in RAD Studio? I will update this post when I know more.

*Comments below suggest that this is in fact Oxygene rebadged; I won’t say more until I’ve got official confirmation.

|