Ugh, I loathe working with VB for money reasons, unfortunately I have to maintain the company’s existing all crappy software.  So, I’m coding away adding in the latest bug fix or feature request when VB’s fantastic IDE tells me what I’ve done is wrong…

Take a look at the below GIMP’d screenshot (I’ve highlighted the points of interest).  As you can see VB’s IDE has complained that I have declared duplicate variable names in the same scope.  I know I have declared duplicate variables names, that is what I was intending to do, consistency and all that.  However, each declaration is under a different branch of the parent conditional, which should have a scope of it’s own.  Apparently VB has it’s own way of doing things.  Yes, I could pull the declaration out of the conditional and have one declaration but I was hoping to be less intensive on the heap by declaring them only when they are needed (efficiency and all that).

VB's excellent scope analysis

 Anyway, this is just one irritating feature of VB that causes me so much pain :( </rant>

So while I’m searching for a fix for a particular coding problem and rapidly amounting numerous tabs in Chrome for every Google result my seach has given me, I come across this cute little post that made me stop and actually read it.  Being a seasoned Java programmer I already have a lot of experience with nested classes etc. but I found this post amusing as it is written as if the author were the Outer Class.

The URL for the post is http://www.javaranch.com/campfire/StoryInner.jsp and it teaches Java by stories, a rather inventive take on the teaching process, effective too.

Anyway, after finishing reading the post I went back to my particular nested class problem.  I sat there staring at it for a few moments still with the inner class story in mind and suddenly it dawned on me what I was doing wrong.

Sometimes it is good to go back to basics, my thanks to the JavaRanch and its Cows :)