maandag 11 februari 2008

Why do I want to get rid of Visual Basic for Applications?

Visual Basic for Application is the macro (hum...) language of many Microsoft Office programs. It's not truly a macro language, but it's a real program language, but somewhat old-fashioned.

In my humble opinion VBA has some serious drawbacks:

1. It's based on ActiveX/Com which means it can clobber up the registry
2. Using On Error GoTo for dealing with exceptions can be a pain in the neck and it's ugly
3. It's a huge package
4. Especially with old Office systems like Office 2000 the help system might get damaged
5. Programming properties using VBA is not very elegant
6. It's based on Variant datatyping, which can cause headaches during debugging
7. Sometimes the code-completion doesn't work well despite using type-libraries of the Office objects.
8. The code is stored into the template or the document and if this stream is damaged, strange error do happen like unexpected failures.
9. VBA is known to be sensitive for serious security problems due to 'macro-viruses'.

In my opinion .NET (managed code) has the following advantages:

1. VB.NET is a true object oriented language
2. Exception handling is clear and easy to read and modify
3. It's managed code and usage of the registry is limited (sometimes it isn't needed at all!)
4. It's type-safe
5. The .NET system is far more secure than ActiveX/Com
6. Unhandled exceptions now lead to meaningful exception messages instead of blunt COM error codes. Yes error messages containing only a number are very insulting (crude) to users!
7. The help system never failed me yet!
8. Programming properties is pleasant to do due to a very pleasant syntax of any language you want.
9. The custom code gets compiled in a DLL instead of a stream into the document. This also means a better loading time of the document or template.

Geen opmerkingen: