July 2004 - Posts

In VB.NET the Overloads keyword is overloaded itself, having two different meanings.  One is adding a new method with the same name but different signature, and the other is shadowing a base class method with a method of the same name and signature (Hide-by-sig)

The problem is the developer can’t tell the difference unless they look closely at the base class, and its base class, all the way down to System.Object

I would like to see the VB team include a new keyword for hide by signature, such as ShadowBySig, and introduce a compiler warning if Overloads is used as hide by sig. This would allow us to remove this ambiguity over time without breaking any code, and in the long term makes code more readable, easier to understand, and less prone to accidental hiding by signature.

Thoughts ?

with 9 comment(s)
Filed under: ,

Although the general guideline for Namespaces is you use your company name followed by the technology name, e.g.  Ajax.Widgets , Visual Studio .NET doesn’t actually tend to accommodate that by default. Instead, you have to open the project properties and modify the root namespace each time you create a new project.  Hopefully one day they will fix that, and have an Options setting where you can specify the default root namespace to use. Until then here’s a quick fix for VB.NET 2003 …

Locate the common.js file in the VBWizards directory, e.g. :
C:\Program Files\Microsoft Visual Studio .NET 2003\Vb7\VBWizards\1033\ common.js

Next open that file and locate the CreateVSProject function. It should be the fist one there.  At the end of that function, you should see :

    return project;
}

Change that to:

    project.Properties("RootNamespace").Value = "Ajax." + strProjectName ;
    return project;
}

Now next time you create a new project, “Ajax” will be the root namespace.  Of course you should change “Ajax” to your own company name ;)

Enjoy J

with 1 comment(s)
Filed under:

LookOut is now free from Microsoft :  Download it now !

http://www.microsoft.com/downloads/details.aspx?familyid=09b835ee-16e5-4961-91b8-2200ba31ea37&displaylang=en

 

Like some second rate Hollywood scream flick, the undead are rising from the ashes.  Just when you thought they had driven a stake through the heart of the evil creatures from VB6, they resurrect them to haunt you, to mess with your code, to play terrible tricks on you and intellisense ….. be afraid, be scared……..  Default Instances want to come out to play !!!

VB.NET is re-introducing Default Instances.  And there are some major problems with their proposed implementation …..

Problem 1: (loss of state)

Form1.Show is an example of a default instance.  Why is it EVIL, you might ask. Well because it just won’t die.  If you set it to Nothing, then check if it is nothing, it won’t be, as they are self re-incarnating.   In VB6, the way they worked was basically like this:

  Private m_Form1 As Form1

  Friend Property Form1() As Form1
       Get
            If m_Form1 Is Nothing Then
                 m_Form1 = New Form1
            End If
            Return m_Form1
        End Get
        Set(ByVal Value As Form1)
             m_Form1 = Value
        End Set
   End Property

So as you can see, they are basically self instantiating.   In VB.NET however, there are problems with this kind of code for Forms.  Unlike VB6, a Form in VB.NET cannot be shown again, once it is closed. Yes, that’s right, unfortunately the implementation of Windows.Forms.Form does not allow for graceful recovery after being closed.  So rather than throw an exception if you try to re-show a form, the VB team added code to check if the form had been disposed, since when a Form is closed, it’s Dispose method is called.
So the code now becomes more like :

   Friend Property Form1() As Form1
       Get
            If m_Form1 Is Nothing  OrElse m_Form1.IsDisposed Then
                 m_Form1 = New Form1
            End If
            Return m_Form1
        End Get
     …..

What this means is the form is no longer a data container. Instead it is just the UI instance, and data is not retrievable from the form after it is closed.  Programmatically, this makes interaction with a default instance a very different model from VB6.  You really need to look at Data Binding to an exterior object/data source.  The form as a state container is gone.


Problem 2 : (not settable)

Another difference from the Vb6 implementation is you cannot set the default property to  a given instance of a from . Instead, you can only set the default Instance to Nothing.  As explained above, setting the default instance to nothing is actually pretty useless in VB.NET, because the instance is not stateful anyway.  So the very times you would do this in VB6, there is no point in VB.NET.
Added to that, the removal of being able to set the default instance to a given instance, hinders effective communication between forms, that rely on a factory generated instance. Instead they must now communicate via tightly coupled passing of instances, or yet another global variable. 
Exactly why this feature was removed is not clear to me. It may be because of the issues of not being able to re instate a given form they found this to be misleading as the default instance would only be maintained while the form is open.


Problem 3 : (interferes with shared members)

Default instances are by nature a Shared property that returns an instance.  However because the Shared property has the same name as the Type, then instance methods are no longer distinguishable from Shared methods, at least not to the casual reader.  So code like Form1.ConnectionString may be an instance member using the Default Instance Form1, or may be a Shared member in the type Form1.  When reading the code you have no way of telling other than to look in class view or object browser.
Ironically, this muddying of the waters comes at the same time the VB team has proposed to break existing code, and not allow Shared methods to be accessed via an instance variable.
What can I say ??  Absolutely freaking unbelievable ;)

 

To sum up :

The above is just a high light  of some of the problems the re-introduction of Default Instances brings with it.  You should note, that these issues are on top of the issues Default Instances have always had.  That is, these are *additional* problems with the implementation.

That’s not to say that Default Instances don’t have some use. They do.  But the way it is being currently proposed, it raises more problems than they address.

Problems 1 & 2, I am going to attribute to the WinForms team, as that is the root of the problem.

Problem 3, is really the fault of the VB team  (and probably marketing)  They foolishly think by adding this they will somehow address the problems of the incompatibilities with the past.  Well as problems 1 & 2 show, it just isn’t going to happen. 
They could of course do this a lot better, a lot more like the .NET way of doing things. The Default Instance Form1 is actually My.Forms.Form1. So they could just simply leave it there, and have an Imports statement, Imports My.Forms.  Then people can choose to have Default Instances such as Form1, or only accessible via My.Forms.Form1.

No, instead they currently seem to want to force this upon us all.  Options are a good thing. Letting developers *choose* is a good thing.  Forcing things on developers is a bad thing, and forcing the EVIL undead on  developers is… well EVIL.

  • WinForms team fix up your act !!  (Mark Boulter get a blog !!   )
  • VB team, give us the option to have Imports My.Forms on or off, and base that default on whether the project is upgraded or not.

Balance evil with good  J

 

 

with 9 comment(s)
Filed under: , ,

What was … was.  But sometimes old habits die hard, and it seems pretty reasonable to me that VB.NET should at least try to honor the VB that went before it.  Some progress has been made: E&C is back; Zero Impact projects are back; and apparently at my request, the “0 To “ in array declarations is also back J 

But what would a blog entry be without some bitchin’ hey ?

Well, I created a Winform’s application, and in a method I wrote :
  Caption = “my cool application”

So probably half of you know what that is meant to do, and probably half of you once knew and have since forgotten, (and if you have absolutely no idea what it is meant to do then you are reading the wrong blog.. so bugger off).

Now the big question is why doesn’t the VB.NET smart tag error correction thingy ma jig know what that code is trying to do, and why does it not offer to fix it ? 

with 4 comment(s)
Filed under: ,

As part of a recent rebuilt, I needed to install VB6.  When you try to install VB6 from the VS6 CD’s, you get prompted to install Java presumably for the sake of Visual Interdev.  I really didn’t want to install ms’s java and not their outdated version.  So a bit of monitoring with SysInternals FileMon and RegMon quickly identified the *fix*

Create a new file, name it msjava.dll and place it in your windows directory. The file can be zero length.  You can then happily install without the prompt to install Java J

Once you have installed VB6, delete the msjava.dll otherwise windows update will prompt you to update it.

with 6 comment(s)
Filed under:

I like SQL Lite, but they could call it “SQL For You” or how about they give it that VB touch and make it My.SQL  ;)

with 5 comment(s)
Filed under: ,

Check these upcoming chats out.  Join in and talk to the VB team.

with no comments
Filed under: ,

In VB6, if I declared a variable as a Date, I could then assign a literal to it such as :

Dim dt as Date
dt = #30 Jun 2004#

The IDE would change that to #6/30/2004#.  This was always a bit of an annoyance, and you could tell it was American based, not European or Australian.  In fact I always have that issue with American dates, when the numbers could be interpreted either way, eg 4/8/2004. Is that August or April?  Depends on where you are ;)

VB generally is really good with Dates at runtime, as it is local aware.  At design time though, it’s just plain bigotry.  Vb.NET is actually worse than VB6, as VB.NET does not even parse the literal. That is, it doesn’t recognize #30 Jun 2004#.

I really wish they would fix this and allow for date literals to be less ambiguous, and allow not only the entering in of dates as #30 Jun 2004#, but also allow for that format to be preserved and applied to all date literals.  Why? Well because it is non ambiguous!

with 4 comment(s)
Filed under: , ,

As you hopefully unfortunately already know, IE is a serious vulnerability at present. And given how long it takes MS to patch these serious vulnerabilities, you should really be asking whether IE is a good choice for you, your company, and as a developer whether you lock customers into IE or other options.

Firefox is definitely getting a lot of attention lately, but is it ready for prime time? As much as I like it, I don’t think it is.  Firefox has some cool things such as simplified options dialogue, granular JavaScript settings, and of course tabbed windows. My favorite feature is its progressive rendering. Compared to IE, it can begin rendering much much earlier. But it isn’t all rosy. It has difficulty rendering some sites, sometimes serious difficulty. It is slightly slow to load first time, almost that slow you’d think it was written with java or .Net ;)  It has no concept of zones, so there isn’t an obvious way to treat important sites as trusted. 

For developers, Firefox has lots of browser specific additions (as if we need more). At least that prefix them with moz to indicate it is mozilla only extension. They also have XUL, which is kind of cool, mozilla only at present but may eventually become wider based. The big issue I have with Firefox fro ma developer’s POV is the lack of being able to reference an element by id, like you can in IE.  Instead of just referencing an element you have to be as one with that old xpath kind of lookup kind of feeling ;)

All in all, it’s not a replacement yet IMO. The lack of zones is a big time deal breaker for me, and its inability to browse all the WWW means you have to have a back up browser, and although that works, running two pieces of software just to do the one task is painful, and even more complex to ensure it’s secure.

That being said, what do you do when IE is vulnerable for a month at a time? Maybe having a backup browser is a great idea. And this is what developers have to allow for!

Up till recently it seemed you could get away with coding for IE only. It simplified development and testing, and let’s face it, most PC’s had IE. I know I have specified for projects IE5, IE5.5 or later.  And when I have coded I have addressed elements by id, instead of doing that document.all[“foo”] nonsense.  Why ? Well once again it speeds up development, gives you intellisense, and design time feedback.

But now, you have to evaluate those development savings against potential losses waiting for solutions from Microsoft. And seriously from what I have heard, I don’t think MS is going to address the need fro timely patches of IE any time soon.  When I see them do knee jerk reactions and drop ADODB stream support rather than lock that down to isolated storage or actually fix the real problem, the cross zone exploits, well you have to ask what does a company do if they had designed on that functionality?  Do they leave their machines vulnerable, or do they just shut down that app and have you re-write it?

The news either way is not good. At present there still are not viable alternatives. But alternatives are coming, and will probably be here before any next version of IE. The challenge for us is to develop for them again, not lock our selves or our customers into no choice situations.  That’s what I will be doing. 

And yes I do mean I will be dumping IE eventually or at least planning not to be IE dependant.  I doubt that bothers anyone at MS though, after all they disbanded the IE team and walked out on us some time ago, and only when they saw us flirting with Firefox did they realize folk weren’t going to take it.  And that’s probably a really good reason to code for Firefox and work with Firefox, as only then will we get a better IE, and probably also a better Firefox too ;)

 

with no comments
Filed under:

How many folks are running Windows.NET ? How many folks actually remember that over usage naming bungle ?  Well folks here we go again with SQL Express.

First ask, is it “express”. Well not really, the download and install is smaller, but the actual product runs at the same speed or slower than full blown SQL.
Next ask, is it learning orientated, like the other express products?  A: No, it is designed to be used as the free version of SQL.
Finally, ask does it come with the same kind of development experience as the Visual Studio Express products (VB.NET, C# and C++). A: No, it really is designed to be used in conjunction with those tools, not *instead* of those tools.

Perhaps this is why Sam had a different *expected* view of the product than what Brian thinks he should. A marketing name can mislead and confuse, especially if applied to products it should not be applied to. If it was as an extra to the other express products, rather than marketed as a stand alone *express* version, people would be focusing on the integration of the tools and the integration of languages with SQL etc.  As stand alone, it really is just MSDE.Next.

So how about a different name, one that actually reflects what to expect.   If it were up to me, I’d call it SQL Lite.

 And I'd market the Express porducts as including SQL Lite (optional download during install)


Oh, as to Brian and Sam’s POV’s, well I agree with both of them to some extent.  I think that early Betas are good. For too long MS has kept the early stages to a too inner circle, IMO. Inner circles are great for brain storming//think tanks etc, but when you want product feedback you need to get feedback from the outer circles.  MS still has a long way to go there.  They should try to indicate in their betas what is intended if it is not implemented.  That is, Betas should be for feedback, not just sneak peeks. As such it’s important they communicate one way or another what is in there.  And beta testers also need to learn to read between the lines, and not get too hung up on what isn’t there. Maybe we all have some growing to do ;)

with 4 comment(s)
Filed under:

You’d think reading about backward breaking changes from .NET 1.1 to 2.0 would be serious kind of reading, but it’s good to see the VB team has a sense of humour about them. Here’s some of their “bloopers” :

Upgraded apps that use VB Collection through inconsistent implementation of Ilist (very unlikely scenario) may be broken.

I wonder if they meant to imply that upgrading VB6 to VB.NET was a very unlikely scenario

But my favourite one is :

User can add explicit conversions if he wants to convert to a different types than the runtime before doing actual And, Or, Xor operations

Bad luck girls, seems only the guys get to do explicit conversions in VB.NET 2.0 J

with no comments
Filed under: ,

When the Express versions of .NET 2005 hit the web, the blogs ran wild. Phil Weber called them cyclic redundancy.
But would we expect a newspaper not to publish a news story because another paper had? No we wouldn’t as that would presume that readers had read the other paper. News is news, and blogs often play an important role in spreading of news. In ways they have become the local paper.  But they have reached close to critical mass.

Robert Scobble the guy who reads blog after blog after blog, recently said it seems there is getting too many blogs.  Weblogs@asp.net has hundreds of posts a day, and it really is getting hard to read them all. So do we blame blogs or the tools we use to read them ?

I think it’s the tools.

For an example, look at news.google.com, there you see various news services entries grouped in an easy to read summary based on the content. It is a simple intelligent agent.

For blogs, if  Phil’s reader grouped blogs by content, he would have just had one entry for .NET Express versions being released, and he could have expanded that entry to see brief synopsis of blogs by different people who posted about that event. Then he could have chosen which one or ones to read.

Blogging is fortunately and unfortunately growing at a rapid pace. Soon I will unsubscribe to weblogs@asp.net and instead just keep a list of bloggers I want to read. That is today, the numbers are too high for the tools, and a voice easily gets lost in the noise of so many posts. That’s the unfortunate part. Long term though with smart Bayesian filters, intelligent agents, blogging can be an important source for news, an independent news like never seen before.  It’s **tool time** !

 

with no comments
Filed under:

This is a continuation of my earlier rant from weeks ago.  The security issue has still not been addressed. That is to date, 25 days later.  However on day 24 of this latest security issue Microsoft did release the ADODB patch. What they didn’t tell everyone is that their disabling of ADODB being called from Internet Explorer does not address the permissions elevation issue(s) that are the root of this. No, instead they decided to just turn off ADODB from IE.  To add to them breaking of people’s thin client apps, it should be noted that Microsoft was aware of this issue over *10 months* ago.  So it has taken them 10 months to work out how to disable ADODB by removing one registry key ?  And they have the cheek to release this so called fix (talking about being liberal with grammar) and call it a *critical update* !!

You do the math.  Bill Gates recently in Australia said Microsoft is averaging a two day turn around.  Really ?  Sure doesn’t show up on Window’s update Bill.  Doing the math, this *critical update* took over 300 days, so in the last year, it would mean there were over 299 updates that took only 1 day to even out the averages to 2 days. I don’t think so.

Meanwhile the ability for internet zone code to get elevated permissions to trusted site or local machine zone continues. What will Microsoft close down next, instead of fixing the issue. How many more days will it take. This issue, the day zero exploit still remains open.

Oh and please don’t tell me that XP SP2 addresses these issues. That does nothing for people who bought windows ME while Microsoft was happily selling that to computer vendors only a couple of years ago. 

Trust worthy computing ?  When the vendor doesn’t inform customers of exploits for weeks, when it takes over 10 months to get a patch, when it takes over 24 days before they act when known exploits are published on the web ?

And as for people trying to blame the hackers, well hello, we knew they existed, we live in a world where there is unfortunately always some level of crime.  Take your home for example, you might go out on a summer’s day and leave the back door open.  But when you leave the front door and windows all open and put a sign down the road saying that this house is easily robbed, well then the story is a bit different wouldn’t you say.  Well that’s what Microsoft has done.  They knew the sign down the road was there alerting people that the front door was wide open, that Windows was wide open, and they did nothing for over 24 days.  In insurance terms MS has acted negligently, but hey, they aren’t’ the ones making the claims for damages and losses are they.  Over here, we have a saying, “keep honest people honest” and that means closing the front door.  Would you expect your house not to be burgled if you left the door open for 24 days and signs every saying it was unprotected?  Of course you would.

with no comments
Filed under:

So you are probably wondering why would an Aussie care about July 4th, right ?  Well for me it signifies a day when I gained my independence two years ago from … Tobacco.
Yep, two years ago I gave up smoking for good, after over 20 years of smoking.  At the time I was a heavy smoker and the fact it was so hard to give up made me even more determined to give up.  I just hated the idea that I was dependant. I use to say it was my choice to smoke, but it wasn’t really.  I was a junky, a tobacco junky.  I hated that thought, and I got pretty angry with tobacco for doing that. So I channeled my anger, and kicked the habit. And one things of sure I wont go back there.

So today is my independence from tobacco day. Two years down the track I am feeling good, regaining my health from earlier years. It’s amazing how insidious tobacco is, and because the detrimental effects are slow and incremental you don’t really realize just how much they impact you. So now I have lots more freedoms, freedom to travel on long flights with the wanting for a smoke, freedom to hang with the smokers or non smokers, and the freedom of enjoying activities with greater health which is an incredible freedom!

One other thing I don’t think people realize is how the addiction to tobacco is mental as well as physical. I think the mental addiction is the worse, as it actually makes people lie to themselves, saying things like “oh just one more won’t hurt”  It actually amazes me how many smart people I know seem to kid themselves about tobacco.  I doubt they would release software that had a 10% chance of crashing, burning and dieing, little less software that was 20% buggy or more. Yet what percentage of people die from tobacco related illness? 

It’s the mental addiction that fools them into illogical pretence that it won’t impact them, that’s how insidious it is. I know, BTDT, and I know how annoying reformed smokers are, I remember that too, but guess what, we will out live you smokers, and we aren’t going away, so you might as well join us, and enjoy the freedoms you in your drug crazed tobacco junky delirium think you have

with 1 comment(s)
Filed under: ,