By: Nick Hodges
Abstract: Hallvard Vassbotn reviews CodeGear RAD Studio 2007
By Hallvard Vassbotn
Bio: Hallvard Vassbotn has been a professional programmer since 1985 and he is now the Head of Client Development at InFront AS. You can read Hallvard’s blog at hallvards.blogspot.com.
[Note: This is the translated version of the original Norwegian article that was published by hwb.no]
The last few years Microsoft has become a more dominant supplier of development tools for the Windows platform – particularly with the last versions of Visual Studio for .NET. Borland has always had very good (and often technical better) alternatives in products like Delphi and C++Builder.
In 2006 the development tools division of Borland was spun off into a separate (wholly-owned) company, CodeGear, leaving Borland to concentrate on tools for Application Lifecycle Management (ALM). This change has been a catalyst for more resources and improved focus on what developers on the Windows platform really need. The latest product available from CodeGear is RAD Studio 2007 – an Integrated Development Environment (IDE) that includes different personalities (or languages); Delphi for Win32, Delphi for .NET 2.0 and C++Builder for Win32.
Native development produces binary programs (i.e. .exe and .dll files) in a format that the processor can execute directly. This implies small, efficient and fast applications that have low memory usage and modest demands for the machine to execute it.
The alternative that has become increasingly common the last few years is called managed programming – where the generated code is in a language for a virtual machine. This intermediate code has to be translated (called JITed – for Just-In-Time compilation) to be run on an actual machine. This translation requires a bit of CPU- and memory-resources and assumes that a virtual machine runtime has been installed on the machine. Java and .NET are examples of these.
There are pros and cons with both development models. For instance, a native solution will typically be more efficient (faster and smaller), while a managed solution may be simpler to create for less experienced developers, because the runtime system takes care of automatically freeing allocated memory (a process known as garbage collection or GC). GC can be a two-edged sward because it can still cause memory ”leaks” if you forget to clear references that are no longer in active use. These kinds of leaks can actually be harder to figure out – for native solutions there are more advanced tools to identify and eliminate memory leak. For instance, the new memory manager in Delphi Win32, based on the open-source project FastMM (courtesy of Pierre le Riche), can report leaks (allocated memory that was not freed) during shutdown of the application.
CodeGear have just put their finishing touches on a product with a long and proud ancestry. RAD Studio 2007 builds further on Delphi 2007 for Win32, released in February 2007, and C++Builder 2007, released in May 2007. It now also includes an updated version of Delphi for .NET that finally targets .NET 2.0 (compatible with .NET 3.0) and that provides access to generic programming.
Screenshot 1 – Installing CodeGear RAD Studio 2007
Generic programming makes it easier to create and use classes for containers and algorithms that work with many types of contents or elements (different types of classes, structures, interfaces etc). It is a kind of meta-programming where the actual types used for fields, parameters and return values can be specified independently of the implementation of the class. It makes it easier to reuse algorithms, containers and code, while at the same time improving type safety and performance.
TStack<T> = class
type Node<U> = class
constructor Create(AValue: U);
procedure Push(Value: T);
function Pop: T;
constructor TStack<T>.Node<U>.Create(AValue: U);
Value := AValue;
procedure TStack<T>.Push(Value: T);
NewNode := Node<T>.Create(Value);
if not Assigned(Head) then
Head := NewNode
NewNode.Next := Head;
Head := NewNode;
function TStack<T>.Pop: T;
if Assigned(Head) then
Result := Head.Value;
Head := Head.Next;
// Note: no need to free nodes in .NET
Result := Default(T); // User error
Listing 1 – A generic implementation of a classical stack structure
Listing 1 shows how you can create new generic classes. Here we have implemented a classical stack structure (with first-in, first-out, FIFO, logic) implemented with a singly linked list. Each node in the list contains a value and a reference to the next node in the list. The type of the value stored in the node and thus the stack is controlled by the generic T parameter. When using the Stack<T> class, the T parameter is replaced with an actual argument that must be a know Object Pascal type – for instance integer, string or a user-defined type (such as TPerson).
Here is one example of how the Stack<T> class can be used.
Stack := TStack<integer>.Create;
Here we create a Stack of integer values. The same class can be used as a Stack of string values, just by replacing the T parameter with string – se listing 3.
Stack := TStack<string>.Create;
Stack.Push('RAD Studio 2007');
RAD Studio bundles a number of frameworks that covers most types of web development.
ASP.NET 2.0 with AJAX support is Microsoft’s last response to the Web 2.0 wave. This is a framework that includes a lot of standard functionality and building blocks that most web sites will need (login, stat management, caching, etc). You can now use Delphi for .NET 2.0 to develop advanced, dynamic web pages and sites in a relatively simple way. There are a number of templates that makes it easy to get started – and you can quickly change the look and feel of the web pages by changing a central .CSS file.
Screenshot 2 – Development of ASP.NET 2.0 applications
There is also another framework for web development called IntraWeb. With IntraWeb you develop using a model that is very close to the way you develop standard Win32 GUI applications. This reduces the barrier to start with web development. It is particularly well suited for developing small applications for the web. IntraWeb can be developed both in Win32 and .NET and includes support for AJAX techniques (to create responsive and interactive pages).
WebBroker and WebSnap
In addition Delphi still supports two older, but still useful frameworks called WebBroker and WebSnap. WebBroker is a relatively thin abstraction of different web server APIs such as ISAPI, CGI and Apache modules. In our own company we have used it successfully with certain customizations and optimizations (available as a free download as WebBroker on Steroids). WebSnap is a model to generate database-driven web sites with support for simple scripting in HTML templates – a kind of early variant of ASP.NET for Win32. This framework is not actively enhanced, but old projects still work fine.
On a slightly lower level there is a component package called Indy – giving complete access to internet protocols such as HTTP, FTP, SMTP, Ping, Sockets and so on. These components can for instance be used in custom developed servers or clients that communicate over the internet. Our company has used Indy to develop a server that streams real-time quotes to mobile phone clients written in Java.
From its inception, Delphi has always had excellent support for a wide selection of databases. This trend continues and is expanded in this version.
As briefly mentioned above, RAD Studio bundles a new product called Blackfish SQL. This is a managed .NET database server that is extremely easy to install and manage. It supports standard SQL, transactions, and writing custom code (such as Triggers, User Defined Functions and Stored Procedures) directly in any .NET language (Delphi, C# or VB.NET). Most other databases forces you to learn and write a different language to perform such advanced operations.
After a default installation of RAD Studio, Blackfish SQL runs automatically in the background as a service. This makes it easy to get started defining databases, tables and so on. If you are not going to use Blackfish, you can disable the service in the Control Panel.
Blackfish is a new product name, but it is actually the last version of a product that has been maturing over a number of years, first known as JDataStore, then NDataStore. There are two editions; Blackfish SQL for Windows and Blackfish SQL for Java. Both are binary compatible with regards to storage format (database files may be copied between the editions) and on the protocol level. In a stroke of genius, CodeGear developed a Java-to-C# compiler that they use to maintain the two editions from a single set of source files (in Java).
Blackfish fully supports Unicode and can be run on one of three modes – either as a Windows Service, as a Standalone Server or in-process of your own application. The last option is useful to replace simple local database formats such as dBase and Paradox, and yields even better performance.
The Blackfish license bundled with CodeGear RAD Studio allows royalty-free distribution with developed applications, but there are certain limits to the number of concurrent users (1 for Pro, 5 for Architect), utilized CPUs (1) and the size of the database file (512 MB for Pro, 2 GB for Architect). This means that is perfect for development and for local applications, but if you intent to run it as a central database server with numerous users, you need a separate license to do this.
dbExpress is CodeGear’s architecture for access to databases. It is an API and set of components that are available for both native and managed programming – this makes it easy to move and reuse code between the Win32 and .NET platforms. Version 4 has been upgraded to use ADO.NET 2.0. In addition dbExpress 4 support direct connections to a rich set of database servers, including Microsoft SQL Server, Oracle, IBM DB2, Informix, Sybase and SQL Anywhere.
I must admit that I personally don’t connect directly to databases in my day-to-day work (we have our own proprietary servers with their own set of APIs and protocols), so I don’t have extensive experience with these technologies. Traditionally both Microsoft and Borland/CodeGear has presented ever new and improved technologies for database access, but CodeGear has been very good at keeping backwards compatibility in mind with the API and the database components that the programmer uses directly.
Delphi 2007 for Win32 was probably the first RAD tool to give straightforward access to the new user interface features of Windows Vista. This included support for glass effects in forms (and not just in the standard frames), support for the new standard dialogs (for opening and saving documents, etc), and simple access to the new model for creating message dialog boxes with a user-friendly interface.
All this new functionality is now also available in VCL for .NET – the managed version of the same VCL (Visual Component Library) that gives Delphi the major advantages in Win32. By peeking at the supplied source code, it actually looks like CodeGear is using common VCL source code for the two platforms internally – just with some strategically placed $IF directives to handle the platform differences. Neat!
Screenshot 3 - Debugging a VCL.NET application
In many ways ECO is the gem of the collection – a well hidden secret for the uninitiated. ECO is an acronym for Enterprise Core Objects and is a mature and rich framework for building model-driven applications. When you develop a ECO-based application, you work in a higher level than you’re used to. You typically define classes, fields and relations using an UML (Unified Modeling Language) designer and ECO generates the corresponding Delphi code.
Screenshot 4 – Designing an ECO application using UML
You program directly with objects in memory – persistence and mapping to a database is done implicitly and automatically. It is also simple to connect ECO data models to visual or ASP.NET components so you are relieved from writing boring ”glue” code between the user interface, the data model and the database. For advanced queries into the ECO data model you use OCL (Object Constraint Language) – an object-oriented equivalent of SQL.
ECO is now in its fourth generation and is only available for the .NET platform. It is a continuation of the product known as Bold for Win32. ECO is now continuously being developed by the company Capable Objects and there will be new updates and releases that are not necessarily synchronized with new Delphi releases. There is no doubt that this is a powerful and impressive tool that lets the developer concentrate on solving the business problem at hand, completely removing the need to write general plumbing functionality (such as persistence, caching, mapping between database and objects, mapping between objects and GUI components, etc) from the ground up.
The quality of integrated help system and information has been very good in Delphi – up to and including Delphi 7. In the versions from Delphi 8 and including Delphi 2006, the underlying help system has been replaced with Microsoft Document Explorer. Since then there has been major problems with the speed, functionality and contents, and CodeGear has (deservedly) received a lot of complaints about this. Personally I have mostly used the Delphi 7 help when I’ve had the need to look up something.
Screenshot 4 – Improved help system and contents
Slowly but steadily, the help has improved. In RAD Studio 2007 it is finally approaching the level of that in Delphi 7. Many of the code samples are back. F1 now work on most keywords and identifiers and the speed is acceptable. One of the reasons for this is that they have decided to split the Microsoft .NET and Windows documentation from the CodeGear specific Delphi, VCL and C++Builder documentation. Smart choice!
Borland/CodeGear used to have a product called C#Builder offering full support for C# development in .NET 1.1. This product was melted into Delphi/BDS 2005 and 2006. Since then it has been decided to focus on their own unique solutions in Delphi and C++Builder. In RAD Studio 2007 the full support for developing C# applications with design of WinForms windows has been removed. WinForms was Microsoft’s first GUI framework for .NET, but it has now more or less been deprecated, so it’s no surprise that CodeGear has chosen to drop WinForms support completely – including Delphi.NET.
Notice that you can still write, debug and compile C# code – and thus easily use existing projects and modules (assemblies) in C#. The same kind of support is actually included for VB.NET (Visual Basic) as well. I think that this refocusing strategy is the right decision – now CodeGear can concentrate on their strong points and invest more of their resources into improving Delphi and C++Builder.
CodeGear RAD Studio 2007 is now the only tool to give access to rapid application development (RAD) in both native Win32 (Delphi and C++) and .NET 2.0 (Delphi). It is also the only tool to give effortless access to the new GUI features in Windows Vista (glass, dialog boxes, standard dialogs, etc). Many people predicted that .NET would quickly replace all native application development – now even Microsoft is admitting that for many applications and situations a native solution will be best (a small indication of this is that 99% of all the executables and modules that ships with Vista is native code).
In this context CodeGear’s tools is in a unique position, and with planned future versions that indicate generic programming for native Win32 Delphi and a Delphi version for native Win64 programming in addition to continued focus on and support for new .NET technologies, the future does indeed look bright.
Screenshot 5 – Design and development of a VCLNET application
Delphi developers have been spoiled for a long time now by an excellent track record for backwards compatibility and the ability to keep your investments in existing code. It looks like we will continue to be spoiled in the future. In the eighties they said that you couldn’t go wrong by choosing IBM – in many ways Microsoft has found itself in the same position for Windows development tools today. But the reality is that smart developers looking at the larger picture chose tools that give them a long-term strategic advantage – I think that RAD Studio from CodeGear is one such solution for the smart and the initiated.
The RAD Studio IDE itself gives you ad advanced, user-friendly and extensible environment that you’ll quickly feel home in. In addition, the Delphi and C++Builder community that Borland/CodeGear and their users have been able to build over a number of years both internationally and locally is very impressive.
For instance, you may post a question or a problem on one of the relevant borland.public newsgroups and quickly get a response from one of the hundreds of community members that visit the groups daily. Only here in Oslo there are now more than 120 members of the Oslo Delphi Club started less than 12 months ago. There are loads of free code and components available in addition to commercial component and code libraries of impressing scope and quality.
Personally I have a long and very good experience of using Delphi professionally. I have worked for companies that have used Delphi as a key success factor to develop solutions for tax-calculations and –forms (at Akelius AS), financial information (in Falcon and Reuters), customer relations management, CRM (at Million Handshakes AS) and last but not least financial information and online trading (with the product The Online Trader at Infront AS). Our main focus has always been on native Win32 client applications and using Delphi has given us clear advantages compared to many of our competitors.
It is hard to predict the future with any degree of certainty, but CodeGear has a roadmap indicating what they are planning to release in the near future.
The plan spans 2008 to 2009 and includes a number of code names for new future versions:
The plans also include items to simplify the means to exploit the power of multi-core machines with multi-threaded programming, development for hand-held units (PDAs, mobiles, etc), rich internet applications (RIA), and more.
To me, the future for Delphi, C++Builder and CodeGear looks brighter than it has been for a long time.
This is the best and most complete version of Delphi ever. CodeGear’s RAD Studio 2007 supports development of everything from fast, small and user-friendly Win32 applications with a graphical user interface (GUI), all the way to modern and advanced web sites with ASP.NET and AJAX.
For existing Delphi developers that wants to take advantage of the .NET platform, this version is a must-have. If you’re still on an older Delphi version, you should definitely upgrade to get access to all the goodies and productivity enhancements that are included. Delphi 2007 users that only care about Win32 development may consider waiting for the next version with native generics – but if you have been smart enough to buy the software assurance subscription, you’ll receive RAD Studio 20007 for “free”. It could make sense to play with .NET generics in the mean time.
In his time professor Niklaus Wirth design Pascal as a tool for education. Delphi includes an advanced version of Pascal that extends it with object-oriented programming, a mature component model and now generic programming (in .NET for now). CodeGear offers everything from the free Turbo Delphi Explorer version to the complete package RAD Studio 2007 Architect Edition. Students, schools and various institutions of education should see the possibilities. There is major demand for skilled Delphi developers – it’s fun to work with and the pay is good! ;).
Delphi gives you access to a wealth of technologies – everything from low-level machine language programming with BASM (Built-in Assembler), via classical structured programming, to object-oriented programming, to generic programming and frameworks such as VCL with full Vista support, ECO, ASP.NET 2.0, database access and so on.
Highly recommended! CodeGear RAD Studio could give you and your company that extra advantage in the marketplace to outpace your competitors!
Oslo Delphi Club:
Download Delphi 10 now!
Webinars on demand!
More social media choices:
Delphi on Google+
@RADTools on Twitter
Server Response from: ETNASC03