March 2008 - Posts

OOXML

Reading the blog entries around OOXML is almost as bad as sitting through an episode of Days of Our Lives.  Most of the opposition comes directly from different people that are directly vested in ODF. And now that the vote looks like it might accept OOXML, the conspiracy stories start, such as claiming of stacking.  One blog post I was reading said it was outrageous that Microsoft complained about the stacking of the Indian committee.  Funny how when Microsoft complains about the stacking that's bad, but when they complain about the stacking that's good.  Looking at the Indian panel one really does have to question the role of IBM, Sun and RedHat on the committee as clearly they are in direct competition to Microsoft in this area. One would expect as many of Microsoft's partners to be invited at a minimum just to balance that.

In the end though, it's unlikely that any of the irregularities on either side of the arguments really make much difference.  OOXML is indeed worthy of becoming an ISO standard. ODF possibly should have been if they hadn't of deliberately decided not to support features of existing documents.

But I don't believe the OOXML is of proper quality at present. That is, although I believe it eventually will be worthy, I think they need to take more time and fix the specification.  One advantage of it becoming a standard now, is that it may encourage working teams to set about that, rather than leaving it purely in the hands of Microsoft.

One thing people talk about is the size and complexity of the standard. I think there'd be value in having a "Lite" version of the standard or feature set levels, such as level 1 is the minimum functionality... level 3 or n is the full specification.  That is, make the benchmark for supporting OOXML in part clearly defined. As it stands it is unlikely there will be full support for the entire specification from anyone (even Office 2007 doesn't now have full support).  Really, a standard needs to be achievable, and OOXML is a bit vast for that to happen easily by anyone outside of Microsoft.

Regardless of the yes or no at ISO, this really has to be viewed as a first step, and either way, if Microsoft wants to be taken seriously they need to do a lot more, making OOXML more accessible and easier to implement and ensure conformity.

Posted by bill | 1 comment(s)
Filed under:

Auto properties : What ifs ...

Paul Vick posted a speculative post as to Automatically Implemented properties for VB10.  Although it's kind of nice, it really is just a minor modification from what C# did in 3.0 and misses a lot of the "what if" scenarios we should be asking.

What if :

  • You want to add a break point on the property set  or get?
  • You need to add some validation or logging ?
  • You want your existing code to look consistent ?

What's being proposed falls down on all those counts.  A better approach, IMO, would be to just auto collapse properties, similar to what Refactor! does. That works with existing code1, and addresses all the what ifs above.

I also expect there will be IDE issues around the syntax Paul proposes as it is no different from the opening line of a Property today. So when you hit enter at the end of that line, you'd expect code completion. So adding lines between these auto properties will potentially break code.

And when you do press enter, let's assume it does complete the code block for you:  it would need to include the backing field otherwise it risks breaking code elsewhere. That's a major change from today, where unless you use a snippet, you only get the property stubs.

 

What I would like to see, is allow the backing field to be declared inside the property block, such as :

   Public Property Name() As String

     Dim m_Name As String

     Get

         Return m_Name

      End Get

      Set(ByVal value As String)

         m_Name = value

      End Set

   End Property

 

Then the property truly can be collapsed and expanded as it is fully encapsulated.

I'd also especially like us to be able to specify the default prefix used for backing fields when generated, be it m_ or _ or m etc.  We shouldn't have to change our coding styles to match an inflexible code generator.

I think this feature needs to be looked at in terms of existing code, and code maintenance, not just a quick fix for writing pass through properties.

 

 

 

1. There's a bug in Refactor with properties in a Module, where it hides the property, not the backing field.

Posted by bill | 4 comment(s)
Filed under: , ,

Can't get no VB Action ?

Paul Stovell finally notices the lack of support for statement lambdas in VB9.  Unfortunately Vb9 only supports lambda expressions such as can be expressed in today's expression trees.  .NET 4.0 will most probably include support for lambda statements, and hopefully at the same time VB10 will have support for them too.

When support for multi statement lambdas was dropped from VB, I complained bitterly.  It's a real pain, especially if you want to just add something benign like logging into a lambda: in VB9 you can't easily.  Yes there are "work arounds", but if you need to capture surrounding variables, then it's a huge pain as you need to manually write the captures (promotion of local variables into fields in another class).

Of course fixing this feature, is on my VB10 wish lists.  It's listed as item 6 in the first part of VB10 feature wishes.

The nice thing for VB in all of this though, is it will probably never have to separate what can and can't be expressed as an expression tree.  C# has kind of made a mess around anonymous delegates and lambdas (I've even heard Anders admit to that !). ;)

Posted by bill | with no comments
Filed under: , , ,

Least among equals ?

Patrick Meader writes on the divide between VB and C# inside Microsoft, and raises an interesting question.

My response is probably going to be lengthy; more than I have time for at present. In the meanwhile, what do you think of the issues raised in Pat's editorial ?

Posted by bill | 4 comment(s)
Filed under: , , , ,

Increment operators ?

Does VB need prefix and postfix increment and decrement operators ?  Here's an example I posted today for a question on adding an index with LINQ:

   Sub Main()

      Dim values() As String = {"aaa", "bbb", "ccc"}

      Dim index As Int32 = -1

 

      Dim view = From v In values _

                 Let x = increment(index) _

                 Select x, v

 

      For Each item In view

         Console.WriteLine(item.x & " : " & item.v)

      Next

      Console.ReadLine()

   End Sub

 

   Public Function increment(ByRef value As Int32) As Int32

      value += 1

      Return value

   End Function


 

And this is the same code in C#:

 

      static void Main(string[] args)

      {

 

         string[] values = { "aaa", "bbb", "ccc" };

         int index = -1;

 

         var view = from v in values

                    let x = ++index

                    select new{x, v};

 

         foreach (var item in view)

         {

            Console.WriteLine(item.x + " : " + item.v);

         }

         Console.ReadLine();

      }

 

Note in C# I didn't need to write the increment function.

Posted by bill | 5 comment(s)
Filed under: , , ,

You bastards !!!!!!!!!!!

Posted by bill | with no comments
Filed under:

What ever happened to easter eggs ?

No, not the chocolate ones or the decorated chicken eggs... I mean software easter eggs.  Like the ones in Excel where you could display an animated scroll of all the contributors. And they had similar in Outlook, and even in Visual Studio 6 !  Has all the fun (and chocolate and caramel centres)  been taken out of Microsoft software  ?

 

BTW: Has anyone seen the easter egg in the VB Snippet Editor ?  It's pretty easy to find ;)

Posted by bill | 3 comment(s)
Filed under: , ,

Does silverlight really make sense ?

Earlier today I followed Soma's link to the updated Visual Studio Express pages. Soma gave emphasis that the "approach was to add Silverlight without making it look like we just dropped something new into our existing site without any thought".  Hmmm, could have fooled me ;)

The first thing I noticed (other than having to allow the AgControl Class addon) was with the new site I have to wait for silverlight data to be downloaded.  And that is slow.  But why do I have to wait ?  Seems all that is really being brought down is a series of about 10 slide shows.  Sure to the naive they look pretty because the screen shots are on angles, but it's also incredibly useless. You can't even navigate through those slides.  It's like it was designed to wow the bosses inside on the corporate network as they sit back and watch the slide show.  As far as end user goes, it sucks.  Why the hell should I have to wait for (and pay for the bandwidth used by) a useless bunch of slides ?  What ever happened to *asynchronous* fetching of data ?

And the big problem for users is they don't know if they are able to get the same content without Silverlight.  Was there any real gain to the user ?  Or did it force the user to wait, and in fact make navigation more awkward (such as when you go forward and then go back, you have to sit and wait through the slide show again depending on which slide was relevant to you).

What scares me is that Soma is proud of this usage of SilverLight.  I guess that means he must have just sat back and watched the slide-show over the corporate intranet :(

Posted by bill | 2 comment(s)
Filed under: ,

First time or casual programming

"First time or casual programming" : that's apparently what VB is good for.  If you want a great combination of power and productivity that's what C# is good for......

well, at least that's how Microsoft tells it to us.

Microsoft, why do you treat VB so patronisingly ?

Posted by bill | 6 comment(s)
Filed under: ,

Using the Microsoft.VisualStudio.Zip assembly

I got an email today asking about the use of the Microsoft.VisualStudio.Zip assembly.

Hi,

my name is XXXXXX and I'm from XXXXX.

I'm writing a custom .Vsi writer and I saw that in the Code Snippet Editor for VB 2008 (a great tool!) you made use of the Microsoft.VisualStudio.Zip assembly.

What are licenses related to this assembly? I mean.. can I reference it to a project of mine (which I'll release as an open source) or only Microsoft people can use it?

 

That's not an easy question to answer as I am certainly no lawyer.  But I did use it, and Microsoft has pointed to and distributed the code I wrote that uses it. But I am not from Microsoft, and Microsoft may have done that unknowingly.

The Microsoft.VisualStudio.Zip library ships with Visual Studio and is installed in the GAC, but usually you need to turn off fusion view to reference it.  My belief is that as long as you don't distribute the dll then there is no licensing issue. And I believe that you may even be technically able to distribute it to systems that have Visual Studio as they have a license to use it, but that's a grey area.

Personally, I think intent is the real issue, and I honestly can't see anything bad in anyone referencing the assembly if they are writing tools to extend Visual Studio in a manner that doesn't compete with Microsoft's different SKU's.

The sad thing is Microsoft doesn't actually provide a Zip library as part of .NET that you can reference and use in ANY project.  They provide and use Zip for their Packaging classes but they only include API for working with office OpenXML files.  They also provide the gzip stream stuff, but there's a fair bit of work to make that work with actual zip files.  The sad part of this is Microsoft views zip as important, be it .VSI files and Visual Studio, or OpenXML files  such as docx etc which are renamed zip files, yet they don't provide a Zip library as part of .NET, even though they have written one and use it themselves.

Posted by bill | 1 comment(s)
Filed under: , ,

one of those days ....

It must be hot or I'm having one of those days.  I was just testing some code and it seemed to do the unexpected.  The problem was I had written :

   Public Overrides ReadOnly Property IsInvalid() As Boolean

      Get

         Me.handle = IntPtr.Zero

      End Get

   End Property

This function was not only returning the wrong value but it was also changing the state !!

Okay, obviously I meant that to read:

         Return Me.handle = IntPtr.Zero

but I made a mistake. The problem was exasperated by no warning from VB that the Get wasn't returning a value.  I hate that. It's as bad as that stupid implicit local variable VB creates for you with the same name of the function.  I wish I could easily turn off VB's desire to help me as that would be in fact far more helpful ;)

And of course if there was an option to have a different equality operator from an assignment operator, that would have possibly helped a little in this case.  Maybe I should write it using the double negative:

        Return Not (Me.handle <> IntPtr.Zero)

;)

Posted by bill | with no comments
Filed under: ,

Windows Live team continues insults at VB'ers ...

After my post about the first set of insults from the Windows Live team and the Search API samples, it was nice to see some VB samples released.  Sadly though they were just the C# samples run through an automated tool.  I mean look at this bullshit code from them :

 

Select Case searchFlagsValue
       Case 0
           .Flags = SearchFlags.None
           Exit Select
       Case 1
           .Flags = SearchFlags.MarkQueryWords
           Exit Select

  .......

 

The Exit Select is just utter crap. The only reason it's there is because the c# code uses break statements inside a switch block and that's what their machine translation mapped to Exit Select. It shows an incredible ignorance of VB, and demonstrates yet again complete contempt for the VB audience.

To add insult to insult, they also decided not to include the Windows.Forms sample for VB.

 

.

Posted by bill | 2 comment(s)
Filed under: , , , , , ,
More Posts Next page »