Wednesday, July 4, 2007

Delphi 2006 Pro: A Review

Delphi 2006 is now shipping and several of the Delphi faithful, including your humble narrator, have installed and used Delphi 2006, aka BDS 4.0. The Borland Development Studio, as Delphi is now called, supports Delphi, C#, C++, Visual Basic and markup languages in varying degrees of completeness. The Delphi language has the widest support, covering Win32, .NET and Web Services. Visual Basic is afforded the least support, as there is no Win32 or designer support for the Visual Basic Language. This release marks a milestone for Delphi, a release that definitively and unambiguously says that “Borland is Back!”, to quote an ill-fated advertising campaign of a few years back.

Sometimes I think Borland should change its name to Pheonix, because of its remarkable ability to repeatedly rise again from the ashes of its own funeral pyre. As it was losing revenues and market share in the C++ Windows market, Delphi came along to fill in the gap. When Delphi sales were slagging to near fatal levels, JBuilder stepped into the arena to save the day. Now that the Java IDE market has been utterly Eclipsed, it falls to the Borland Development Studio and ALM to now save the day. Is this latest release up to the challenge?

Probably, but only time will tell. Despite the foolish conceits of fortune tellers and hedge fund managers, the future is a dark opaque mist totally concealing the fate of men. What I can tell you is what I’ve concluded as I use Delphi 2006 Pro for development on a Win32 desktop application I’ve been working on as a hobby in my spare time. This means this review is very slanted, as it only considers those things of interest to someone using D2006 Pro to write a Win32 application in the Delphi language. There is no ECO or other high level architect features reviewed in this blog.

My verdict on Delphi 2006 Pro? I think this is the best release of Delphi I have ever seen. Here are some of the reasons for this conclusion, which together collectively support my claim, I think:

1) Code compiled with D2006 is more robust and up to 40% faster than code compiled with Delphi 7. Thanks to the incorporation of several improvements authored by the guys from the FastCode project, the memory manager and several of the RTL routines are much faster than in prior versions of Delphi. This is especially true for multi-threaded applications, where the stock Delphi memory manager had been rather weak. By replacing their previous memory manager with FastMM, the guys at Borland were able to speed up the IDE, and by compiling the FastMM memory manager into compiled applications the savings are also passed on to you. Apps written with this new memory manager are faster, they scale and multi-thread much better, load more quickly, and suffer far less memory fragmentation over time. In short, applications compiled with D2006 will be faster and more robust than if compiled with Delphi 7, without needing anything other than a recompile. (eg. ) In addition, Delphi 2006, like Delphi 2005, allows you to speed up your Delphi code by inlining functions, like you can do in C++.

2) The IDE is robust. Lately, Delphi releases were rushed and perpetually unfinished. Delphi 8 was both incomplete and fragile, and Delphi 2005 took a couple of updates to really become usable as a development tool. Delphi 2006 has proven to be quite stable right out of the gate. Dissenters on the newsgroups are usually either blaming the IDE for bugs in their own code, or bugs in third-party code, or bugs in hardware drivers ( eg. which was eventually followed by this mea culpa: ), or they have found some of few genuine bugs, which so far seem to almost always have a workaround.

3) The integrated debugger is improved. One of the benefits of switching to the FastMM memory manager is that FastMM keeps track of and reports on memory overwrites and similar errors ( for example, I recently got this message logged to my event log: Debug Output: HEAP: Free Heap block 1b7110 modified at 1bae6c after it was freed Process JSN.exe (2248) ). In addition, the debugger now shows you your data structures in tree form at breakpoints, and lets you see all the local variables at each level of the stack trace. Debug browsing hints are fast and responsive. You can now detach from processes, not just attach to them. In addition, you can “Set Next Statement”, which allows you to move the instruction pointer forward or backward to any active line, during integrated debugging. This can be quite useful if you want to stop, change a variable and then run a section of code again with the different value.

4) The IDE now has live code templates. Code templates are scriptable macros, and Delphi 2006 comes with a few dozen right out of the box. They are saved in XML format for easy editing and copying. Apparently someone at Borland has spent a great deal of time designing and fleshing out this feature, which greatly surpasses all the third-party macro tools you could find before. There is apparently a lot of power built into the scripting available for these templates, as exemplified by the template that completes a case statement by enumerating all the values of an enumeration variable as case values. As news of this feature gets around, we should expect a nice third-party virtual bazaar to materialize where people share their templates. Those of you that still yearn for tools like CodeRush to return to the Delphi realm should take note of this feature. Properly used, this feature could greatly improve programmer productivity, once you get used to it.

5) Delphi 2006 has extensive Refactoring and extended Find functionality. Though these both were introduced in D2005, they are both much more robust and complete in D2006, though not perfect. The ability to find and possibly change all instances of a particular symbol or method is invaluable, especially when it spans all units in a project. (While tools like Grep let you search for strings, they do nothing to keep from matching same-named symbols and methods in other classes.) The number of refactorings available in D2006 is surprisingly high and complete, though a few of the more elaborate ones depend on the integrated Together functionality, which is still a bit slow on all but the very fastest machines. The refactoring in D2006 almost rivals that provided by add-ins like CodeExplorer, though I still find myself using CodeExplorer on a continual basis.

6) Error Insight is one of my favorite features. It is like the grammar checking in Word, except for code. Once I figured out how to keep it from erroneously marking correct code (see ), I found this to be very useful. It is one of those things that becomes such an integral part of your coding that you only realize it when you have to descend to a lower version of Delphi for a client.

Well, that is my list for now. There are a lot of other features and nice things about Delphi 2006 that I did not touch on, but these are the six things that I like the best about Delphi 2006. Personally, I think there is no reason for a Delphi enthusiast not to embrace this release. Borland has achieved something that has eluded them for several years, a Delphi release that is solid and useful, all at the same time.

1 comment:

Software development Blog said...

I recently came across your blog and have been reading along. I thought I would leave my first comment. I don't know what to say except that I have enjoyed reading. Nice blog. I will keep visiting this blog very often.
Thank You