Borland’s new programming suite
lets you program for Win32 or .NET in C#, C++ and Delphi.
And it has one major advantage over Visual Studio,
says Huw
Collingbourne.
See also: A Visual Studio user's
view of Borland Developer Studio
and: Bob Swart on ECO III
If you thought Microsoft’s Visual Studio
was the only serious IDE for Windows programming -
think again! Borland’s
Developer Studio (BDS) 2006 is a suite of programming
languages with an elegant environment, a good code
editor, visual designer and debugger.
The Borland Developer Studio has a first rate IDE. Here
you can see the form designer workspace. You can drag
and drop controls onto the form from the Tool Palette
(bottom right) and alter properties in the Object Inspector
(at the left). A tabbed 'Events' page lets you pick events
for a selected control and you can program event-handler
methods in the code editor.
In common with Visual Studio
2005, the BDS can create .NET applications. But, unlike
Visual Studio, it also provides a full set of editing,
design and debugging tools for Win32 applications.
And best of all, it is even possible to create ‘cross-platform’ Windows
applications that that can be compiled either for Win32
or for .NET. This is one show-stopping trick which
Microsoft customers can only dream of…!
BDS Editions
Borland Developer Studio 2006 comes in three editions: Professional ($1,090
/ £740
plus VAT), Enterprise ($2,490 £1,670 plus VAT) and Architect ($3,490 / £2,320
plus VAT). Reduced upgrade prices are available. Each edition is branded with
a specific programming product name - Delphi, C#Builder or C++Builder. But, no
matter what’s on the outside of the box, inside the software is the same.
The Professional edition includes all languages, the IDE and local database support
(Interbase, dBase, Paradox, Access, MySQL etc.). The Enterprise edition adds
UML modelling, database server connectivity, team support and additional web
development tools. The Architect edition adds in State Chart Diagrams and
extra ECO (Enterprise Common Objects) features. You can download the complete feature
matrix (PDF) from the
Borland site |
Power By Design
The Borland Developer Studio supports the Delphi
(Object Pascal), C# and C++ languages. For .NET development,
using Microsoft’s standard libraries, you can choose
between C# and Delphi; for Win32 development using Borland’s
VCL (Visual Component Library) you have a choice of either
C++ or Delphi. In addition, Delphi can also be used to
program .NET applications using a .NET version of the
VCL which offers a high degree of compatibility with
the Win32 VCL. This makes it possible to load up existing
Win32 projects and recompile them for .NET with relatively
little code rewriting. In principle, only code which
makes explicit API calls, does pointer manipulations
or uses platform-specific types (such as the PChar -
string-pointer types) will need to be recoded.
When you move controls on a VCL form, horizontal and vertical
lines appear to show when the edges of controls and captions
are aligned
Some of the most immediately obvious new features are
found in the visual design workspace. For example, the
new VCL form designer has gained dynamic alignment guides.
These are lines which appear on screen when you drag
controls around on a form. When the vertical or horizontal
edge of one control aligns with the matching edge of
another control a line automatically ‘joins’ the
two of them so that you can tell instantly when they
are in perfect alignment. There are also visual cues
to show you when controls are evenly spaced or at an
optimal distance from one another.
Useful as these features are, they are, disappointingly,
only implemented in VCL applications. If you are working
an a Windows Forms .NET application, no alignment guides
are shown. Since Microsoft’s Visual Studio 2005
provides similar alignment guides, this omission seems
curious.
At design time your
form remains 'stuck' to the top-left corner
of a larger window and cannot be moved around.
However, notice the little grey box down
at the bottom. That is the Form Positioner.... |
|
This is the Form
Positioner at actual size. The white rectangle
represents the form and it can be dragged
around to set its startup position - i.e.
where it appears when the program runs. |
|
Another tool provided exclusively for VCL applications
is the Form Positioner. In older versions of Delphi you
could drag the free-floating form around the screen at
design time in order to place it at a startup position
when the application is run. In the new design workspace
the form is embedded into a larger window at design time
making this kind of positioning impossible.
In the last version of Delphi you could specify the
startup position of a form by setting properties to place
it at screen centre or at a numerical offset. The new
Form Positioner lets you set the position interactively
by dragging a tiny rectangle representing the form to
a position on a slightly larger rectangle representing
the screen. This is certainly better than having to position
the form numerically but is, frankly, inferior to the
old-style way of doing it - by dragging the free-floating
form at design time.
Interactive Editing
Unlike Visual Studio, the BDS has no built-in programming
or macro language. However, it has gained some useful
new additions to speed up some coding tasks. There are
things called ‘live templates’ which are,
in essence, blocks of boilerplate code with some interactive
features. For example, in C#, you could create a for loop by entering the text ‘for’ then pressing
the space bar (or Ctrl+J and selecting a template from
a list). This would automatically insert this code:
By pressing the Tab key you could
now jump between the ‘live’ elements (shown
in boxes), int, i and length to
allow you to edit these. If, for example, you change
the first occurrence of the variable i to x,
the subsequent references to i will
automatically be changed to x.
There are live templates to insert class definitions, get and set properties, case statements
and so on, with different sets of templates for each
language. The templates are defined in XML files; new
templates can easily be added (there is a New Item Wizard
to help with this) or existing ones edited.
The C# Code Surround
Menu... |
|
There is also a ‘code surround’ tool
which lets you mark off a block of text in the
editor and make a menu selection to surround with
language constructs such as a while block,
a try..except exception
handling block or comment delimiters. Handy as
this is, the menu had the annoying habit of vanishing
off the bottom of the screen if you select text
midway down the editor at some screen
resolutions (e.g. 1024x768).
The BDS editor has all the things you would
expect of a modern code editor including syntax
colouring, collapsible regions, multi-level undo/redo,
brace matching and Code Insight (Borland’s
equivalent of Microsoft’s IntelliSense
- providing drop-down lists of properties and
methods, the arguments required by method calls
and so on).
|
|
In this new release it has
gained an improved ‘gutter’,
the left-hand margin of the editor in which
line numbers are displayed (every ten lines
or at intervals of the user’s choice).
The gutter also displays a coloured change
bar to mark any lines which have been edited
(yellow here) and saved since the file was
opened with a different colour marker showing
lines which have been edited by not yet saved.
The gutre is also used for setting breakpoints
(the red circle) when debugging. |
Other improvements include some new VCL components
such as panels which mimic the layout features
of Java (e.g. GridBagLayout and FlowLayout) and
a control to let you add application icons to the
Windows system tray. |
A Pascal Alternative
For Pascal programmers, there is now an alternative to Delphi for .NET. RemObjects’ Chrome is an implementation of the Object Pascal language for .NET which integrates
into Microsoft’s Visual Studio. We shall be reviewing Chrome shortly. |
Debugging and Language
The debugger has gained a few new features such as remote
debugging (that is, debugging an application on a different
PC running on a network or across the Internet) and the
ability to ‘drill down’ into properties and
fields within a single debugger window instead of constantly
having to popup new inspector windows for each new level
of detail as was required in previous releases of Delphi.
In my view, this is a huge improvement. I have never
grown to love the old style of Delphi debugger which
had the uncivilised tendency to fill your workspace with
popup windows. The new style debugger is much more like
the one in Visual Studio.
Forget all those popup debugging windows - the new debugger
lets you drill down by expanding branches on a tree,
just like Visual Studio
There are also expandable tooltips
which let you drill down into variable values by letting
your mouse hover over them and opening up ‘cascading’ tips
to display ever more detail. Once again, there is a similar
feature in Visual Studio.
You can even do drilldown debugging using popup hints to
inspect values
There have been a few additions to the Delphi language
too. For instance, operator overloading, within certain
restrictions, has been added to Delphi for Win32 in this
release, bringing it into line with Delphi for .NET.
But perhaps the oddest change to the language is the
addition of methods to records; this makes records, to
all intents and purposes, very like classes. The rationale
behind this is, apparently, that records are allocated
on the heap while objects are allocated on the stack;
records variables are value references while object variables
are object references. In other words, when you assign
a record you make a copy of it but when you assign an
object, you do not. There are other differences too:
records retain the ‘traditional’ ability
to have ‘variant’ parts; they do not require
a constructor (though they may optionally have one) and
cannot have a destructor; they cannot have virtual methods
and they do not support inheritance. Maybe there is somebody
out there who has been craving for OOPified records -
all I can say for certain is that I haven’t.
As an added bonus for C++ developers, Borland’s
C++Builder product has now been substantially updated
and integrated into the BDS environment. C++Builder is,
for the time being, entirely restricted to Win32 development.
It has the same features as the Win32 Delphi implementation
with its visual design tools, integrated editor and debugger
and so on. C++ programmers should be aware, however,
that its class library is the VCL, which is written in
Pascal.
The BDS Roadmap
Borland Developer Studio 2006 (formerly code-named DeXter)
is aimed at improving certain features of the IDE and modelling tools; it also
introduces C++ into the BDS. The next version (‘Highlander’),
scheduled for 2006, aims to bring Delphi into the .NET 2.0 platform and will
add support for VCL on the Compact Framework to let developers create applications
for mobile devices. In 2007 the ‘Longhorn’ release will
concentrate on utilising Microsoft’s
forthcoming interface and communications technologies (‘Avalon’ and ‘Indigo’)
and will give the C++ language managed support. More on the BDS
Roadmap on the
Borland site. |
Win32 and .NET Compatibility
Finally, let’s return to one of Delphi’s
greatest claims to fame - its ability to migrate Win32
applications to .NET, or even to allow the simultaneous
development of applications for the Win32 and .NET platforms.
Whereas Microsoft has done much too little, much too
late, to assist Visual Basic users to migrate to .NET,
Borland has provided a whole .NET version of its existing
component library, the VCL, to ensure (in theory) that
it is very simple to move between Win32 and .NET.
In some cases, it is even possible to load up Win32
applications and run them under .NET without having to
rewrite a single line of code. However, in practice,
the conversion process will rarely be quite that simple.
Most applications of any complexity will require a good
many manual alterations to code. Pointer operations,
API calls and any code which uses ‘incompatible’ types
such as PChars, will have to be recoded. Some of the
recoding may be straightforward - simply substituting
one type for another, say. Others may require more work
- for example, you may need to add namespaces, remove
redundant lines of code, create some .NET objects when
necessary, move the position of some code (in my experience,
you can get away with some things in the Win32 VCL -
for example, setting the handle to a control within the
control’s
OnCreate() method - which you cannot in the .NET version)
and so on.
From Win32 To .NET in
Five Steps...
To test out Delphi's ability to convert a Win32
application to .NET I loaded up the drag and drop
application launcher which I programmed
in one
of my Delphi columns on Bitwise. I particularly
selected this project since it contains a number
of API calls and uses the PChar data type which
is unsupported in .NET. These are the steps I went
through to in order to get this Win32 VCL application
working running in .NET...
Step One: Load the Win32 VCL project. Delphi asks
me if I want to run it as a Win32 or .NET project.
I choose .NET
Step Two: The Structure Pane lists methods which
are not supported under .NET. It turns out that
they aren't needed and it takes just a few moments
to edit them out
Step Three: When I attempt to compile, the Messages
pane shows a whole load of hints and a couple of
errors. Here it highlights an API call which requires
a null-terminated string - in my original code
I used a fixed length array of characters. The
message tells me that, in .NET, I need to use a
StringBuilder object
Step Four: I create the StringBuilder object with
a little help from Delphi's drop-down 'code insight'
tool
Step Five: After fixing a few other incompatibilities
similar to the ones mentioned above my project
is ready to compile - and lo and behold! - it actually
works. I can drag and drop applications from Windows
Explorer, making a few handy API calls en route.
My code adds icons and event-handlers to application-launching
buttons created on-the-fly. And now this is a .NET
application...
|
While there is no substitute for hand-coding the finer
points of a converted project, I nevertheless feel that
Borland could have provided a little more assistance
at some points. To take one example: when a namespace
is required in a project the .NET conversion tool should
add it automatically (it doesn't). When different types
are required in API calls (e.g. a string or a StringBuilder in .NET instead of a PChar or
character array in Win32), the conversion should either
be done for you or, at least, it should be provided as
a comment within the converted code; instead, what you
will get are somewhat terse and often cryptic error messages
when you attempt to compile the project.
This brings me to one final gripe. The Win32-to-.NET
conversion help is, frankly, poor. The fundamental ‘problem
areas’ are documented briefly but there is little
in the way of context-sensitive help to assist with specific
conversion problems. A thorough step-by-step tutorial
on project conversion and platform compatibility should
have been provided. Another drawback of the help system
is that much of it is the standard Microsoft version,
with examples in C#, VB .NET, C++ and J# - but not in
Delphi.
What’s In
A Name?
The Borland Developer Studio
2006 is the latest in a product line which used
to be called Delphi. And frankly, some of us still call
it Delphi no matter what the Borland marketing department
would have us call it!
Don't judge a box by its cover!
Each box features
the name of a different language - but the contents
are exactly the same!
Delphi was first launched
just over a decade ago. For its day it was a cutting
edge programming tool. It combined the visual design
capabilities of Visual Basic with the compiler
efficiency upon which Borland had built its reputation.
In those days, Delphi was the name of
the development suite and Object Pascal was
the name of its programming language. In practice,
most Delphi users didn’t
make that distinction. We talked about the Delphi
IDE and ‘the Delphi language’.
Now Borland has decided that ‘Delphi’ is
the name of the language (or ‘personality’ as
they now insist on calling it) and is synonymous
with ‘Object Pascal’. The entire IDE
and its suite of languages (Delphi, C# and C++)
is called The Borland Developer Studio - though,
just to confuse the issue even further, you can
buy the box with one of three different covers,
each of which bears the name of one of the languages.
No matter what’s
on the cover, however, you get the same product
inside the box.
In spite of each language having its own ‘star billing’ on a box
of your choice, this does not indicate that each language is supported equally.
The C# language can only be used for programming applications using Microsoft’s
.NET Framework albeit with the additional ability to use Borland’s
ECO. The C++ product has been upgraded to bring it
into line with Delphi for Win32 but currently it
cannot be used with .NET. Only Delphi is able to
straddle the Win32 / .NET divide. |
Delphi, VB and Visual Studio…
Before giving my final judgement on the Borland Developer
Studio, I must confess a prejudice. I have been programming
in Delphi ever since version 1 was released over a decade
ago. Before that I programmed in Borland’s earlier
Pascal products for Windows and DOS. I have, in short,
programmed more in Delphi than in any other language
and in many respects I feel more ‘at home’ with
Delphi (and its successor, the BDS) than with any other
programming system.
But, putting aside my personal bias, I have to wonder
if this new version of the software will a) satisfy existing
users planning to upgrade or b) attract new users who
might formerly have been using some other language or
IDE.
Let’s consider existing users first. To be blunt,
I can’t see much in the way of ‘must have’ features
in this new version. There have, it’s true, been
a number of useful improvements to the editor, VCL and
to the modelling tools and ECO. But nothing that makes
me jump out of my skin with excitement. Nor do the language ‘innovations’ such
as records with methods and operator overloading strike
me as hugely significant.
At least C++Builder users have finally been provided
with an upgraded product, albeit one that still hasn’t
entered the world of .NET. For Delphi users, though,
perhaps the main hope is that BDS 2006 proves, over time,
to be more stable than the previous release which was
widely criticised for its buginess.
So what about users of other IDEs? I suppose we are
really talking about one IDE in particular - Microsoft’s
dominant Visual Studio. I think we can discount the possibility
that C# programmers will be tempted away from Visual
Studio in droves. For .NET development, C++ programmers
have no choice - it’s Visual Studio all the way.
Borland may, I suppose, pick up a few Win32 C++ programmers
looking for a good visual design tool for Win32. That
leaves Visual Basic programmers. We have written several
times in Bitwise about the huge
problems that VB6 programmers
face at the moment. Microsoft has no intention of continuing
to develop or support VB6, insisting instead that VB
coders sacrifice their existing code and switch to a
different language with a similar name: VB .NET.
Many VB coders have shown no inclination to do so.
Some are switching development to C#. Others have moved
to Delphi. Switching from VB to Delphi is certainly not
an easier task that switching from VB to VB.NET. However,
Borland, unlike Microsoft, provides a cross-platform
class library - the VCL - which means that, with relatively
little effort, it is possible to create and support a
single application that can be compiled both for Win32
or .NET.
Win32/.NET compatibility gives Delphi a tremendous
advantage not only over VB but over any Microsoft language.
Never mind all this ‘language personality ’ nonsense
that Borland is currently plugging. Sticking a different
wrapper on the box and calling the product Delphi, C++Builder
or C#Builder fools nobody. The major player in
this suite is Delphi. Borland would do well to clarify
that fact. C++Builder plays an interesting but minor
part; C#Builder is nothing but a stand-in for Microsoft’s
Visual C# - useful to have around but no serious competition
to the Microsoft product. Delphi, on the other hand,
is a star turn.
In my view Borland is doing this product a profound
disservice by trying to pitch the BDS 2006 as a competitor
to Visual Studio. The plain fact of the matter is that,
for pure .NET development, Visual Studio is unparalleled.
This is hardly surprising. Not only is Microsoft a much
bigger company than Borland but it’s also the developer
of .NET - so naturally it’s got a head start.
The current incarnation of Visual Studio is, in many
respects, way ahead of the Borland Developer Studio.
To take two simple but important examples - Visual Studio
2006 has full support for the Compact Framework (for
developing applications for mobile devices) whereas Borland
only offers an optional downloadable ‘technology
preview’;
moreover, Visual Studio is now using the .NET 2.0 Framework
whereas the Borland Developer Studio is still based on
.NET 1.1. Besides which - to the best of my knowledge,
the developer community isn’t crying out for an
alternative to Visual Studio. What many developers do want,
however, is a bridge between Win32 and .NET - something
which Borland can supply with Delphi but which Microsoft
has failed to provide.
ECO III
BDS 2006 gains a new version of Borland’s ECO (Enterprise Core Objects).
This is a framework for application development using UML (Unified Modelling
Language) and OCL (Object Constraints Language). In general terms, ECO facilitates
the creation of database applications using a visual design tool which lets you
draw diagrams (‘models’) from which objects are generated. For a
good example of the power of ECO, refer to Bob Swart’s
series on creating
a Delphi Blog application. ECO III is now available in all editions of Delphi,
not just the Architect edition as previously. However, The Enterprise and Architect
editions have some additional development tools which are not available in the
Professional edition. Borland has some online demos which explain ECO in more
detail:
http://community.borland.com/article/0,1410,33406,00.html
http://community.borland.com/article/0,1410,33375,00.html
Also see: Bob Swart on ECO III |
Verdict
In brief, this is a good product with many admirable
features. But I can’t help feeling that its technical
strengths are being undermined by a misguided marketing
strategy. Borland seems determined to portray this as
a direct competitor to Visual Studio - emphasised by
the name itself: Borland Developer Studio. Moreover,
the ‘alternative’ branding of the software
with the names of the three supported languages - Delphi,
C# and C++ - seems to me, to be entirely counterproductive.
This gives the impression that the three languages are ‘equals’.
They aren’t. C#Builder is a good product but most
people who want to program in C# will look no further
than Visual Studio. C++Builder is a perfectly decent
Win32 tool which, however, having no .NET programming
capabilities, has a distinctly ‘bolted on’ feel
in this suite. Then there’s Delphi - a stunning
cross-platform product for which Microsoft has no counterpart.
So why isn’t Borland publicising this fact with
all its marketing might…?
In my opinion, Borland should put more effort into
informing the programming world of the special capabilities
of its star product, Delphi, rather than presenting Delphi
as ‘just another’ programming language on
a par with the far less impressive C#Builder and C++Builder
products.
January 2006 |