Jeff and .NET

The .NET musings of Jeff Putz

Sponsors

News

My Sites

Archives

Fire the person that wrote this documentation

I generally have the opinion that Microsoft documentation has gotten a lot better, but then I run into crap like this...

http://msdn2.microsoft.com/en-us/library/system.web.ui.datasourceview.executedelete.aspx

Yeah... that's an example that show not functional use of the method, but rather a not implemented exception piece of code.

Someone should be fired. 

Posted: Aug 17 2006, 10:33 PM by Jeff | with 20 comment(s)
Filed under:

Comments

Ken Cox [MVP] said:

It's your absolute right to whine about someone's mistake, but it would be more constructive to go in and *fix* the error by providing a real example for the community.

You can do that using the MSDN Wiki beta:

http://msdnwiki.microsoft.com/en-us/mtpswiki/system.web.ui.datasourceview.delete.aspx

Ken

Microsoft MVP [ASP.NET]

# August 17, 2006 10:59 PM

Dave Griffiths said:

Fire the person that doesn't understand (semi-abstract) inheritance ... :-)

Read the documentatation again .. this is a base class, that's behaviour can (and is) overriden.  By default, delete is not supported by the base class .. but might be in any of the following derived classes ..

* System.Web.UI.WebControls.XmlDataSourceView

* System.Web.UI.WebControls.ReadOnlyDataSourceView (probably not in this one)

* System.Web.UI.WebControls.SiteMapDataSourceView

* System.Web.UI.WebControls.SqlDataSourceView

* System.Web.UI.WebControls.AccessDataSourceView

* System.Web.UI.WebControls.XmlDataSourceView

In fact, here is a bit of code from the SqlDataSourceView to prove it ..

Protected Overrides Function ExecuteDelete(ByVal keys As IDictionary, ByVal oldValues As IDictionary) As Integer

     If Not Me.CanDelete Then

           Throw New NotSupportedException(SR.GetString("SqlDataSourceView_DeleteNotSupported", New Object() { Me._owner.ID }))

     End If

     Dim connection1 As DbConnection = Me._owner.CreateConnection(Me._owner.ConnectionString)

     If (connection1 Is Nothing) Then

           Throw New InvalidOperationException(SR.GetString("SqlDataSourceView_CouldNotCreateConnection", New Object() { Me._owner.ID }))

     End If

     Dim text1 As String = Me.OldValuesParameterFormatString

     Dim command1 As DbCommand = Me._owner.CreateCommand(Me.DeleteCommand, connection1)

     Dim dictionary1 As IDictionary = Me.DeleteParameters.GetValues(Me._context, Me._owner)

     Me.AddParameters(command1, Me.DeleteParameters, dictionary1, oldValues, Nothing)

     Me.AddParameters(command1, Me.DeleteParameters, keys, Nothing, text1)

     If (Me.ConflictDetection = ConflictOptions.CompareAllValues) Then

           If ((oldValues Is Nothing) OrElse (oldValues.Count = 0)) Then

                 Throw New InvalidOperationException(SR.GetString("SqlDataSourceView_Pessimistic", New Object() { SR.GetString("DataSourceView_delete"), Me._owner.ID, "values" }))

           End If

           Me.AddParameters(command1, Me.DeleteParameters, oldValues, Nothing, text1)

     End If

     command1.CommandType = SqlDataSourceView.GetCommandType(Me.DeleteCommandType)

     Dim args1 As New SqlDataSourceCommandEventArgs(command1)

     Me.OnDeleting(args1)

     If args1.Cancel Then

           Return 0

     End If

     Me.ReplaceNullValues(command1)

     Return Me.ExecuteDbCommand(command1, DataSourceOperation.Delete)

End Function

# August 17, 2006 11:06 PM

Jeff said:

This is precisely why our community sucks compared to those for other platforms. A comment like this, which is a call for a higher degree of excellence from Microsoft, is met with "do it yourself" and "read it again" or lessons in OOP. "MVP" my butt.

I never said I didn't get it or couldn't figure it out (I already did, thanks). But if you're wondering why it's so hard to find people who really get the ins and outs of the platform or wonder why people ask really "obvious" questions in forums, it starts with poor documentation.

# August 17, 2006 11:58 PM

Sean said:

Not new. I actually tried to report and go this answer: ----- Hello Sean, Thank you for waiting for our response. This is to inform you that we will not be able to make the immediate changes you have reported because the content is acquired by MSDN. We have forwarded the issue to the content owner for review and resolution on their end. You may want to visit the site from time to time to check for any development. We apologize for the inconvenience this has caused you. Should you have other MSDN concerns, please feel free to write back. ----- Puts some light on it :)
# August 18, 2006 2:20 AM

Alberto Acosta said:

Jesus love him too, you should be the best writer ever can you give the list of tech Book you have published please.

# August 18, 2006 4:24 AM

Martin said:

Great idea. Lets fire anybody who ever made a mistake. That would leave exactly zero people with jobs.

# August 18, 2006 4:43 AM

Dave Griffiths said:

Sorry, but I was pointing out that the documentation is fine. There is NO mistake, and NO error here. In the context of the example code, a read-only DataSource, a not supported exception is exactly what you would want to do, so this is a fully functional, working example. It states clearly that this is not a stand-alone piece of code. I don't see this as a mistake, and definitely not one that somebody should be "fired" for. If you're expecting examples of every possible use case for every method and code path, which is what you're really asking for "out of the box" from Microsoft, then you've got very high expectations. As for community spirit, you clearly didn't ask for a higher degree of excellence, you just blogged to the ASP.net community - "fire" the person who didn't think to write extra documentation (or more specifically, chose to document an example class that has behaviour that does not require 100% implementation). When asked to not just criticise but contribute to the community by the MVP, you criticised them too. You're entitled to do that, but it's unhelpful. If you think the documentation calls for a second example then request one OR, now you know how it works, add one. As an analogy .. Do you develop software that is 100% bug free after you've fully tested it and release it? No, never! Only an idiot would think/expect that. After release, it's only by people reporting bugs/errors TO YOU when they reach real world use, that you'll be able to find them. If everyone sat around and criticised, instead of reporting or assisting you with the problems, then the software industry, our community, would not last very long. Your call for somebody to be fired for the equivalent of leaving out one test case in a massive, collosus of an application, should seem ridiculous and is very unhelpful.
# August 18, 2006 6:31 AM

Wim said:

All that anger...

You against the world eh?

# August 18, 2006 7:31 AM

Casey Barton said:

Conceptually: The datasourceview might be persisted into *anything*. There is no implicit default to show an example for, so they didn't choose one.

Pragmatically: They should just have shown a simple example using a SQL data source, like 90% of real world examples will.

Ultimately: A code example that throws NotSupportedException is frickin' hilarious.

# August 18, 2006 7:51 AM

Jeff said:

"Jesus love him too, you should be the best writer ever can you give the list of tech Book you have published please."

You might want to search Amazon before you post something like that.

"All that anger..."

How is that anger? I have a lot of strong opinions. That hardly makes me angry.

The documentation is not "fine" by any definition. Your notion that it's technically correct is silly. Put aside your superiority complex for a minute and remember a day when you were less competent. Casey is right, a few simple lines hitting a SQL database would have been useful, and not hard to write. If you're inexperienced, and never implemented an abstract class, you'd look at that and wonder where the heck you'd get the values from. I can remember those days... why can't you?

You can spout off all day long about how I should help, and I've done my share of that. That's not what this post is about. It's about demanding more as a customer from Microsoft. If mediocrity is OK with you, that's your business. But this isn't about you or my philanthropic endeavours.

# August 18, 2006 9:24 AM

AndrewSeven said:

The thing about firing people for single mistakes is that you usually end up firing a scapegoat who is less able to engage in the political wranglings.

I almost always share Jeff's feeling about the things he posts.

I understand the pain, but I disagree with the specific example used here.

While it is surely related to the specific things I search for in the doc, I find that this entry is average or above average in terms of content.

Unlike many entries I have come across, it has clearly had some human intervention rather than just being generated/inferred from the method name and signature.  (I find the naming of things good enough that most of the time the little extra bit from the xml comments is redundant)

It says that "This code example is part of a larger example provided for the DataSourceView class". I think there should be a link right there in that sentence to that larger sample. Yes, even if it is the just back to the DataSourceView class page), it would put those snippets into a logical context.

I do not think that an example using sql would be any better if it was not in the context of a larger sample.

Ken:

I have submitted small corrections to Msdn before and will do so in the future if I spot errors.

If I have to build up a prototype (which the client is paying for) to figure out how to use an API, that is ok.

To think that I would take the personal time to take the code (is it the client's code?) and reduce it to an instructional example is not very realistic.

If I the client wanted it and would be willing to pay me to do it, I would be glad to do it; but they aren't, so I won't.

# August 18, 2006 9:29 AM

Curt said:

Granted - the approach of "calling" for a firing may be a bit abrasive (though I suspect the author meant it to be exaggerated), the point should be well taken. Almost all of us are "new" at something as we extend ourselves into new areas, and have to dig into MSDN docs and can be frustrating. My first stop is often Google and not MSDN simply because I suspect that what I'll find in MSDN docs is a statement of the obvious, and not deeper knowledge such as performance related details.

But what really steams me about this community is the hostility and elitism, and "titles" such as MVP don't help - how about titles such as MHP - Most Helpful Person?

# August 18, 2006 11:04 AM

Jeff said:

Thank you, Curt, for getting it.

# August 18, 2006 11:31 AM

AndrewSeven said:

"I suspect that what I'll find in MSDN docs is a statement of the obvious, and not deeper knowledge "

Me too.

# August 18, 2006 11:59 AM

Tim Hibbard said:

Fired might be a bit extreme...how about flogged.

# August 18, 2006 2:03 PM

ydobonmai said:

MSDN....Their examples are wierd.

I am very new to dot net. everytime i check the msdn for some help, it leaves me even more confused.

I'd rather google.

# August 19, 2006 4:17 AM

Jeremy said:

Yes, I also usually google first.

And I also "get it."

As well as having a valid point, this original blog post was just a way of venting. You don't have to take expressive titles literally.

# August 21, 2006 7:45 PM

Jeff's Junk said:

My last post seemed to rile up a few people, which is not entirely surprising since I used strong language

# August 22, 2006 12:33 PM

Scott Willsey said:

Seems like people got a little over-reactionary. Sometimes people have strong opinions, and when they are irritated, they say them in a strong manner. It's their opinion.

I'd better not post the link to my blog, if you think Jeff is a cranky person...

# August 23, 2006 4:33 AM

Tony said:

I just run into this while working on writing a DataSourceControl.  This documentation is still the same and still of very little use.  I'm sure I'll be able to hammer something out, but it would have been easier had they put some some of example of best practice.

# June 14, 2007 12:35 AM
Leave a Comment

(required) 

(required) 

(optional)

(required)