PART TWO
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. My choice was Delphi because in the comparison I gave more weight to certain factors, prioritizing them over the others, and then the result was Delphi. With different requirements it would be perfectly valid to choose Visual Basic. Your choice of language is up to you and will depend on the importance you give to each characteristic.
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.
Visual Basic does many things for the programmer. For example, objects are reference counted, and this means that for example if we create an object referenced by a local variable, the object will be automatically released when the function or procedure ends (unless we assign it to a non-local variable). Visual Basic has a sophisticated memory management system and uses a garbage collector so it's fast deallocating memory.
Database access in Visual Basic is very simple compared with Delphi. Just one component is used to open the Recordset, offer a navigator visual interface and link to the data controls, while in Delphi we have to use three components for that (dataset, datasource, navigator). This architecture may look bothersome for Visual Basic programmers, but it has its advantages, like the freedom to combine different dataset and navigator components at will and the possibility to place the dataset and/or the datasource components in a different unit (for example in a centralized data module).
The big advantage of Visual Basic Recordsets over Delphi Datasets is that the first ones handle updatable queries automatically: you can have a query on two tables and it can be "live", while in Delphi we have to use Cached Updates and an UpdateSQL component with the respective SQL queries to insert, update or delete a record. Additionally, when you act against a database server in Delphi you have to use a transaction component, while this is not necessary in Visual Basic. From the perspective of a Visual Basic programmer, the data access of Delphi may represent way too much of a bother when compared to Visual Basic's Recordset and Data control that notably simplify this matter.
In Delphi, the functionality of Visual Basic's Data Control is split into three components. In the image you can notice that the data is available at design time, and for example you can change the default label of the fields, as well as their display width, display format, edit mask, etc.
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.
The IDE deserves a special mention. Particularly, the Code Editor of Visual Basic has some interesting things. Maybe Borland invented Code Insight, but personally I think that Microsoft implemented it better. The possible values of a variable or parameter, or the possible properties or methods of an object appear automatically and instantly. Letter-case formatting is a nice feature too (for example if you declare a variable with the name "Doc", if later you write "DOc", "doc", "dOc", etc., the variable is formatted as it appears in the declaration statement –i.e. "Doc"–). One nice thing of the Visual Basic IDE is that when you are debugging you can modify a sentence and continue the execution with the changes in effect, without having to restart your application. Another nice feature of Visual Basic is the Immediate Window where you can execute interpreted sentences.
But ease of programming had to come at the expense of something. Visual Basic is easy to learn at the beginning and doesn't require a strong background of formal education in programming to learn it, but as you advance and demand more and more out of it, you start finding that VB has serious limitations that start reminding you that not for nothing the "B" of Basic stands for "Beginners" (BASIC = Beginner's All-purpose Symbolic Instruction Code). This doesn't necessarily mean that Visual Basic programmers will eventually switch to a more powerful language, actually most Visual Basic users will be happy with it for years as long as they never need to go beyond its limits, but truth is that Visual Basic has been the "entry language" for many current Delphi programmers. Here are some testimonials:
* Why Borland's Delphi?
One big fact about Delphi is that you can really do it all and you can "easily" reach everything your machine and operating system has to offer. In Visual Basic, to call an API function you have to search the declaration of the API function, constants and types in a database to copy and paste them in your programs. From the perspective of a Delphi programmer, this is way too much of a bother when compared with Delphi, where you can just call an API function as if it were a built-in function. Of course, an OOP language is very hard to learn if you don't have a strong programming background, but once you master it, it gives you the ability to write reusable, extensible and easily-maintainable code. With Delphi's data components you can have open a database table or query and view the data at design time, something nice at the moment of setting the width of the columns in a data grid. The Delphi IDE doesn't offer the features I described above for Visual Basic, but offers other things. For example Delphi's Code Editor offers to possibility to choose the Key Mapping schema and Code Templates to save you typing (something that curiously I would expect to find in Visual Basic instead of Delphi). When it comes to debugging you have some advanced features like CPU and FPU windows and the possibility to debug multi-threaded applications.