First Look at Delphi 8

By: John Kaster

Abstract: Its official designation is "Delphi 8 for the Microsoft NET Framework", and Cary Jensen, Ph.D. has the complete scoop

It's Here! Delphi.NET

AKA Delphi 8 for the Microsoft .NET Framework

By Cary Jensen, Ph.D.

Okay - it's not really named Delphi.NET; its official designation is Delphi 8 for the Microsoft NET Framework . It's here nonetheless, and Cary Jensen, Ph.D. has the complete scoop on the most eagerly anticipated new version of Delphi in years. Now you can program for the .NET platform at the speed of Delphi!

There is something poetic about the version number of Borland's first release of Delphi for the Microsoft .NET Framework, Delphi 8. If you enjoy coincidences, you'll be interested to know that the original release of Delphi, Delphi 1, was also an eighth version. Specifically, it was the eighth version of Borland's Pascal compiler; Borland Pascal with Objects version 7.0 was the immediate ancestor of Delphi 1.

I find this coincidence fascinating for another reason; Delphi 1 represented a major advance in Borland's Pascal technology without making existing Borland Pascal code obsolete. The parallels are uncanny. Delphi 8 for the Microsoft .NET Framework, which from this point on I will refer to simply as Delphi 8 for .NET, represents another major advance in the language we now call Delphi, without sacrificing your investment in Borland technology.

Consider this. Any current Delphi developer can build applications for the .NET Framework today using Delphi 8 for .NET, in some cases merely by opening an existing Delphi application in Delphi 8 for .NET and pressing [Ctrl][F9] to compile it. Even most of the tools you use on a daily basis, including the Code editor, object inspector, and integrated debugger, to name a few, are immediately recognizable, if not identical, to the Win32 version of Delphi.

But while Delphi 8 for .NET maintains an unprecedented amount of backward compatibility with Delphi for Win32, it simultaneously introduces the necessary new features to make it not only a first class .NET language, but also an exceptional development environment for defining, designing, building, testing, and maintaining .NET applications.

This article is designed to give you a broad overview of what you'll find in Delphi 8 for .NET. Keep in mind, however, that this article was written based on a pre-release version of the software. Similarly, the names of the various Delphi 8 for .NET technologies described in this article are based on early drafts of Borland's documentation. The corresponding names in the shipping product may differ.

For a detailed listing of the features of the shipping product, as well as in which edition (Architect, Enterprise, or Professional) those features appear, see the feature matrix available at http://www.Borland.com/Delphi.

A Familiar New IDE

The most obvious new feature in Delphi 8 for .NET is its IDE, shown in Figure 1. This IDE, which made its first appearance in Borland's C#Builder, appears similar to the IDE of Microsoft's Visual Studio for .NET. It has a nice, clean layout, and is highly configurable, giving you a wide range of options with respect to where your various tools float or are pinned. (Pinning is what many Borland developers would refer to as docking. In the .NET world docking refers to alignment.)


Figure 1: Delphi 8 sports a new IDE.

A closer inspection, however, reveals its unmistakable Borland heritage. Anyone familiar with the Delphi 7 IDE will quickly find themselves at home. The tools, options, and dialog boxes are generally accessed through the same or similar menu selections. For example, the Run menu, shown in Figure 2, is almost indistinguishable from that found in Delphi 7.


Figure 2: The Run menu.

The Code editor is another place where you'll find all your favorite coding support tools. In particular, Code Insight, code templates, the todo list, and editor key bindings are all available. For example, Figure 3 shows Code Completion, one of the Code Insight features, operating within the editor.


Figure 3: Code Completion in the editor.

On a similar note, the various key combinations and menu items related to the Code editor are consistent with the previous version of Delphi. For example, press [F5] to Add Source Breakpoint , [F9] to Run , [F7] to Trace Into , and even [Ctrl][R] to Record Keystroke Macro (if you're using the default key mapping).

But there are differences. One of the more notable changes can be found in the Tool Palette, shown in Figure 4, which replaces the Component palette in Delphi 7. Objects can be added to your projects either by dragging and dropping from the Tool Palette, or by entering the object name in the provided text box. With each letter of an object's name you enter into this text box, the list of objects that appears in the Tool Palette shrinks to include only those whose names match the entered characters.


Figure 4: The Tool Palette.

Objects in the Tool Palette are organized by category, and individual categories can be collapsed and expanded as needed. In addition, you can quickly go to a particular category by clicking the Category button and selecting from the displayed drop-down menu.

The Tool Palette is context sensitive, displaying only those components that are appropriate for the particular type of object on which you're working. For example, if you're designing a Windows Form, the Tool Palette displays those components that you can use to build GUI Windows applications. By comparison, if you're designing a Web Form, only Web-related objects appear.

Initially, the Tool Palette contains only a small, but well-chosen, collection of the objects that can be configured within the IDE. For example, although the 1.1 version of the NET Framework includes approximately 4,500 different classes, the Tool Palette initially contains less than 100 components.

You add or remove components from the Tool Palette by selecting Components | Installed .NET Components , or by right-clicking in the Tool Palette and selecting Installed .NET Components . This displays the Installed .NET Components dialog box, shown in Figure 5. The corresponding object will appear in the specified category in the Tool Palette when the check box to the left of a class name is checked.


Figure 5: The Installed .NET Components dialog box.

As you can see from Figure 5, this is also where you install unmanaged COM or ActiveX objects that you want to use in your application, as well as components from the VCL.NET (the visual component library for .NET; more about this later in this article). Unmanaged code in DLLs can also be used in Delphi 8 for .NET applications, but those are accessed using a different technique.

Another aspect of the IDE that looks a little different are the various options dialog boxes, including the Options dialog box (for general IDE options) and the Project Options dialog box. In this case, while the interface is a little different (a tree view on the left side of this dialog box displays the categories, instead of a tabbed notebook interface), the various frames within these dialog boxes are, again, familiar. The Options dialog box is shown in Figure 6.


Figure 6: The Options dialog box.

There are many new features, as well. The Model View, similar to Delphi 7's Diagram page, provides you with a diagram of the various objects that you employ in your application. Borland calls this code visualization. But if you're using the Architect version of Delphi 8 for .NET, the Diagram page becomes a sophisticated, synchronized UML diagram editor. A sample of code visualization for a medium-sized project is shown in Figure 7.


Figure 7: Code visualization for a Delphi 8 for .NET project.

Another new tool is the Data Explorer, shown in Figure 8. This dialog box provides you with a convenient browser for inspecting available connections using Borland Data Providers, or BDP.NET. (BDP.NET is described later in this article.) You can even drag tables, views, or stored procedures from the Data Explorer and drop them on any WinForm or WebForm application to have Delphi 8 for .NET add and configure the required BDP.NET classes to your application.


Figure 8: The Data Explorer.

No discussion of the new IDE would be complete without a few words about the WebForms designer. This designer, which is very similar to both the WinForms and VCL.NET form designer, permits you to build your Web page interfaces visually.

As you drop the various WebForm components into the WebForms designer, Delphi generates the corresponding HTML, inserting it into the .aspx file associated with that form. Similarly, if the component is one that has event handlers, such as a Button, Delphi adds the class reference to the WebForm class in the code-behind file, the file that contains the Delphi statements that will be executed on the server. An example of a WebForms in the designer is shown in Figure 9.


Figure 9: The WebForms designer.

Full .NET Support

Although there are many welcome similarities between the Delphi 7 and Delphi 8 IDEs, there can be no doubt about Delphi 8's .NET credentials. Delphi 8 for .NET is a .NET IDE, and the Delphi language is a full-fledged .NET language.

Unlike Borland's C#Builder, which uses Microsoft's C# compiler under license, Delphi 8 for .NET employs Borland's new .NET compiler for the Delphi language. When you compile a Delphi 8 for .NET project, this new compiler emits Microsoft Intermediate Language (MSIL), the CPU-independent instructions that are converted to native code, typically by a just-in-time (JIT) compiler. This MSIL is equivalent to that generated by any of Microsoft's compilers, including those for C# and Visual Basic for .NET.

Because Delphi 8 for .NET includes a full-fledged .NET language, it has access to the entire .NET Framework Class Library (FCL), a comprehensive library of classes, types, and symbols that constitutes the .NET equivalent of Delphi's VCL. Classes in the FCL provide extensive support for data access (ADO.NET), WebForms (ASP.NET and Web Services), WinForms (Windows GUI development), XML development, and much more. In short, as a .NET developer using Delphi 8 for .NET, you're making no sacrifices.

Also as a result of its true .NET nature, Delphi 8 for .NET developers have transparent access to any public classes declared in legitimate .NET assemblies. This means that all third-party .NET components are easily accessible to Delphi 8 for .NET developers, regardless of the language in which those components were developed.

To accommodate many of the features of .NET, Borland introduced significant enhancements to the Delphi language. These include the addition of attributes (descriptive declarations that are used to identify the characteristics of programmatic elements), unit namespaces, operator overloading, and new visibility identifiers. For example, class declarations now support both strict private and strict protected visibility.

What is particularly exciting about these enhancements to the Delphi language is that Borland has indicated that these new features will also be added to future versions of the Delphi Win32 compiler. This will be done to ensure that your code continues to be compatible with the various Delphi language compilers.

Beyond the .NET FCL

Although Delphi 8 for .NET provides full support for the FCL, it goes well beyond, making the Delphi language an especially attractive solution for .NET development. Specifically, Borland has included in Delphi 8 for .NET a number of technologies that extend and/or complement the FCL. Borland refers to these technologies as Borland Data Providers (BDP.NET), RTL.NET, VCL.NET, dbExpress.NET, IBX.NET, DataSnap.NET, and BDE.NET.

The first two of these technologies, BDP.NET and RTL.NET, can be used in standard WinForms, WebForms, and console .NET applications that employ the FCL. BPD.NET is a collection of concrete classes that implement the ADO.NET interfaces used for data access. These concrete classes differ from the corresponding FCL concrete classes in that they provide an open, portable solution for accessing a variety of different database servers, including Microsoft SQL Server, InterBase, Oracle, and DB2. (Note that BDP.NET is available only in the Architect and Enterprise editions of Delphi 8 for .NET.)

The RTL.NET is a .NET version of Delphi's runtime library, the collection of pure functions and procedures (and their associated constants, variables, and types) that you can use from your custom code. RTL.NET maintains a tight source code compatibility with Win32 versions of Delphi, smoothing the migration path of your existing Win32 code to .NET, as well as permitting you to write routines that easily compile under your platform of choice.

In my opinion, the presence of RTL.NET alone provides a compelling argument to use Delphi as your preferred .NET language. RTL.NET includes literally hundreds of useful routines, including those in the Borland.Vcl.SysUtils, Borland.Vcl.StrUtils, Borland.Vcl.DateUtils, and Borland.Vcl.Math units, to name a few.

Another Borland technology, Db Web Controls for ASP.NET, is available for use when you're building WebForms. These are visual, data-aware Web controls that you can use with ADO.NET and BDP.NET classes to quickly and easily build database Web applications.

The remaining technologies listed earlier in this section are designed to simplify the process of migrating existing applications from Win32 to .NET, as well as to permit developers to leverage their current skill sets when building new .NET applications. These technologies can be broadly referred to as VCL.NET, with dbExpress.NET, IBX.NET, DataSnap.NET, and BDE.NET being subsets of VCL.NET technologies.

VCL.NET is a component framework that provides extensive source code compatibility between Delphi Win32 and Delphi for .NET. The classes and types available in VCL.NET represent a rich subset of the Win32 VCL. Furthermore, these classes and types sport interfaces that are essentially identical to their VCL counterparts, permitting you to easily create single source projects that can be compiled either to the .NET platform or Win32, as well as to provide a greatly simplified migration path to .NET.

At first glance, VCL.NET is truly remarkable. If one of your existing applications makes use of common Delphi VCL components (Edit, Label, DBGrid, MainMenu, and the like), you may be able to simply open that project in Delphi 8 for .NET and compile it to MSIL.

For example, if you've installed both Delphi 8 for .NET and Delphi 7, use Delphi 8 for .NET to open the ConvertIt project, which by default is located in the DemosConvertIt folder under the Delphi 7 directory. Press [F9] to compile and run this project as a .NET assembly without changing a single line of code. Amazing, isn't it?

As for dbExpress.NET (dbExpress for .NET), IBX.NET (InterBase Express for .NET), DataSnap.NET (for building DataSnap clients under .NET), and BDE.NET (Borland Database Engine for .NET), these are .NET implementations of the associated VCL classes for data access. As with other parts of the VCL.NET, these classes provide a nearly seamless upgrade path to .NET for most existing database applications. Here you will find such classes as TSqlDataSet, TIBConnection, TClientDataSet, TDataSetProvider, TDCOMConnection, TDataSource, and even TTable . (Only the Architect and Enterprise editions ship with dbExpress.NET and DataSnap.NET.)

Take a look at Figure 10. This is the FishFact.drp project, which is located in the DemosDBFishFact folder located under the Delphi 7 directory. What you see in Figure 10 is a VCL.NET application that uses BDE.NET to access a Paradox table. Like the ConvertIt project, all I did was open FishFact.dpr in Delphi 8 for .NET and hit [F9] . And voil` ! I get a running .NET managed code assembly.


Figure 10: A Delphi 7 Project compiled as a .NET assembly.

I suspect that VCL.NET will be particularly important to two groups of Delphi developers: those who need to run existing applications under .NET with a minimum of changes (or future maintenance), and those who need to create quick and dirty .NET applications without having to learn the FCL.

For most other developers, it's probably best to bite the bullet and learn the FCL. This will take time, but you won't be alone - nearly every other developer using .NET is going through the same thing. After all, the FCL is the native class library of .NET. It's a good one too!

Soup to Nuts: Borland's ALM Offerings

For more than a year now, Borland has been enhancing their best-of-breed programming environments with a rich collection of tools that help manage nearly all aspects of the application lifecycle, from requirements management, to UML modeling tools, to source code version control, to defect tracking.

Although most of these tools can be purchased separately, the high-end editions of Delphi 8 for .NET include some or all of these tools. Delphi 8 for .NET Enterprise includes all the features available in the Professional edition, as well as CaliberRM and StarTeam Standard Edition Client and Server (in addition to BDP.NET, DataSnap.NET, and dbExpress.NET). The Enterprise edition includes all of the tools that ship with the Enterprise edition plus ECO (Enterprise Core Objects), a sophisticated two-way tool for building and maintaining applications using UML class diagrams, as well as OptimizeIt, Borland's .NET profiler.

Is Delphi 8 for .NET Right for You?

Most Delphi developers will find Delphi 8 for .NET very exciting. First of all, it permits you to build .NET applications today using the tools you know and the language you love. Let's face it, if you build applications for Windows, you will eventually need to be working in .NET. Delphi 8 for .NET makes it easy.

If you're a Delphi developer, but aren't using Delphi 7, you'll be interested to know that Delphi 8 for .NET includes a copy of Delphi 7 (for Win32). Even if you have only a passing interest in .NET development at this time, the offer to get Delphi 7 bundled with Delphi 8 for .NET should provide you with a pretty compelling argument for upgrading.

For developers who aren't using Delphi at all, I personally think Delphi 8 for .NET deserves a good look. As I pointed out earlier, Delphi 8 for .NET includes RTL.NET, quite possibly the richest set of .NET routines available. That, coupled with one of the easiest to write and maintain languages available (I'm talking about the Delphi language), and with Borland's outstanding compiler and support tools, make Delphi 8 for .NET a very attractive .NET solution. And if you must build applications for both Win32 and .NET, you'll find no other language that makes this inter-platform migration as easy.

About the Author

Cary Jensen, Ph.D. is president of Jensen Data Systems, Inc., a training and consulting company that won the 2002 and 2003 Delphi Informant Magazine Readers Choice Awards for Best Training. Cary is the co-author of 19 books, including Advantage Database Server: The Official Guide (McGraw-Hill/Osborne, 2003), Building Kylix Applications (Osborne/McGraw-Hill, 2001), JBuilder Essentials (Osborne/McGraw-Hill,1997), and Delphi in Depth (Osborne/McGraw-Hill, 1996). He is the author and trainer for the Delphi Developer Days tours, a Contributing Editor of Delphi Informant Magazine , and a featured Web columnist on the Borland Developer Network. For more information about Cary and his company's services, including Delphi Developer Days 2004 workshops and seminars, visit http://www.JensenDataSystems.com.

This article originally appeared in Delphi Informant Magazine, http://www.DelphiZine.com, and appears with permission of Informant Communications Group, Inc


Server Response from: ETNASC01