Thursday, March 08, 2007

This isn't the first time I (Mike speaking) have commented on this subject, I have done so once before at least on the MyGeneration forums. However, now that we are implementing EntitySpaces design time data binding support for ASP.NET 2.0 my anger has been renewed ten fold on this subject. To put it bluntly, Microsoft ruined ASP.NET programming when they released ASP.NET 2.0. Quite a statement I agree, however, I'm not the only one who thinks that. I've been communicating with several key folks in the know concerning this new ObjectDataSource/DataSourceControl fiasco and received this comment just today.

"IMHO, Microsoft ruined data binding in ASP.NET 2.0 when they dropped component support from the design surface"

What am I talking about? Well, if you have ever used data objects or business objects that support the proper interfaces you can drag then right out onto your form, add them as the datasource to your grid, and then pick which columns you want to use, and in what order, including sorting, and so on. You can do that now with EntitySpaces in Windows.Forms, but all that was removed from ASP.NET 2.0. Why? Let's go back in time and look at the reason Microsoft gave (and still gives) as the reason they decided to remove design time data binding support from the ASP.NET 2.0 Framework. 


Microsoft's Statement on this:
http://lab.msdn.microsoft.com/ProductFeedback/viewfeedback.aspx?feedbackid=e2996990-64a5-4308-921d-245071e6f174

Thank you, we appreciate all of the feedback on this issue. Unfortunately we will not be able to implement a Component Tray for components in VS 2005. As stated previously, the existing model in VS 2003 was prone to bugs and code-loss and as such we've removed the functionality of a designer tray for components defined in InitializeComponent. The team understands the desire to have this functionality and we will look at potential solutions in future releases which are more robust. While the designer tray support for components declared in Initialize component is removed, components themselves are fully supported and can be edited by modifying code, and existing components defined in pages will not break and will continue to work when the page is executed.

We regret the loss of functionality in this scenario and we will certainly aim to provide similar functionality which is realizable and not error prone in future versions of Visual Studio.


My Paraphrase: "We couldn't get it to work?"


So, what does this mean. It means Microsoft hurt immensely the development communities ability to write ASP.NET applications in 2.0. There is just no way around it. To say that they couldn't figure it out is insulting to the say the least. They should have picked up the phone and called me, I guarantee I could have had made it work. No, there had to be another reason and I think I know what it is, more on that later in this post.

One of those sounding the warning sirens early on was Daniel Cazzulino and you can see his blog and his replies on the Microsoft link (or rather excuse) above. His responses are as kzu as he urged them to re-open this issue. In fact, I remember that post being much longer, a lot of it has been removed, I wonder why? He was so right of course, thanks Daniel, but there was nothing you could do, it wasn't that they couldn't fix it, it was removed for a purpose.

So, left trying to pick up the pieces are the ORM folks, from Paul Wilson, Rockford Lhotka, Frans Bouma, and Winston Fassett's work surrounding NHibernate, and probably quite a few others I have left out. On Rocky's Blog Post you can see his frustration and rightly so, remember, this all worked via generic interfaces like IBindlingList and ITypedList and so on in ASP.NET 1.1 .... Paul Wilson's DataSourceControl sample is cool, but one thing you learn very quickly is that his sample, while appreciated, merely allows for runtime data binding. All that work just for runtime databinding?  Then there's Winston Fassett's NHibernate Example on The Code Project which takes it a little further.

However, and I must say, NONE of these samples are actually what you would call design time data binding support. This is not to discredit anyone's work, their work is good. The point is everyone is being fooled into believing that this is something that it is not; DataSourceControl is not a replacement for ASP.NET Design Time data binding and neither is ObjectDataSource. Take a look at this image from the NHibernate based article.
 

Notice the TypeName property is Northwind.Model.Product. This is the type of object you want to bind to, which is then loaded via reflection in both Paul's and Winton's samples. In fact, there really is no other way to do it. So medium trust goes out the window. Also, if you look closely you will see things like WhereFragments and SelectParameters and other strange items. It quickly becomes evident that this is a strange and rather bizarre way to create a web page. Rather than write the code in a code behind page to load the entity you get to use a strange dialog with a dialect completely different than your normal way of working. And the vendor of the ORM architecture get's to invent an entirely new API to query the objects since you cannot use C# or strongly typed mechanisms in a dialog like this. 

Look at these methods of the low level DataSourceView class that Microsoft holds out as a better way?

virtual int ExecuteUpdate(IDictionary keys, IDictionary values, IDictionary oldValues);
virtual int ExecuteDelete(IDictionary keys, IDictionary oldValues);
virtual int ExecuteInsert(IDictionary values);

So, Microsoft now expects us to actually write our insert/delete/update statements by passing IDictionary's of typeless data around and using reflection to translate those into properties in order to make sure any business logic that needs to be executed is triggered. I'm getting pretty ticked just writing this up. Am I the only one who see's this? This isn't design time data binding or even runtime data binding, this is worse than scripting, in fact, none of this is necessary at all, just support IBindingList and ITypeList and you can write your code in C# or VB.NET and not in some strange bizarre dialog? This type of programming would make me long for VB4 if there ever was such a thing ....

I have yet to find a simple sample of a grid binding to a business object (like we used to be able to do in the .NET 1.1 Framework) using this new scheme they've hatched. I've tried to hold my tongue and not bash, but this one deserves bashing, whoever dreamed up this monstrosity obviously had no idea what was lost and no idea what object oriented programming or strongly typed programming is. Instead, they come up with update/delete/select methods that take IDictionary's. They must have been using a raw ADO.NET datatable with no foresight beyond that. In a way I feel sorry for them, they had nothing else to go by, they haven't created nor probably ever used a well written architecture like EntitySpaces or some of the others mentioned above.  And that leads me to my conclusion.

For Microsoft to say "We regret the loss of functionality in this scenario and we will certainly aim to provide similar functionality which is realizable and not error prone in future versions of Visual Studio" is disingenuous. Does anybody reading this believe Microsoft on this? The company that creates massive development teams just to release free products like Sql Ce couldn't get this minor issue to work in ASP.NET 2.0? One of their most important products?  Honestly, I'm appalled at this statement.

Could it be that ASP.NET design time support was dropped to allow Microsoft time to work on ADO.NET vNext while at the same time severely hampering those vendors who stood to gain a dominance in the very important ORM market, a market that Microsoft thus far is severely lacking a presence in? It will be interesting to see if by miracle this "loss of functionality" is restored in conjunction with the release of ADO.NET vNext. Perhaps there will be a new model released as what exists now is frankly, worse than nothing. My guess is a miracle is on the horizon.

posted on Thursday, March 08, 2007 1:16:42 AM (Eastern Standard Time, UTC-05:00)  #    Comments [10]
Thursday, March 08, 2007 4:06:44 AM (Eastern Standard Time, UTC-05:00)
It took me 2 months full time work to get our LLBLGenPro datasourcecontrols working. Paul Wilson's control is just a small thingy, if you want real design time support and REAL persistence logic support, you need a heck of a lot more code.

What's so sad is this:
- there's NO documentation whatsoever about what to do when and why in these datasourcecontrols. I've send a very lengthy email to Guthrie some time ago, he said they will improve it, but I doubt it will be soon.
- the designers of the classes necessary for design time stuff and datasourcecontrols have slept during the OO basics training courses. For example, if you want to provide the type data for the columns at design time: you _CANT_ do that if your types implement ICustomTypeDescriptor. This interface is hardcoded filtered out. So you have to implement these classes AGAIN as they didn'tmake them public with a virtual method to override. (apparently no-one would need those...)
One other big misery is their cache manager. THey use a fancy cache manager internally. Now, the 10,000 pop question: what's the accesability of that cache manager: internal or public? :)
Thursday, March 08, 2007 9:31:00 AM (Eastern Standard Time, UTC-05:00)
I agree with all of your comments Frans, what a tragedy this is. All I want to do is be able to allow our users pick which columns they want in their grids? That's it, but it's frankly near impossible. I'm telling you this isn't by accident, this is one of those things that draws near to being an anti-trust issue. It's not right and I feel unethical. Is this 20,000 person company so afraid of a few small ORM vendors that they have to hurt their entire development community to stave off the competition?
Thursday, March 08, 2007 10:03:51 AM (Eastern Standard Time, UTC-05:00)
Protectionism through obfuscation. Classic Microsoft.

Well said, Mike.
Thursday, March 08, 2007 3:51:18 PM (Eastern Standard Time, UTC-05:00)
Man. You nailed it.

But the problem is much deeper than that. ASP.NET 2.0 brought a huge shift that Microsoft doesn't want to talk about. Simply put they like XML and don't like code. I challenge anyone to show me how to wire up a 2 way databinding without using code. Where is the OnDataUnbound method in the object model?

I had a rather lengthy email thread with some key Microsoft people and the next result of that thread was "use markup. we'll handle it". They all but admitted on that thread (and I'm soooo tempted to publish it) that they intentionally dumbed down ASP.NET and broke alot of the object orientedness of the old model to attract more of the 'mort' [1] programming communinty. In short they shafted Einstein [1] and developed a leaky abstraction [2] on purpose in the name of market share.

And just where the hell is all the documentation on this databinding and designer stuff? In 1.1 at least Nikhil wrote a book that got into the dirty details of designers. Now, almost 2 years after the Whidbey API stabilized we still don't have any real documentation on who to write a good designer for ASP.NET 2.0 or how to roll a custom data source provider.

You are not the only one who is pissed about this.

[1] http://wesnerm.blogs.com/net_undocumented/2003/09/who_are_you_mor.html
[2] http://www.joelonsoftware.com/articles/LeakyAbstractions.html
Thursday, March 08, 2007 3:52:01 PM (Eastern Standard Time, UTC-05:00)
Simply put they like XML and don't like code. I challenge anyone to show me how to wire up a 2 way databinding without using code.

should read

Simply put they like XML and don't like code. I challenge anyone to show me how to wire up a 2 way databinding without using markup.
Thursday, March 08, 2007 9:50:35 PM (Eastern Standard Time, UTC-05:00)
Hahaha the whole declarative thing has been getting at me for a while. With great code tools such as Resharper - and indeed just the basic visual studio and codebehind - why do we suddenly want to use declarative markup for everything... its much easier to reuse and encapsulate and test code. The only reason I can see is that you're not meant to be using hand written code, they want us to use the designers which spew out markup... which simply promotes duplication and thus hinders maintenance. The declarative stuff should be visual, not behavioural, and funnily enough there's already this thing called xhtml for that. Just give me a Repeater control and let me be :)

If MS held back the designer functionality on purpose, its a disgrace - but that aside, I think we should be pushing back harder at microsoft to lead the Morts in the right direction as opposed to feeding their designer habit :)
Friday, March 09, 2007 8:16:35 AM (Eastern Standard Time, UTC-05:00)
Paul D. Murphy Said:
>Simply put they like XML and don't like code. I challenge anyone to show me how to wire up a 2 way databinding without using markup.

Unfortunately you can't. It appears that Bind() is actually a "keyword" that the ASP.NET compiler uses to build a method named ExtractValues. This method creates an ordered dictionary of all the Bind property names. This is passed in as a delegate to the CompiledBindableTemplateBuilder class. All of this code is generated at run-time.

The problem is that there is no easy way to get at this list, or to provide your own.

One of the drawbacks is that Bind() is very limited in what you can pass. It must be alphanumeric or underscore. That is why you can't use nested properties like Bind("Address.Street1").

I wrote an extender for ObjectDataSource that simulates nested properties using "_" instead of ".", so I would use Bind("Address_Street") and the extender converts it to the "." and uses reflection to get the value.

I like the declarative databinding, because it eliminates a lot of repetitive code. However, I wish it was more flexible and at least allowed you to get to the databinding collection via code.



Thursday, March 15, 2007 3:29:48 AM (Eastern Standard Time, UTC-05:00)
When creating our asp.net templates for GenWise Studio, it was not easy to get the object datasource to work with hierarchal object structures, but luckily it's possible and the good thing is that it's now much easier for our users.
Friday, March 16, 2007 9:55:41 AM (Eastern Standard Time, UTC-05:00)
* Data access architecture is no longer symmetrical between win forms and web forms
* (databindings) gone
* webcontrols and icomponents isolated
* ORM broken
* Hierarchical UI dataset usage broken
* Initially project structure was entirely removed from web development in VS2005
* Absolute positioning was removed

The impact was much wider than just targeting the ORM community. When I connect the dots they say:
* Provide developers with the best environment for building "smart" (or as we used to call them windows GUI) applications
* Provide developers with the best environment for building webparts for sharepoint and other "web site" software
* Cripple the ability of developers to build UI device agnostic applications or any reasonably sophisticated application architecture with a web based front end

There is an obscenity being performed against us, which somewhat irrationally brings to my mind images of a blow torch and pliers.
Peter Newby
Friday, March 16, 2007 10:21:57 AM (Eastern Standard Time, UTC-05:00)
I agree Peter, this all stinks way up the chain. To me, it feels wrong, illegal in nature, if not in law than at least in "sense of honor" if that even exists anymore. Microsoft has done all this as part of it's strategy to make sure nobody can dominate the market (because we are wasting so much time trying to recreate what they commented out) while they get the ADO.NET vNext / LINQ salvation plan in order. Microsoft's plan is total domination of the OS market, the Development Tools Market, and finally the Architure market (ORM's generate Architectures). Microsoft just put out a new VS2005 Service pack a week ago, did they work hard to restore this "commented out" functionality, not a chance. Why? we know why, the blog post makes that clear. EntitySpaces will not be phased by this, instead we march on. We will be there for those who want not only a better architecture, but are tired of being manipulated like this.

This is what is going to happen in my opinion. The .NET framework's Infrastructure will all be built around ADO.NET vNext. Whatever they are working on right now will become the "new way" and the .NET Framework API will reflect that in future versions. So, if you want to develop architectures you must make yours look like "ours" they'll say. Meanwhile, upon release of the new framework vNext will support everything out of the box. All their new crazy things that nobody can keep up with too it will support. So, everyone will be a year behind trying to recover and adapt while vNext is there, in full glory, supporting all these "new ways".

It makes me angry, but fuels the fire that burns late into the night, the kind of fire that when lit spreads in ...
Comments are closed.