July 2011 - Posts

Cory is continuing his posts about VB10 differences from VB6. His latest posts is on variants.

Variants were/are basically a structure that contains a variant type enumeration and either the variable’s data value or a pointer to the variable data. In pseudo code it basically looks like:

Structure Variant
    Public VT as VariantType
    Public Value As Object
End Structure

The Value field would hold the actual data in the case of simple value types, or a  pointer to the object such as in the case of arrays. In the .NET world there are actually variant structures but not as part of the .Net framework: you can find one for example in the Microsoft.VisualStudio.Package namespace.

The reason you won’t find it in the framework is because the variant structure is not only limited but also superfluous in .NET due to the type system. Take for example the case of a value as a Double versus an Integer. In VB6 you would use Variant to allow you to pass both values to a method. The Value field would hold the actual data so it was important that the VT field told you the value type. The problem with this approach is the VT field is an enumeration, so doesn’t allow for custom value types to have their actual type discoverable: try passing a UDT into a variant and then determining which type of UDT is is in VB6 to see what I mean Winking smile

In .NET the object based type system means you can always determine the type of a variable. So the “everything stems from Object” approach in .NET is definitely more versatile.

There was however one thing missing: yep, IsMissing was missing. Variants allow optional parameters to indicate if a value was missing. The first release of .Net didn’t have anything in place to indicate if an optional parameter was missing. It wasn’t until nullable types were added that you could do the equivalent of IsMissing by testing for Is Nothing. The Is Nothing approach is more holistic and uniform (as opposed to IsEmpty versus IsMissing et al) and works across the board for nullable types and As Object variables and parameters.

So, in summary, there was initially some gains and some losses with the move from Variant to an Object based system, but as the .NET framework and language implementations have matured, the Object based system (.NET) offers far more functionality and flexibility.

Oh, as you can probably see, the above explanation/description actually touches on a number of items in the list Cory referred to: in particular but not limited to items 11 and 27. I think it is always important to come up for air and see the big picture: the forest from the trees. The overall benefits of moving to Object based in .NET extend far beyond these one or two items.

with no comments
Filed under: , , , , ,

Today Microsoft announced an even more generous program designed to help non-profit organisations !!

http://blogs.technet.com/b/microsoftupblog/archive/2011/07/26/expanding-microsoft-software-donations-to-more-nonprofits.aspx

 

Kudos guys!!!!

 

Thanks Smile

with no comments
Filed under: ,

Last weekend we strolled around Glen Aire, along the Great Ocean Walk from Castle Cove to Johanna:

 

 

 

More photos at:
https://picasaweb.google.com/Bill.McCarthy.MVP/GreatOceanWalk#

with no comments
Filed under:

I recently bought a Dell XPS17 (L702x) and thought I’d post a review for those considering purchasing this notebook. There’s a massive thread about all things good and bad in relation to this notebook over on notebook forums; the following is just my opinionSmile

Weight : good for the size.

Screen: Love it !!  I have the anti-glare screen (1920 x 1080) and it’s a lovely screen. I did make minor adjustments to the gamma, toned the blue down a bit and the green just a tad. Photos, especially nature scenes, look fantastic, true to life colours. The antiglare is also really good. Compared side by side with a glossy screen laptop you really appreciate how well it works: no  annoying reflections of windows etc. Viewing angle is really wide with little distortion.

Keyboard: It’s growing on me, but i think it could be better. I like the back light. Problem with the keyboard being a full keyboard is it means centre of the keyboard is off centre, which means i tend to have the laptop shifted out to my right. Given how much space there is I think Dell could have done better with keyboard options, such as offer a comfort curve option.

Touchpad: It’s big. Also off to the left a bit so as to almost be centre of the alpha part of the keyboard, but not quite. Centre of the touchpad lines up with key 7 or the space between Y and U. Gestures work pretty well: I particularly like the cover the touchpad to hide all open windows gesture.

RAM is 8 GB which is good enough for me (generally). Unfortunately only 2 slots. Apparently if you order the 3D screen you get 4 slots. That kind-of sucks, but i doubt it will bother me in the next couple of years.

Processor: i7 2630QM. Seems good and fast. Yet to really multi thread stress test it though.

Graphics: most of the time I’m using the Intel one (or so it seems). I’m not a gamer Winking smile

USB: Awesome !! My external HD which is USB 3, is fast Smile  I also really like the charge port for charging my phone.

Battery: I got the 9 cell. i like how it sticks out of the bottom to tilt the notebook when sitting at a table. Battery life seems good. I use the machine for hours and still have half battery left.

Hard drives: There’s two bays and came with two 750 GB @ 7200 RPM. I found them relatively noisy and kind-of slow, so I put in one of my old solid state drives and also added a new OCZ Vertex 3. The Vertex 3 uses the 6 Gbs bus and it rocks !! Lightning fast, and absolutely no noise. There was a problem with the notebook hanging for anywhere up to 30 seconds or so. Looking in the windows log I identified the problem as being the Intel SATA drivers so I uninstalled them, and since then it has been rock solid (and very fast Smile )

Sadly the Dell web site doesn’t really give much choice on this: they don’t tell you what kind of Solid State Drive they offer as far as performance goes, and they only offer pricey options of 256 GB or more. Given this notebook has two internal drive bays, having two @120 GB would seem the best bang for your buck at present. My OCZ HD is getting the maximum windows experience index score of 7.9:

 

image

 

Overall opinion: I like it Open-mouthed smile.

with 1 comment(s)
Filed under: ,

Cory Smith has a set of posts on some of the differences between VB6 and VB10.There’s one which I think needs a bit further clarification: Private Class Variables.

In VB7 and later, you can access private class variables from another instance of the class. So let’s say you had a class A with a private field _z, and instances a1 and a2.In this case a2 can read and modify a1._z. 

An example of this might be if you have a class that has a private field to track changes; you might expose whether or not the class has changes as a ReadOnly property, but you’d want the backing field as Private so as it can’t be modified from outside the class, e.g:

Class Customer
   Private _hasChanges As Boolean
   Private _FirstName As String

  
Public ReadOnly Property HasChanges As Boolean
      Get
         Return
 _hasChanges
     
End Get
   End Property


   
Public Property FirstName As String
      Get
         Return
 _FirstName
     
End Get
      Set(value As String
)
        
If value <> _FirstName Then
            'TODO: Raise PropertyChanging notification
            _hasChanges = True
            _FirstName = value
           
'TODO: Raise PropertyChanged notification
         End If
      End Set
   End Property


  
Public Shared Function Clone(source As Customer) As Customer
      Dim cust As New Customer
      cust._FirstName = source._FirstName
      cust._hasChanges = source._hasChanges
     
Return
 cust
  
End Function

End 
Class

Note the Clone function, where the code has access to the private variable of a second instance. This makes the language a lot more powerful and flexible. Benefits include:

  • access to fields in Shared methods
  • provide deep clone and equality methods
  • Assists with Factory methods

there’s no real downside to this, as only code written in the same class as the field  is defined in can modify the field. Code in derived classes would need the field to be declared as Protected, not Private, so Private remains Private to the code you write.

In terms of VB6 to VB7+, this is a non breaking change.  It was an addition to the language that makes a lot of sense as the language moved to be more object orientated.  So to claim that this is somehow significant impeding change is really just nonsense: zero impact on existing code, and provides greater flexibility when writing new code.

with no comments
Filed under: , , , , ,