Flash! Legitimate use for VB.NET found!

Yup. I believe I have found a legitimate, really useful (a la "Thomas the Tank Engine") use for Visual Basic .NET!

There are lots of scripts out there written primarily in VBScript that enable developers to do all kinds of cool things. If you aren't familiar with what I'm talking about, visit the TechNet Script Center and have yourself a look.

Now the cool thing is, you can paste a lot of this stuff into a VB.NET Class Library project, and all you need to do is massage the "Set", "wscript" and other VBS script-generic statements to regular old VB.NET Objects and fix up the code until "It Just Works"!

The key feature of this completely innovative and mind-blowing technique that most VB.NET afficionados will really like is that in order to make it really, really easy for yourself - you can Turn Off Option Strict and Option Explicit! ("What?", you say, "I already have them turned off...")

My Gosh! I've already (ahem) "written" a class library for my boss that enables and disables Network Adapters, and now I am "writing" one that allows you to add or delete an IP address to an adapter!


Will the wonders never cease? Long Live Visual Basic! (And apple pie, pumpkins, and the Rolling Stones...)

Comments

  1. Anonymous7:26 AM

    P.S to the above - I've just discovered that VB.NET rather nicely tells you at design time whether or not an object supports an interface. Thus saving the lazy programmer the trouble of defensively querying for an interface. It does it with Ctype function too! None of this rubbish for me:

    IMyInterface obj;
    IMyOtherInterface obj2;
    obj = new MyClass();
    if (obj==null)
    {
    obj.SomeMethod();
    }

    obj2 = obj as IMyOtherInterface();
    if (obj2==null)
    {
    obj2.SomeOtherMethod();
    }

    Instead I can just do this safe in the knowledge that it will compile:

    dim obj As IMyInterface
    dim obj2 As IMyOtherInterface

    obj = new MyClass
    obj.SomeMethod
    obj2 = CType(obj,IMyOtherInterface)
    obj2.SomeOtherMethod

    B****cks to coding those middle tier components in C# methinks!

    ReplyDelete
  2. Regarding objects supporting interfaces at design-time, that's certainly a nice feature of VB.NET.

    However the "is" and "as" keywords in C# handily solve this issue.

    I really wonder how many programmers REALLY don't know whether an object they are about to code against "IS A" somethingorother?

    If you are making language choice decisions based on small stuff like this, I suspect that it may reflect "personal baggage" preferences more than facts, figures and arithmetic.

    ReplyDelete
  3. Anonymous3:58 PM

    Fair comment - I admit I use to be a VB6/VBA developer so I naturally gravitated towards VB.NET (although I was a Turbo Pascal programmer before that).

    However I learnt C# because:

    1.It doesn't take long
    2.Juval Lowy advises enterprise system developers to use it
    3.It adds 37% to my market value

    But I keep using VB.NET because I'm more productive with it - just the maths.

    ReplyDelete
  4. And Juval would not play you wrong, dood.

    ReplyDelete

Post a Comment

Popular posts from this blog

Some observations on Script Callbacks, "AJAX", "ATLAS" "AHAB" and where it's all going.

IE7 - Vista: "Internet Explorer has stopped Working"

FIREFOX / IE Word-Wrap, Word-Break, TABLES FIX

System.Web.Caching.Cache, HttpRuntime.Cache, and IIS Recycles

FIX: Requested Registry Access is not allowed (Visual Studio 2008)