MICROSOFT VISUAL BASIC PROGRAMMING
Why Visual Basic.Net?
Here is a series of questions
that provide a background to Visual Basic.Net. The answers highlight the problems
and opportunities facing the Visual Basic programmer in using the brand new Visual
Basic.Net.
Note that the number of developers using VB.Net today is roughly the same
as for the C# language.
How different is VB.Net?
VB.Net is a complete rewrite of Visual Basic 6. The syntax is still almost
"Visual Basic" as we know it, but everything else has changed. It now has all the
functionality of "C", "C++" or "C#".
VB.Net is not VB6 with some enhancements. It is a completely different Object
Oriented language incorporating Encapsulation, Inheritance and Polymorphism. Compatibility
with VB6 has been well and truly broken.
Although VB.Net has become more esoteric, it is still the best language for
business-oriented, data-focused solutions.
Is VB.Net easy to learn?
Visual Studio.Net incorporates Web projects and Web Services, new areas that
need specialisation. ADO.NET is not simply a new Version of ADO, but a complete
rewrite. VB.Net Deployment now uses Microsoft Windows Installer – more
powerful, but completely different to VB6 Deployment. The new printing facility
of VB.Net provides enormous power with its functionality, but the simplicity
of VB6 has been lost.
The latest release, Visual Studio 2010 has many features. Together with Object Orientation,
a huge learning curve is involved. It is extremely difficult for the Visual Basic
Programming neophyte (and old hands too) to learn everything – especially
as VB.Net is so vast and is evolving so rapidly.
The Microsoft Help system is shockingly bad. There are now some VB.Net examples,
instead of only C# examples. There is still too much that is at a low-level and
esoteric. Defining how a procedure gets Overloaded in 40 different ways is not my
idea of documentation.
Thankfully, there is a very active VB.Net community. The Internet is beginning to
become a source of information on Visual Basic.Net. The trouble is trying to work
out what is current and what has been superseded. Most books on Visual Basic.Net
are half-baked, and rushed out to print too quickly.
Is VB.Net stable enough to use?
The previous Version (Visual Basic 2008) was a huge improvement over the initial
releases. The code is stable and acceptable. Visual Basic 2010 is another matter.
- The development environment is slow. Clicking on an error takes forever for the
code line to be selected.
- The user interface using the new WPF technology is rather primitive.
- After a while the IDE tabs do not work properly.
- Getting Charting to work is difficult and unpleasant
- The supplied documentation is poor. At this time there is little documentation on
the Internet and there are no books yet available on ASP 4.0.
- Functions are checked for Boolean True/False on all code paths. This is irrelevant,
but consistent.
- Project Properties are hard to find. There are supposed to performance problems.
- There are no improvements to the supported Web standards – still the same old XHTML
1.1.
- I tried the View State compression – but could not determine any size reduction.
I can see little advantage in using Visual Studio 2010. The code improvements, as
well as the new functionality, are irrelevant to most Visual Basic Programmers.
The new functionality is centred on team programming. With the large number of problems,
this release should not be used in a production environment. It would be best to
wait for the first service pack and then only when performance issues are resolved.
How helpful is the VB.Net Upgrade Wizard?
- It does not ensure a 100% upgrade.
- Its output will "sort of" run. But you need to resolve a multitude of Upgrade problems.
- It uses a code standard that is difficult to maintain. Control arrays are now handled,
but the code is difficult to support.
- Some of the "fixes" of the Wizard are esoteric and non-maintainable. The "< ...
>" construct may work, but is difficult to maintain.
- The Upgrade uses the old VB6 controls, with massive amounts of warnings on potential
problems, differing Events and Methods.
- The conversion of Resizing functions work, but is difficult to maintain. Using the
new Anchor/Docking involves a redesign of the Form.
- The Upgrade Wizard is a poor learning aid – it does not produce up-to-date
examples.
- Upgrades of the VB6 APIs are messy, and not recommended. There is always a VB.Net
alternative.
- The conversion will be problematic for any system of non-simplistic size. The Upgrade
Wizard produces code that involves a lot of cleanup work.
To get a "clean" version of the code, it is necessary to start a new project from
scratch, and use the minimum of the "converted" code.
What about Data Grids?
Microsoft's DataGrid has all the functionality of any third-party software. It is
just as easy to use, if not easier.
- The DataGrid is free!
- It has an unbound mode. This allows the programmer more control than the bound mode.
- It is easy to create a class encapsulating the control's Object Orientated logic
(which is rather complex) into simple properties and procedures.
- Microsoft's documentation on the DataGrid is dreadful (as usual), but the Web is
now a great source of information.
- The Style of each column can be readily set.
- Font and Colours can be changed – however the standard Grid layout is appealing.
Is it necessary to convert to ADO.Net?
No, it is not essential to convert to ADO.Net – all the old ADO routines are
still available. ADO converts reasonably easily in VB.Net. You should consider
the migration to ADO.Net when there is an efficiency problem. That is when:
- There are many opens and closes of a database.
- Disconnected database access is required for a Web site.
- There are heterogeneous sources of data.
- There is heavy database activity.
Otherwise, you can keep using the classic ADO routines that you know and love.
Programming Standards must be enforced
With the close compatibility with C Sharp, all the new features are getting more
and more esoteric. The language is becoming more difficult to understand. Visual
Basic is no longer the simple programming language that was previously so attractive
for business applications.
If tight control of programming standards is not rigorously controlled, the Visual
Basic programmers are likely to produce code that is not maintainable. This could
prove very costly to a company. The programming standards should include a ban on
Object Oriented Programming – besides the encapsulation techniques which are
an essential part of VB programming. The programming standard should also restrict
complex or seldom used features.
Maintainability and simplicity go hand in hand.
|