|
This
article by Mike
Griffiths was first
posted to Rod
Stephen’s VB Helper
web site and is
available in a slightly
extended and edited form
here. None of the
sentiments have changed
– just some added
emphasis.
Visual
Basic 7, what’s
that– I thought we had
VB.NET?
For
newcomers to VB and for
those with a short
memory - Visual Basic 7
was announced as the
next version of Visual
Basic long before the
rumours of C# and .NET
began to circulate. VB 6
had done a lot to
further the development
of VB5 and VB7 was
expected to complete the
process of fully
exposing the
functionality of classes
within the established
Visual Basic language
and IDE.
Visual
Basic was born out of a
creation called
“Ruby” written by
Alan Cooper. Ruby was
like a rectangular
work-slate upon which
graphical objects could
be dropped and combined
to act as a graphics
shell for an operating
system. Ruby was sold to
Microsoft in early 1988
and after a couple of
false starts became the
basis for the
development of Visual
Basic. It was the launch
of VB that persuaded me
(at the time the IT
manager of a £200M
public company) that
Microsoft’s Windows
was the right platform
to realise my ideal of a
PC on every desk. It may
be hard to remember but
there were rival GUI’s
and Apple were doing
well with the Mac.
Version 2 arrived before
we had completed our
first large development
project and that was
followed by the
masterful version 3
which became my tool of
choice when I decided to
stop being a salaried
employee and go
freelance. Personally I
skipped version 4 but
plunged headlong into
version 5 as it
delivered so many things
I needed as well as
breaking out of the 16
bit straight jacket.
Microsoft
clearly understood the
importance of VB within
the scheme of things. An
effective and rapid
development tool was an
essential requirement
for a dominant desktop
operating system.
Remember Apple had the
first reasonably stable
GUI but they neglected
the developer tools and
I think that probably
lost them the race –
even though their
reluctance to release
the stranglehold on the
hardware was probably
nearly as important.
With
versions 5 and 6 of VB I
was able to create
DLL’s and call them
from Active Server Pages
thus helping my clients
build applications with
an intelligent Internet
interface. We already
had database access and
we could build great
scaleable, multi-tier,
multi-user systems. We
started using XML and
liked the look of SOAP
as it could solve so
many of the version
problems we had with COM
objects. So why isn’t
this long term VB fan
promoting the features
and new ideas of VB.NET?
My
disenchantment was
pretty near immediate
– no control arrays!
One of the foundations
of good object oriented
code that had arrived in
VB3 was gone. I had long
suspected that the
developers at Microsoft
did not really
understand the power of
being able to create any
number of controls on
the fly at runtime with
all of their events and
properties being handled
by pre-existing and
tested code. Here was
confirmation. VB.NET was
supposed to be object
oriented yet it had lost
a key object oriented
facility – indeed I
suspect it could not be
offered within the
context of the range of
VS.NET languages forced
to use a common runtime.
However
I bit the bullet,
decided (perhaps
correctly) that a practical
alternative to control
arrays could hopefully
be evolved and continued
to explore. As I built
applications and saw the
automated creation of
classes to support the
forms and components I
added, I began to
realise that what I was
looking at was Java with
the syntax of a Basic
language. Given the
history of the .NET
project I should really
have been expecting it,
but it came as a
revelation. Now I am not
a big fan of the
inelegant C++ syntax of
Java (is this guy never
happy?) so I should be
pretty excited by Java
as VB. Well potentially
yes, if it could be
packaged and distributed
like Java and especially
if it would run across
the range of platforms
like Java. Unfortunately
VB.NET exhibits none of
the runtime features of
Java (except the
“sandbox” perhaps)
that make Java the tool
of choice for so many.
VB.NET
pushes the user very
firmly in the direction
of writing code that is
entirely class based -
inheriting forms,
controls and all new objects
from the classes in the
.NET framework library.
This is a different
library to the C++ class
library "Microsoft
Foundation Classes"
and is not intended as a
"wrapper" for
windows system calls but
as a fundamentally new
Microsoft proprietary
class library. It
happens to be remarkably
similar in many respects
to the Java2 class
library but perhaps that
is not too surprising.
This sort of class based code
development inherently
works at a lower and
more detailed level than
existing Visual Basic
programmers have been
used to. Individuals
will have to decide for
themselves if such a repositioning
is an advantage or a
step back in programming
language design. The
VS.NET IDE (Integrated
Development Environment)
can write a lot of the
detailed code for you
but at the end of the
day it is there and you
have to hang your code
contributions on the
code structure provided
- so you had better
understand it. The VB6
IDE had to create a
great deal of detailed
C++ code behind the
scenes but that was
where it stayed.
How
about “Garbage
Collection”? Sold in
VS.NET as relieving you,
the programmer, of the
task or managing the
memory usage of your
objects. Errm, just who
is let off the hook when
it comes to proper
memory management? Now I
have some sympathies for
the guys at Microsoft
– memory management is
difficult stuff – but
I also remember that
Windows NT was designed
by some of the team
responsible for
Digital’s VMS
operating system. VMS
machines stay up for
years! They do not leak
memory and do not need a
re-boot every couple of
days. So was the plot
lost somewhere between
NT version 3.1 (was I
the only one running
that?) and now?
You
probably do not realise
just how great the code
debugger built into the
VB IDE is but - just
wait until you lose it
in an IDE that can’t
let you step through
code, making adjustments
to variables and to
whole blocks of logic as
you proceed. OK it’s
still a whole lot better
than what a lot of other
developers have to work
with (try C under Linux)
but it is not an
improvement on what you
have.
Now
a killer! If you make
all or part of your
living writing code that
pushes the boundaries in
some way then you are
going to want to keep
just how you do it to
yourself. You invested
your time and intellect
in acquiring certain
skills and techniques
– this is what you
sell. You would be mad
to give that body of
knowledge away in a
program module that can
be de-compiled by anyone
to C#
thus revealing
your secrets to all. The
uncharitable would
suspect that the code
gurus at Microsoft just
don’t believe that
special skills exist
outside of the Redmond
campus – they fight
hard to protect their
own investments but care
little for yours.
Some
minor problems with VB
syntax might have been
dealt with in the
Basic/Java fusion that
is VB.NET
but were not. As
an example, I find it
slightly annoying that
bitwise and logical ANDs
and ORs use the same
syntax although we
(thankfully) have an
unambiguous string
concatenation operator
(&). I have learned
to treat an If statement
containing the phrase
“And Not (some
condition)” with the
deepest suspicion –
you just know that you
are looking at a bug
waiting to happen. Java
uses && for a
logical AND while a
single ampersand is used
for a bitwise AND –
but disappointingly
VB.NET stuck with the
original.
Visual
Basic .NET also seems to
be creating new
conundrums in error handling. The
new Try/Catch structure
looks like a direct
"inheritance"
from Java and, if so,
could prove very
effective. However the
existing error object
and it's "On Error
Goto" clause is to
be retained for an
indeterminate period.
With the retention of
the VB error Object and
the inclusion of the new
"inheritable"
error classes the
developer is faced with
a confusing choice -
which to use and where
and why are there two?
While bemused by this
you may also like to wonder
why the “Gosub” has
been removed as an
offence to good code
structure but the
“GoTo” has been
retained – surely
someone got that the
wrong way around?
What
is your major criticism
of Visual Basic?
Probably it is the need
to install the fairly
bloated runtimes and
components required by
even the simplest VB.exe
to run. But just take a
look at the problems you
are going to have
distributing a .NET
application to desktop
machines or networked
servers. Is a single CD
going to be big enough?
DVD distribution kits?
My client's desktop
operating systems
stretch from Windows 95
through all of the 9x
variants to NT4, 2000
and XP. There is also NT
Terminal Server edition
and the Citrix versions
of the same. Perhaps
your business or your
customers always upgrade
to the latest OS so you
could conceive of
implementing .NET
runtimes but most
businesses are going to
take some persuading.
Provided
the tools we use allow
us to produce well
behaved programs the
business users of our
code do not really care
what it is we use to
develop them. They like
us using Visual Basic
because we can develop
our applications quickly
and efficiently –
reducing development and
testing time and
therefore costs. Now
consider the cost and
disruption we would have
to bring about in order
to implement
applications using the
.NET languages. Our
clients would rightly
ask why? Then they would
ask if there was
anything else we could
use instead. Even the
most fervent .NET fan
would find these
difficult questions to
answer.
So
what is VB.NET for? It
is my assessment that
VB.NET makes it
marginally easier to
develop web based
applications where you
would otherwise apply
Active Server Pages (ASPs)
and DHTML – provided
you can find a server
that will run the code
of course. Visual studio
.NET is supposed to be
the toolkit for
developing web based
services and to thus
provide a wholly new
infrastructure for
delivering applications,
new services and
inter-business
processes. Call me an
old Luddite if you like
but I am not about to
advise one of my clients
to risk their business
to a web based service.
They would not listen
and would very properly
fire me. They have
invested in duplicate
computer rooms,
redundant frame relay
based networks and
mirrored servers all
designed to sustain them
during predictable
breakdowns and glitches.
Base a key operational
system upon the
availability of a remote
Internet server?
Ignoring DOS (Denial Of
Service) attacks and the
power of the courts to
allow injunctions
closing web sites upon
the flimsiest of
evidence – we have to
expect some suppliers to
go bust or be acquired.
Your supplier closes
it’s doors and
suddenly you can’t
process your
customer’s orders. The
.NET application model
is fundamentally flawed
as it applies to
business and any
critical or important
business process.
It
is possible to visualise
web services being
applied to non critical
leisure activities,
although in that area,
web based companies will
be in direct competition
with the mobile phone
operators who are
already developing
the market. That still
leaves the vast majority
of application areas
(both for business and
home use)
looking for an
up-to-date development
tool. A recent VSJ
article reported what
they see as an
approaching decline in
Visual Basic. Survey
results indicate that
52% of all developers
targeting Windows
platforms currently use
Visual Basic. Of them,
43% are already planning
to move to another
language. Hardly
surprising, as it has
been a long time since
service pack 5 and VB
applications are
starting to look a
little dated when run on
XP. The VSJ figures show
that even with some
existing VB developers
expecting to move to
VS.NET, Microsoft are
facing the potential
loss of over 1,000,000
developers to non
Microsoft development
tools with the
likelihood of more
following.
Why
the rush - does Visual
Basic need an upgrade?
Yes it does, Visual
Basic 6 is incomplete in
certain key object
oriented areas and there
is now a long list of
bugs to fix. Plus the
controls are starting to
look dated and there is
only incomplete support
from some of the latest
operating systems and
for newer devices*.
OK
The joke is over Mr.
Gates. The software
developers who made such
a substantial
contribution to making
Microsoft Windows the
dominant operating
system family on the
planet would now like an
upgrade to their
favourite development
tool. Now is the
time to dust off the VB7
development and get it
back on track so we can
keep building top class
desktop and networked
applications into the
future.
Oh,
and if you could just
let us have the option
of compiling and linking
to a slim-line, stand-alone
executable as well I,
for one, would be just
about content. It would
at least stop the Delphi
developers from
sniggering.
A
positive word for VB.NET?
Viewed dispassionately,
VB.NET stripped of the
bloat and overheads of
the .NET infrastructure
would not be a bad
language in itself. It
is nicely structured and
applies the “class
building” approach to
programming in a
straightforward manner. Without the massive .NET
overhead and with a
safely compiled
executable, VB.NET could
become a hit with
developers. Just like
Java. Oh and the
icon editor is great but
I think that installing
Visual Studio .NET just
for that is a bit over
the top.
|