Introduction

Which one is better? Delphi or Visual Basic? It’s a simple and direct question, but unfortunately it doesn’t have a simple and direct answer. The reason is that —although they are both Visual RAD tools— they have very significant differences and peculiarities that make it impossible to draw a straight and general conclusion. What we can do however is analyze and compare their different characteristics, hoping you find them useful as a guide for evaluation.

Learning Curve

Visual Basic is very easy to learn and use, not only because the programming language is not an OOP language and thus it’s easy to learn and code (in the end it comes from BASIC), but also because the IDE is simple and conformable to use, and the database objects that come with Visual Basic provide an interface that makes them easier to use.

Delphi is harder to learn, but not for people who are familiar with Turbo Pascal or FreePascal. Yes, Delphi is harder to use, but has its advantages. For example, objects usually aren’t reference counted and this means the programmer has to take care of disposing unused objects created by a procedure or function when that procedure or function ends. The advantage is that we have more freedom in manipulating the object and we can release it when we don’t need it anymore, no matter how many variables point to it. Delphi has its own memory management system optimized for small blocks of data, although it doesn’t have a garbage collector. Database access is cumbersome compared with Visual Basic, but very flexible and extensible.

“Visual Basic makes the easy things easier, Delphi makes the hard things easier” (Computerworld, 1998)

Purpose

Visual Basic is good for simple front-end applications and unsuitable for more complex stuff, while Delphi is ideal for both the front-end and the back-end. What does this mean? For example, with Visual Basic you can develop a compression tool (like Winzip) by designing a user interface and writing some code calling the compression routines of a given DLL or an ActiveX object (written in another language) that provides compression capabilities.

With Delphi you can do the same that you can do with Visual Basic, but you can also write the DLL or the ActiveX object that performs the compression/decompression task. It’s not that it’s impossible to write a DLL or an ActiveX object in Visual Basic: it’s technically feasible, but might be very inconvenient.

Delphi is more an “all-purpose” language than Visual Basic.

Market Share

The purpose and the ease of use has accommodated Visual Basic with a much bigger market share than Delphi in the global market. However, in certain market niches, Delphi rules over Visual Basic.

Visual Basic is the choice of executives, beginners and those who are forced to use it to get a job or simply follow the masses. Delphi is the choice of independent developers.

Performance and Code Size

Visual Basic has a good performance in data access, and perhaps reports, because the data access layer and report generation aren’t written in Visual Basic, but when it comes strictly to code generation, despite the fact that Visual Basic now produces native code instead of pseudo-code (P-Code), it is still very far from reaching a speed comparable to Delphi. This happens because Delphi has an optimizing compiler and yet there are compiling options to improve the speed of your code. To say more, if you are not happy with the performance of a routine in Delphi, you can fine-tune the code to squeeze the last nanosecond out it. In this respect, Delphi is ideal for tasks that require heavy programming.

The more system resources, the better —of course—, but execution speed and efficient use of resources make it possible for Delphi applications to run reasonably well in old Pentium machines with little memory like those you can still find being used in many small and medium companies

Speed and code size usually conflict, but when we compare Delphi and Visual Basic, Delphi clearly wins at both ends. A small database application using ADO and some third-party components fits in a single installation diskette in the case of Delphi, while its Visual Basic counterpart would fit in no less than two or three diskettes (in both cases I am not including ADO that has approximately 8 Mb). Why is the difference so big? Delphi optimizes code size all it can, it generates standalone executables (it can also generate executables that work with runtime libraries if you want) and it uses SmartLinking to avoid including in the executable procedures and functions that are not referenced in the code. Visual Basic has no other option than to work with runtime libraries and ActiveX objects (that are bigger and not as performant as their VCL counterparts).

Delphi produces standalone applications that are small and deliver great performance, making them more friendly with system resource and modem bandwidths, making of Delphi an ideal choice over Visual Basic for independent developers that produce tailor-made solutions for small or medium companies, as well as shareware or commercial applications to be distributed in the Internet.

Extensibility

Visual Basic and Delphi are extensible. Both IDEs support add-ons to add wizards and other extensions to the IDE, but what is more interesting for programmers —better said, more needed— is the possibility to use visual and non-visual objects apart from those that originally come with the development tool.

Obsolescence

Among Visual Basic programmers, how many of them are still programming in Visual Basic 4.0? And how many are programming in Visual Basic 5.0? Almost all Visual Basic programmers I know are programming in Visual Basic 6. With Delphi happens something completely different. A lot of people are still programming in Delphi 3 or 4, and perhaps the minority have Delphi 5, when Delphi 6 has just come to light. Why is that? Is it that the upgrade is too expensive? Nah… On second thought, yes it is! Please allow me to explain. What happens with Visual Basic is that —avid of more features— Visual Basic programmers upgrade rapidly as soon as there is a new version available. Delphi 3 C/S is so powerful that it is not yet obsolete, and this explains why many Delphi 3 programmers don’t see the need to pay for an upgrade when they already have what they need. Extensibility has also a lot to do with that.

Visual Basic programmers need to upgrade too soon. Delphi is so powerful, functional and extensible that its versions don’t become obsolete easily: in the long run, Delphi is cheaper.

Programming Power and Functionality

Among many other things, with Delphi you can:

  1. Write commercial-quality, fast and small applications, libraries, ActiveX objects and VCL components
  2. Create reports by code (or modify existing ones, for example to change or add a column)
  3. In general, everything that can be done visually (at design time) can also be done programmatically (at runtime)
  4. Easily write multi-threaded applications
  5. View data in tables and queries at design time
  6. Call API functions as if they were built-in functions
  7. Embed assembler code for best performance where necessary
  8. Take advantage of lots of VCL components available to give your applications a distinctive look and feel and offer an improved functionality.
  9. Easily subclass existing VCL components to add functionality
  10. Access new technologies not present when the IDE was released (for example ADO access with Delphi 4) without having to upgrade

Delphi offers programmers a power and functionality that leaves Visual Basic and its limitations behind.

Portability

If you are interested in Linux, there is a Delphi for Linux (Kylix), and I don’t see there will be a Visual Basic for Linux.

Kylix takes Delphi to the Linux platform, where VB won’t go.

Taken from Latium Software.