December 2004 - Posts
I was reading Bill Ryan’s blog rant about Option Strict Off, and although I whole heartedly agree with him when it comes to writing .NET code, (that is turn Option Strict On and leave it On !!), I think some folk have missed the point as to why VB.NET has Option Strict Off.
Now if you had said it was because of VB6 code, well you would be partially correct. The real answer is to make it possible to work with COM as we know it, and most importantly to make it simple and elegant to work with COM objects. Like it or not, history has bequeathed us with a plethora of IUnknown, of COM interfaces that by definition are late bound. Even in Visual Studio .NET, the macro recorder relies on this very thing to bridge the world of COM to the world of .NET. (hint, record a heap of macros then turn Option Strict On and see what happens )
That’s not to say that you can’t work with the COM objects without Option Strict Off --- In fact you can, BUT it requires more code. And I must admit I think I have just about always ended up turning Option Strict On, even in my VS.NET macros…. but sometimes I think that’s just the pedantic in me
The real problems lay not in the ability to use Option Strict Off/On, but in its lack of visibility (sometimes) and it’s lack of granularity.
To address the visibility, make the declaration explicit in each and every one of your code files. Oh and send emails to the VB team asking them to make it visible if set at project level either in a toolbar button or even status bar etc.
To address the granularity, well at present try to factor your code out to a separate code file that has Option Strict Off in it. Usually though it’s not worth the pain. IN VB.NET 2005 you can get a similar effect a bit nicer by using partial classes, thus splitting your class file into separate code files, hence allowing you to compile some of the class’s code with Option Strict On, and some with it Off.
Oh, and long term, well keep sending the VB team those emails. I would suggest making suggestions such as :
#Begin Option Strict Off
#End Option Strict Off
Or some block construct like that so as we can use Option Strict Off like it was intended to be used without forcing a whole heap of our code to also be Option Strict Off.
I read some great lists of software people have on their USB keys, but so far no-one has included one very very important thing … the ability to boot of the key !
On my USB key I have dos 6.2 and windows 3.1 and I can boot of the key and run windows 3.1 GUI Amazingly, that weighs in at about 8 MB for windows, and about 3 MB for DOS and a ntfs file reader, and of course Ghost. On the pen I also have Dell’s diagnostics software.
So with my meager, (old) , 64 MB pen, I can boot to windows (albeit 3.1) , perform all hardware diagnostics for my laptop, etc, and still have 45 MB free space on it
What’s on your USB key ?
You may have heard the big news that generics is now to be included in the Common Language Subset (CLS). That’s really cool for users of VB.NET 2005 (and C# 2.0), but what if you want to know if an assembly is compliant with the earlier specification of CLSCompliant ?
Considering the actual specification is being modified then version numbers should be applied to the attribute as well. So rather than just True/False, a string or integer or single (float) should be used. I think a float might be the most flexible, allowing easy querying of the actual CLS version. And of course, if you specify a float, the Boolean property would get set to True, so code using the old (current) CLSComplaintAttribute would continue to work.
This is a ping back to Mitch’s ping back regarding my earlier entries on Aliasing in VB.
Mitch suggests that instead of using Imports, that VB.Net could take the same approach as C# has. Well let’s look at what C# does in a bit more detail…
For C#, using aliasing-versioning is a two (or three) step process.
First thing is you have to assign an alias to the assembly being referenced. This is not an issue if compiling by command line, but to use this from inside VS.NET, it will require the IDE to have modifications to allow you to set the alias for the assembly. This can be overcome, but it’s an extra requirement.
The next thing you have to do is indicate you are using that alias in your code by using the extern keyword, such as extern alias foo, where foo was defined in step one above. Okay so at this point we have the first level of duplication. We already defined the alias to the compiler with the /reference switch, but here we are stating that we will use it ? This step seems completely redundant and must be the fruit of command line compiler only mentality This duplication, is also two fold. Now there are two different aliasing constructs in the language, using, and extern alias.
And of course the final step is to actually use the types in your code. Here, C# makes the alias as a pseudo global, that is, rather than foo.sometype, you have to use foo::sometype. At this level we begin to run into some real design limitations. If you change the versionsing, which is actually a likely scenario as this type of versioning is usually a “Stop gap” or temporary measure, then you will need to change all the code as well.
Now, having looked at what C# does, and compare that to the syntax I suggested. First it means that no new keywords (such as extern and alias) need to be introduced. Next it means the IDE does not have to change the reference dialogs, and you can still simply compile from within VS.NET. It also removes that redundant step C# currently employs. Finally, it adds more flexibility in that you can update the code simply by changing the Imports statement. And the language has one aliasing construct. The Imports statement syntax would be simpler, more flexible, and in keeping with the language.
So should VB.NET blindly follow C#’s way of doing things ? I don’t think so.
A company I am an investor in (there, early disclosure out of the way ) focuses on cognitive ability monitoring and testing. They, CogState, have products for sports concussion management and products for measuring cognitive effects of therapeutically drugs etc. But one aspect of their business I was not so aware of till a recent newsletter, is their CogHealth product. CogHealth is designed to give you a documented history of cognitive state, to help in detection of early dementia, Alzheimer’s or even to pick up on possible injuries or impacts of any medication you might take one day. The idea is you evaluate and record your current cognitive state, then compare it later as different events occur through out your life.
Personally, I haven’t taken the test yet (have to find the free 15 minutes… hmm perhaps if I didn’t blog I could ). But as I hit and enjoy my mid-life crisis, I do do smart things such as try to visit the doctor just for a checkup at least once every two years. And when I do visit him, we look at my history, blood pressure, weight cholesterol etc.. But not my cognitive state. Yet I really make my living from my cognitive state more so than my physical state. Oh and if you have ever had a cholesterol test (I hate needles) you’ll know it’s a real pain to fast for the 12 hours or whatever it is
Anyway, should my doctor and me be looking at my cognitive state ? Should you ? Should we as developers take steps to safe guard our biggest asset ? What do you think ? I would love to hear from anyone who does
Yesterday I blogged about Aliasing in Vb.NET and how I would like that to be extended to add more power, flexibility and to address future needs of versioning. They syntax I proposed was :
Imports [alias = ]NamespaceOrType[@Assembly[,version]]
In the above, “alias” can have dot syntax in it, and Assembly probably should allow paths. The ’s denote an option that can be included or optionally not
Another Aussie, Mitch, read my post, and said that we can’t do versioning and it would be too hard to add to the CLS. Well first in my defense, obviously my “wish” was looking forward and talking about features that a language will need. As .NET reaches maturity, versioning issues will become more and more an issue.
Secondly though, and most importantly, in .NET 2.0 you can indeed use versioning inside the same appdomain. In fact, we will see this very thing in C# 2.0 with new overloaded meaning to the extern keyword. So yes, it can be done, in fact it will be done in VS.NET 2005 for C#, but at present no news for this for VB.NET …
Hmmm… perhaps that post of Mitch’s was a devilish plot to get me to say “but you can do this in C#” …. D’oh
In Vb.NET we can use the Imports statement to create aliases, such as :
Imports VB = Microsoft.VisualBasic
Then in code we can simply type VB. And intellisense lists the members of the Microsoft.VisualBasic namespace. Pretty cool huh ?
But what would be way cooler is if we could use the . syntax in the alias, and that member/type resolution promoted the Imports Alias over any other namespaces.
For example, let’s consider the case where you have code such as :
Dim x as New Foo.Bar
Let’s assume the Type Foo.Bar is in an assembly that your project has to reference. Now if for one reason or another you need to version that, it would be nice to be able to alias a similar class. In this case, say I create a class that inherits from Foo.Bar, and name it Zzz.Bar2 . Sure I could refactor all the code, but wouldn’t it be nicer to write :
Imports Foo.Bar = Zzz.Bar2
Now all code that pointed to Foo.Bar will be pointing at Zzz.Bar
Finally, the last addition I would like to see, would be the ability to specify the assembly as well, eg:
Imports Foo.Bar = Zzz.Bar2@myassembly.dll,126.96.36.199
where you could also specify the assembly version as well.
Personally I think this would give the developer ultimate control when it comes down to versioning issues.
Oh, and as a side note, regardless of what some people may say, DO NOT extend the My namespace until such time as VB gets versioning syntax like this. You wouldn’t use the root System namespace, or the Microsoft namespace, so don’t use the My namespace unless Microsoft either gives you an iron clad written guarantee they won’t introduce types with the same name in the My namespace (1) or they provide you with language constructs that allow you to easily fix the problems caused when they do.
(1) if your namespace is uniquely identified within My using your company name or similar, then it really doesn’t belong inside the My namespace in the first place. That would be like putting Acme.Widgets inside the Microsoft namespace. Wrong, wrong wrong, DON’T DO IT !!!
I blogged earlier about product support lifecycles. Okay, I use to have the URL’s but I didn’t so I used google. Often it’s quicker than trying to look through any list of URLs I might keep anyway
So I searched for
+"Visual Basic 6" +support +lifecycle +site:.microsoft.com
When I saw the last link on the google results page, I thought, oh cool, perhaps Eric Rudder announced something at the PDC I must have missed. Unfortunately searching that document for Visual Basic 6, just brought up more broken promises
Yes, this was the excerpt from the PDC where Eric and Ari demo’d using the My classes for simple printing. Sadly, Microsoft has decided to cut that very feature from Whidbey.
So folks, just in case you haven’t heard it before, NO you won’t have simple printing in VB.NET 2005 (as was promoted).
Maybe in 2007 ???
An email I got today was asking about Microsoft support for Visual Basic 5 and also about Visual Basic 6 and asp. I knew that they were both just about out of time (as far as MS is concerned) but thought I’d better check….
lists VB6 main stream support as finishing on March 31st. After that date there will be no service packs, and you will have to pay for any hot fixes or calls to Microsoft.
VB5 has already shifted into the so called “extended support” phase.
For developer tools life cycles, see here.
Oh, I should point out that main stream support for VBA 6.0 goes for about 3 more years, till 2008. So it's probably not a technological thing, it's just that VBA is critical to sales when you compare Office to free products such as Open Office. But if they are supporting ActiveX, the VB runtime, and all that good ol' COM goodness for their own products, well it would be nice if they would do the same for those who used their tools to create great windows applciations for small to medium businesses ..... ah dogfood
in more way than one. Not only has bloging got a hold of him (and MSN spaces ), but looks like Halo assimilated him to the other side as well
Add him to your blog lists … Dr Pete is another cool Aussie on whom’s every word you should hang
Friday 6:30 PM (last night) I decided to take it to go see the sunset. 12 apostles seems like a nice place. So we set off and took the scenic route .. that’s the windy road through the hills of course .
Arrive at the 12 apostles after a quick visit to the blow hole, in plenty of time for sunset
The sunset itself was not spectacular but the vista none the less surely was. The weather was warm, (~ 20 C), but the sky was cloudy with an approaching summer storm. The rain too was warm, the kind that just makes you want to bare your face to it and taste it.. and yes it was salty. The distant sky lit up with both bolt and sheet lightning. Spectacular .
It’s moments like those I am glad I don’t have a camera. It would be too tempting to try to capture just the image, which would never truly relay the sensation. And too it might be too tempting to look at the picture instead of actually being there. Going there .. well there simply is no substitute.. and just about every time you do, it’s always different, still spectacular
Oh, and the fairies… well as I looked down from the cliffs towards the beech, there was a bunch (herd/flock ?) of fairy penguins playing in the wash. As I observe more and more it occurs to me that they aren’t actually playing though, it’s more like it’s a huge effort for them to get onto the beech. It’s not like they are fast on their feet, so they are really at the mercy of the waves to wash them in, and not drag them straight out again. No wonder they just stand there once they do manage to get onto firm sand.
And of course the geek in me really had to wonder why anyone in their right mind would choose them as the mascot for an operating system ?
It arrived earlier this week
Love the luxury.
Had a beautiful drive through the Otways and along the Great Ocean road. If this is mid life crisis, all I can say is BRING IT ON !!!!
As a reformed smoker, ( and a reformed bearded person for that matter), I just loved this article in today’s paper.
Oh, and they stink too
The absurdity of relating programming languages to facial hair apart from being… well absurd … seems to preclude women, other than circus freaks, from being able to create a good programming language. Must be time to hang those sexists up by their beards
But let’s not forget there is apparently a slight correlation between beards and anti-social behaviour… Unabomber, Manson… to name but a few. Ironically, most, many male street folk also seem to have beards. Do good programming language creators have to be bums at heart ?
Sure there is probably a correlation between being unwashed and unshaven, ordering pizzas, and locking oneself in a room for days on end.. but is the end result the world’s greatest programming language or just a stink bowl ??