12/30/2005

Issues with download / installation of Atlas December bits

Apparently there are some issues with getting the correct Microsoft.Web.Atlas.dll and other annoyances when downloading the December bits. Jonathan Hawkings has a good summary of what to do on the ASP.NET forums, and I reproduce it here:

It looks like there is a replication issue with the ASP.NET ‘Atlas’ December ’05 release family on MS Download Center (download.microsoft.com). The December bits were originally released with the October release family (a download center deployment term) and they suspect this lead to the October bits continuing to be downloaded. The download center folks have since re-release the ‘Atlas’ December bits with a new release family.

Please try the steps below to clear our prior ‘Atlas’ versions from the IE cache, VS project templates etc.


1. Make sure you are running ASP.NET 2.0 RTM, Visual Studio 2005 RTM or Visual Web Developer RTM … ASP.NET ‘Atlas’ will only run on the RTM releases. Beta2 will not work. If you don’t have a 2005 RTM release you can download the RTM release of Visual Web Developer from http://msdn.microsoft.com/vstudio/express/vwd/download/. Uninstall prior beta 2005 releases.


Verify your version numbers by choose Help -> About in Visual Studio 2005 / VWD

Microsoft Visual Studio 20005 8.0.50727.42

Microsoft .NET Framework 2.0.50727


Close Visual Studio / Visual Web Developer


2. Clear out your Internet Explorer cache

Internet Explorer -> Tools -> Internet Options -> Delete Files

Close Internet Explorer


3. Delete older releases of the ASP.NET ‘Atlas’ VSIs


Zip files

C:\Documents and Settings\username\My Documents\Visual Studio 2005\Templates\ProjectTemplates\Visual Web Developer\CSharp\ASPNETAtlasWebApplicationCS.zip
C:\Documents and Settings\username\My Documents\Visual Studio 2005\Templates\ProjectTemplates\Visual Web Developer\VisualBasic\ASPNETAtlasWebApplicationVB.zip


Directories

C:\Documents and Settings\username\Application Data\Microsoft\VisualStudio\8.0\ProjectTemplatesCache\Visual Web Developer\CSharp\ASPNETAtlasWebApplicationCS.zip
C:\Documents and Settings\username\Application Data\Microsoft\VisualStudio\8.0\ProjectTemplatesCache\Visual Web Developer\VisualBasic\ASPNETAtlasWebApplicationVB.zip


4. Start Internet Explorer and download the December VSI

a. Navigate to http://atlas.asp.net/ (which redirects to http://www.asp.net/default.aspx?tabindex=7&tabid=47)

b. Click the link “Atlas Blank Project VSI (December release)”

c. Click the link “VSI file for creating a blank ASP.NET "Atlas" Web site”

d. Click the link “I Accept” (the link should point to cfab4430-426d-4a04-954b-1acbf852e800/ASPNETAtlas.vsi )

e. Choose “Open”, Next, Finish, Close to install the December VSI



5. Start Visual Studio 2005 / Visual Web Developer 2005 and create a new ‘Atlas’ Web site

a. File -> New Web Site -> ASP.NET ‘Atlas’ Web Site

b. The Readme.txt should contain “Date: 12/19/2005” which is December 19, 2005.



6. Read the ASP.NET ‘Atlas’ Technology Preview December 2005 release summary change list at:

a. Navigate to http://weblogs.asp.net/atlas/archive/2005/12/22/433869.aspx

12/29/2005

Managed Code Speed vs UnManaged - and Rudolph.

Richard Grimes has a very recent piece here about comparisons between managed and unmanaged code.

He points out specifically: "The problem is that when most people think of .NET they think of other frameworks with a runtime, like Java or Visual Basic; or they may even think about interpreters. They do not think about applications, or what they do; they do not think about limiting factors like network or disk access; in short, they do not think.
.NET is not like those frameworks. It has been well though out and Microsoft has put a lot of effort in making it work well. In this article I will present some code that performs some computationally intensive operation and I will compile it as both managed C++ and unmanaged C++. Then I will measure how each of these libraries perform. As you will see, .NET is not automatically much slower than unmanaged code, indeed, in some cases it is much faster."
.

Grimes presents FFT (Fast Fourier Transform) sample code for Unmanaged, Managed C++, C++/CLI and C# Managed along with the respective high-performance timings. (I found it amusing looking at this because I wrote custom FFT code in Turbo Basic for my Ph.D. dissertation back in 1990!) . Grimes provides all the sample code in downloadable form.

The bottom line is that the results for C# code showed that there is little difference between C# and managed C++ in terms of performance. Indeed, the optimized C# library was actually slightly faster than the optimized managed C++ libraries.

You have to be very careful about the uninformed who are in a position of authority. They even populate the newsgroups. Who knows? One of them might even be your boss....


Only Rudolph the Red Nosed Reindeer really knows everything, and, wisely, he has nothing to say.

12/23/2005

SOA? Hey! How 'bout it? and Service Packs Too.

The world is abuzz with acronyms. One that's getting a bit overheated IMO is Service Oriented Architecture -- "SOA".

Why is it that architect - developer people get into this "Baffle 'em with Bullshit" mindset anyway? Let's keep it simple, folks! What is "SOA" anyway?

I prefer the simple definition:

"A service-oriented architecture is a collection of services that communicate with each other. The services are self-contained and do not depend on the context or state of the other service. They work within a distributed systems architecture."

Now that's pretty simple; it doesn't baffle us with high-falutin whitepaper B.S., and we feel better since most of us are already doing this kind of stuff anyway.

Note that it doesn't say "whose" system, or "what brand" or even what language / platform. SOA has been around for 20 years. The only real difference is that we have more interoperability in the form of XML / SOAP, that's why the buzzword. It seems these days that anything that uses SOAP / XML/ loosely-connected anything (even if it just "says" it uses it but doesn't even really do so) gets to be knighted as the latest "AJAX". (Actually I suggested "AHAB" - A lotta Hype And Bullshit.)

First we had the Gartner Gurus touting this stuff all over the place charging customers to advise them on this next "big software strategy". Then the Microsoft Maharishis got ahold of it and found themselves a new Mantra. They said that the "A" in SOA shouldn't be there, because it wasn't about "Architecture". Now they are happy with the "A" and they've got a new mantra, but it's still the same Whitepaper B.S.

The first service-oriented architecture for many Windows platform developers in the past was with the use of DCOM.

You guys need to climb down off those ivory towers and just get down to the basics that any of us with average intelligence can easily understand. When it gets to start sounding like some sort of new "religion", and there are more whitepapers on it than there are code samples, you know you've gone too far. I got one for ya:

SANTA:
Service Architecture Networked To Administrivia

"Things should be made as simple as possible, but no simpler." -- Albert Einstein

Einstein, a German immigrant who didn't even speak English as his native language, did a pretty good job of keeping it simple for the "folks".


On a slightly different note, I read Scott Wiltamuth's post about the upcoming Service Packs for VS.NET 2003 and VS.NET 2005. The post itself is short and basically just informational. What's revealing is the list of comments! Besides the usual anti-MS drivel, there are some very interesting suggestions and ideas. Interestingly, I didn't see a single response to any of the long list of comments by Mr. Wiltamuth.

Hope you guys are listening out there in Redmond.

12/21/2005

Intelligent. But, by Design?

A couple of people had an interesting conversation today. It went something like so:

A: If a theory is presented as a theory, what is the harm in teaching it? The "theory" of evolution is taught. How is teaching Christian kids the theory of evolution ok but teaching the theory of intelligent design to non christian kids not ok?

B: The theory of evolution is based on science. Einstein's theory of relativity was based on science, even though it took 51 years for it to be fully proven.
Intelligent design is not based on science, it's based on the supernatural, which is not science, but religion. Astrology is based on the supernatural, not science.
I'll defend Christian kids' right to learn about Intelligent design in church 100%, but not in the public school biology classroom.

A: I went and read up on that case. They weren't simply asking to teach it in addition to Darwin, they wanted it to be a replacement for. It also appeared to be against a vast majority of the parents in that district.

Certainly don't think that is a good idea. That said, if the school district and the parents wanted both taught as "theories" and not as scientific law, they should be allowed to do so. Nothing wrong with Darwin believes x and uses y to support his theory, some Christians believe a and use b to support their theory, Hindus believe e and use f to support their theory. And so on...

Just gives kids an awareness of these types of things...Presentation would, of course, be the key which could be an opportunity for abuse just like anything else.

B: Think I understand your point quite well. Here is the problem as I see it:

Conflict between science and religion began well before Charles Darwin published Origin of the Species.

Evolution is not considered to be inconsistent with the religious beliefs of most Christians or Jews. Most mainline Protestant denominations, the Catholic Church, and many other religious faiths accept the teaching of evolution. The Pope even accepts the view of evolution! Religious theorists since St. Augustine espoused the separation of Church and State, which is written into our Constitution.

Intelligent Design is not a scientific theory, which if it were, would allow it to be taught in the public schools alongside Evolution theory, which is based on science. Intelligent design, in my view, is basically somebody doing a global "Search and replace" on the word Creationism with the phrase "Intelligent Design". If ID were permitted to be taught in the public schools, contrary to our Federal Law, this is what would happen:

People like me would come in and say, "School Board? I am writing you after having read of your hearing to decide whether the alternative theory of Intelligent Design should be taught along with the theory of Evolution. We can all agree that it is important for students to hear multiple viewpoints so they can choose for themselves the theory that makes the most sense to them. I am concerned, however, that students will only hear one theory of Intelligent Design.

Let us remember that there are multiple theories of Intelligent Design. I and many others around the world are of the strong belief that the universe was created by a Flying Spaghetti Monster. It was He who created all that we see and all that we feel. We feel strongly that the overwhelming scientific evidence pointing towards evolutionary processes is nothing but a coincidence, put in place by Him.

It is for this reason that I'm writing you today, to formally request that this alternative theory be taught in your schools, along with the other two theories. In fact, if you do not agree to do this, we will be forced to proceed with legal action. I'm sure you see where we are coming from. If the Intelligent Design theory is not based on faith, but instead another scientific theory, as is claimed, then you must also allow our theory to be taught, as it is also based on science."

You get the picture? We open up the public school system to this kind of motive, and it all goes to "Hell in a legal handbasket" pretty quickly.


It is so easy to be misled or even "preached" into the inane belief that what you are doing is "right", rather than independently thinking carefully about it first. Maybe Judge Jones did us all a favor with his 139 page decision and assertion that several Board members had repeatedly lied to cover their motives even while professing religious beliefs. There's nothing wrong with teaching the Intelligent Design Theory, the Flying Spaghetti Monster or the Creationism theory to your kids, if that's what you believe. Just do it in Church or Synagogue where it belongs.

Teach your kids to understand that religion and science are complementary, but different, and both of them are important in order to develop a good perspective and an adult mind as you grow up. Just understand why they are different and should not be mixed. A lot of blood was spilled in Europe over conflicts between science and religion before our forefathers came here and decided, among other good things, to put a stop to it.

Oh, and, by the way: Judge Jones was appointed to the bench by George Bush.

Who's got the Balls? NYC Transit strike off to a bad start.

I grew up in NYC. It's a tough town. Tough people, but they can also be very nice.

One good thing I learned in NY is how to drive. You stick your nose out into traffic until somebody chickens out. Problem is, here in Florida they don't get that this is just etiquette, and they shoot you, or at least try to run you off the road! Idiots!

Now look, transit strikes are illegal. In New York State, they have the Taylor Law, which unequivocally makes public transit strikes illegal.

The City of New York went and got a court injunction against the union, barring them from going on strike. A judge fined them a million a day. And yet, after all this, Roger Toussaint, the president of the Transit Workers Union, had the unmitigated gall to stand up at a rally and yell to the crowd, "If Mayor Bloomberg wants to know what we think about this lawsuit, I'll show you," and he tore up the legal papers in front of them.

If the Transit Workers Union defies a court injunction, breaks the law, and goes out on strike anyway, they need to GET FIRED, dood!

Ronald Reagan did this in 1981 to the air traffic controllers, and that worked out just fine. The air traffic controllers had gone out on an illegal strike, and Reagan gave them 48 hours to get back to work or be fired. Many of them thought Reagan was bluffing, and they found out the hard way he wasn't. But, Ronald Reagan had Real Balls. Michael Bloomberg is just a pussy.

It's a lot harder to replace an air traffic controller than it is to replace a subway operator. Why can't Michael Bloomberg summon up the BALLS to fire the illegally striking transit workers in 2005? Why? Because he's a PUSSY.

He should have fired them immediately, and not even given them an option of coming back to work. But, he screwed up.

Anybody with an above room - temperature IQ could figure this game out. Bloomberg, you lost pal!

12/17/2005

Visual Studio 2005 Web Application Project Preview Available

Scott Guthrie has posted a mini-site with a download of the new Web Application Project "add-in" (the one that makes VS.NET 2005 act like VS.NET 2003 for ASP.NET Applications).
The site is here..


At this point there is a C# Tutorial ready (link on the same page as above) and a VB.NET tutorial should be ready shortly.

I'm going to spend a short amount of time on this and post some more, because I think it is an important step, er (forward?, or perhaps backward?).

Scott informs on his blog that "This preview is not a feature-complete version of the functionality. There are several important features that are not yet implemented, as well as a set of bugs that are currently active", and that "Our goal with putting this first release out is to get early feedback from the community, as well as to provide a core feature-set that enables some developers to start using this project model option immediately (with workarounds for the missing functionality which will come online in later refreshes).".

Here is a link to the tutorials page if you want to RTFM first (recommended...).


The key feature for developers to be aware of with this new ("old") option is that with the VS 2005 Web Application project model, the design-time partial class is generated and persisted on disk by VS 2005. This new design-time partial-class file has the filename naming pattern: PageName.aspx.designer.cs. If you expand any new page created within your VS 2005 Web Application project, you can see this file listed under the associated Page.aspx file along with the developer-owned code-behind file.

So the partial -class arrangement for a tool-generated/maintained file that contains the protected control field declarations and the other design-time code that Visual Studio requires is maintained (a good thing).

One other caveat that you will discover by practicing good "RTFM" techniques:

In this first preview release of the VS 2005 Web Application Project download, the feature support to automatically update .designer.cs files is not yet implemented. Appropriate .designer.cs files are generated when you add new pages, but you will be required to manually add and update the control declarations contained within them to get intellisense and compilation support within your code-behind files.

Finally, developers will be able to create re-usable libraries of user-controls that are potentially referenced and pulled-in from multiple web projects. This provides additional re-use flexibility with large-scale web-projects, and with VS 2005 Web Application Projects is now easier than it was with VS 2003. For those who've been screaming bloody murder about this issue with the RTM release of Visual Studio 2005, you can now look forward to the "Dot Net Nuke" nuclear option!

Kudos to Mr. Guthrie and his team for delivering this nice present before Christmas so that we all can get used to it during some vacation time!

BTW, if you are one of those Geeks who think Active Directory is for weenies, have a look at the drink attribute.

12/16/2005

CNN Reports Computers have decoded Mona Lisa Smile

Scientists analyzed the portrait of the Mona Lisa, a woman with famously mixed emotions, hoping to unlock her smile.

They applied emotion recognition software that measures a person's mood by examining features such as the curve of the lips and the crinkles around the eyes.

The findings? Mona Lisa was 83 percent happy, 9 percent disgusted, 6 percent fearful, and 2 percent angry, according to the British weekly "New Scientist."

They also found out that she likes Fajita Burritos from Chipotle Grill, drives a Lamborghini, and likes to wear push-up designer bras by Verdissima.

As can be seen here in the after-scan photo, Ms. Lisa did not take kindly to being "scanned". Many people are not aware that Mona was also an expert object - oriented programmer. The only problem is, nobody has ever been able to find her code...

Ain't technology grand?

12/15/2005

GAT (Guidance Automation Toolkit) Takes Life!

Back at the MVP Summit in Redmond in late September, I had a chance to talk at some length with my buddy and fellow MVP Daniel Cazzulino.

Daniel was up to his eyeballs in the GAT, along with Victor Aprea and a bunch of other contract people working out of the Redmond campus. I asked a lot of questions, and Daniel and Victor responded, and at that time, since i realized GAT really hadn't been "born" yet, I kind of "tucked it away" in my head for later.

Well, I'm happy to reveal that it's born, and developers should take note.

GAT is a first, but a very big step into extensions to Visual Studio 2005 that allows architects to author integrated user experiences for reusable assets that include frameworks, components and patterns. The resulting Guidance Packages are composed of templates, wizards and what they call "recipes" (it ain't Martha Stewart, folks), that can help developers build solutions in a way consistent with the architecture guidance and best practices.

If you look at the "history of GAT" on Wojtek's blog, you can get a much better feel for the heavyweight people who have helped to guide it in the right direction.

You can download the bits from the VS.NET Team System Development Center right now and start working with this excellent piece of work.

They came up with an extremely cool invocation layer, and if you are into best practices Patterns and Practices stuff, you will really like this bundle of work.

It has it's own MSDN Forum, and there are lots of resources available. So, check it out!




12/14/2005

Windows Update: The Frying Pan, or The Fire?

I came into the office this morning and my machine had been rebooted.

"OK", I thought, and I looked in Event Viewer, and sure enough, at 3:00 AM just as expected, there had been some WIndows Updates installed.

Then the bad news came. I brought up Internet Explorer and when I clicked on a link in my Favorites or tried to enter an address in the Address Bar, IE would freeze. The only way to kill it was to go into Task Mgr and kill the IExplore.exe process.

At first I didn't think that a Microsoft update could have done this. So, I tried all the "Fixes" from the MVP Internet Explorer site and a couple of others. No dice. I had to use Firefox to go look for the fixes!

To make a long story short, after a couple of frustrating hours and no relief, I did what any intelligent developer would do. I booted off the Windows XP CD, went through the entire installation sequence to the point where it identified my existing Windows XP installation, and chose the (R) repair option. What this does is to completely reinstall the OS, but it leaves your Software and other Registry hives intact.

When I rebooted the machine, Internet Explorer was fixed.

Then, I installed Service Pack 2. After I rebooted, Internet Explorer was fine. Remember, I still had only the slightest suspicion that one of the Windows Updates that were installed the previous evening was suspect. After all, this is Microsoft, which is now so quality and security conscious, these updates HAD to have been well tested, right?

At this point, out of "best practices" habit, I made a complete Registry Backup with ERUNT. I figured, if something went wrong with updates, this might help.

Then, I went to Microsoft Update like a responsible computer user and it downloaded and installed Thirty One (I counted them!) - 31 updates that have been published since SP2 came out.

When I rebooted the machine, you guessed it. Internet Explorer was broken again. Restoring my Registry backup didn't help - it was obviously a replacement file - MSHTML.DLL, UrlMon.dll, Shdocvw.dll, or some other.

I also uninstalled EVERY SINGLE ONE of the windows updates where I could find an spUninst.exe in the windows folder. Still no relief!

Folks, that's it for me. I'd rather have some exposure to security risks than have to spend the better part of a full business day coping with this inferior shit! So tomorrow morning, I have to go through this process all over again, with one exception:

NO UPDATES!



You can BET I won't be visiting Windows Update after reinstalling Windows XP and Service Pack 2! When you folks can prove to me that you will only put out stuff that's guranteed not to screw up my productive business day, then maybe I'll reconsider.

I am not writing this entry to hold myself out as a paladin of breaking the carapace of some sullen corporate bureaucracy, but rather to enlighten others who might become inured to the comforts of a service which may, due to their lassitude, provide them with a false sense of confidence in its ability to achieve its stated aims.

Put more simply, I'm not knocking Microsoft, just warning that "security" is only really useful to us when it doesn't break our STUFF! There is already some early newsgroup posting that indicates the culprit is KB905915. .

Here's a search for example. I counted 57 posts last time I checked.

Maybe those MS Security Patch guys ought to read this here piece on Agile Bridge Building Technology.

UPDATE, 12/7/2005: Finally, there is at least one fix available here.





12/07/2005

Binary XML with your SOAP, Dear?

Yup. They're finally getting around to it. W3C has its first set of Recommendations around the Binary XOP concept, which essentially takes the XML InfoSet and provides a standardized binary format encoding set of rules.

Of course a lot of people are unhappy with how XML has evolved and with the involvement of organizations like the W3C. The fact remains that even though the transport cost of textual XML is untenable for a lot of devices, the cost of parsing of text-XML completely overshadows it.

By having a BinaryXML standard, we would see XML adoption in areas where its use is not currently widespread and we would see increased communications over what we have today. This would be good for all of us.

The only problem is, it needs to be "a" standard, not "twenty different" standards. I remember being on the SOAP list back in 2000. Dave Winer, Don Box and other luminaries did a lot of arguing and crying. But, they eventually gave birth, and it was "One SOAP". Hope the BinaryXML doods achieve the same!

On another note, there has been a lot of positive stuff about the new "Visual Studio Deployment Projects" add-in. It solves a lot of issues, even though it still doesn't solve development issues revolving around things like ASPX user controls. I just noticed that my buddy and fellow MVP Rick Strahl has updated his freebie "ASP.NET Compiler Utility" to include taking advantage of the ASPNET_MERGE.EXE utility that's packaged with it.

Rick, I don't know where you find the energy to keep putting out all this great stuff, but we love it, man!


Will the Wonders Never Cease Department: Is Santa really coming to town?


And on this same subject, apparently "Mr. ASP.NET" himself has just posted news about a completely new Web Project System for ASP.NET 2.0 that will "put back" a lot of the cool stuff developers grew to know and love in ASP.NET 1.1. You can read up on it here, it looks like there will be a preview in a couple of weeks (by XMas? doubt it).

Of all the MS Project Managers I've come into contact with, Scott Guthrie really deserves kudos for going out of his way, sometimes tirelessly, to "tell the little people" what's going on, listen to their gripes, and keep them informed on his blog. One time when I UnBlogged about my disappointment with some web stress test results in the then BETA ASP.NET 2.0 based on information in an MSDN article that was somewhat "ambitious", Scott contacted me on his own and made sure I had all the bells and whistles I needed to ensure that my tests were "OK". Never once did he attempt to "defend" the product - his sole aim was to help me and listen to my feedback.


Wishing you a pleasant holiday season, and I hope you survive the XBOX Famine.


Electronic Trading Heaven for top Software Vendor?

With this week's NYSE merger with electronic market operator Archipelago, the New York Stock Exchange has instantly become the world's top publicly listed stock exchange - and made a decisive plunge into electronic trading.

They used a reverse-IPO listing process - Archipelago, whose stockholders now own 30 per cent of the combined $10 billion entity, was already a public company.

Although 99 per cent of Big Board orders reach the NYSE electronically, only about 14 per cent are settled electronically. The remaining 86 per cent are executed using a technologically-updated, but still very recognizable version of the face-to-face trading floor that, in one form or another, has been used by the NYSE throughout its 213-year history.

I know how archaic it is - as a rookie broker for Merrill Lynch, they let us on the NYSE Trading Floor one day right after the close during broker training school. There's paper everywhere, people yelling and bumping into each other, and you literally have the potential for big-time errors to occur.

Specialists still manually match up buyers and sellers, and must still use their own funds to provide liquidity to particular stocks at different points during the day.

The Nasdaq now trades as many shares each day as the NYSE - even though the $20 trillion market value of the firms on the latter is five times the value of firms on the Nasdaq. This is mostly because electronic posting and settlement is cheaper, faster and less error-prone. All you have to think about is the fact that you can place a NASDAQ GTC limit order with Ameritrade (or any other other electronic broker) and get automatically notified by email, even if its on a $1.00 stock.

And it's all done electronically, virtually flawless, never touched by human hands. All done by software written by developers like you and me.

The notional value of stock in the new NYSE Group has tripled this year, and may well perform less spectacularly in the near term. Some analysts are even predicting a solid decline, as old-school members take advantage of access to the liquidity of public markets and the recent run-up in the industry's fortunes, and sell.

There's one definite winner in this: the software vendors who specialize in the electronic trading and settlement software that the new giant will undoubtedly need to implenent if it expects to compete.

12/06/2005

Limitations of Polymorphic Behavior with Generics vs. Interfaces

Steve Michelotti exposes an interesting limitation of polymorphism with Generics:

In .NET 2.0, Generics is clearly the single most important language enhancement. However, to use generics to the full potential, developers should understand both the capabilities and limitations of generics as they relate specifically to polymorphism. In short, while generics do support some polymorphic behavior, the use of Interfaces should still be the preferred polymorphic mechanism in many cases.

Here's my code take on this, as a little "exercise". This is pretty "linear" so it should be fairly easy to follow. The actual demo "test" code lines are in the "class program". You can paste this into a VS.NET 2005 Console app if you want to play around with it by uncommenting some lines:


using System;
using System.Collections.Generic;
using System.Text;

namespace GenericVsInterface
{

public abstract class Developer
{
public string FirstName;
public string LastName;
public void WriteCode()
{
}
}

class CSharpDeveloper : Developer
{
public int NumLinesOfCodeWritten=0;
}

class VBNetDeveloper : Developer
{
public int NumLinesOfCodeWritten=0;
}

//Since both CSharpDeveloper and VBNetDeveloper inherit from Developer
//, the above compiles.
//With constraints we can define generic sub-classes:
class DeveloperAction<T> where T : Developer
{
public void DoAction(T item)
{
}
}

interface IAction
{
void DoAction(Developer item);
}

//And we'll change DeveloperAction to:
class DeveloperAction2<T> : IAction where T : Developer
{
public void DoAction(T item) { }
public void DoAction(Developer item)
{ this.DoAction((T)item); }
}



class Program
{
static
void
Main(string[] args)
{

//Using System.Collections.Generics.List<>, one could consume it like this:
List<Developer> list = new List<Developer>();

list.Add(new CSharpDeveloper());
list.Add(new VBNetDeveloper());

//As the example above, we can consume like this:
DeveloperAction<Developer> DeveloperAction =
new DeveloperAction<Developer>();
DeveloperAction.DoAction(new CSharpDeveloper());
DeveloperAction.DoAction(new VBNetDeveloper());

DeveloperAction<CSharpDeveloper> codeAction =
new DeveloperAction<CSharpDeveloper>();
codeAction.DoAction(new CSharpDeveloper());

// next line does not compile because of constraint:
// codeAction.DoAction(new VBNetDeveloper());
//However, if we try to push generic polymorphic behavior one step further,
// this is where things stop:
List<DeveloperAction<Developer>> DeveloperActionList =
new List<DeveloperAction<Developer>>();

// next does not compile:
// DeveloperActionList.Add(new DeveloperAction<CSharpDeveloper>());
// Next line does not compile:
// DeveloperActionList.Add(new DeveloperAction<VBNetDeveloper>());
// But now, using the interface we can get polymorphic behavior with generic classes:
List<IAction> developerActionList2 = new List<IAction>();
developerActionList2.Add(new DeveloperAction2<CSharpDeveloper>());
developerActionList2.Add(new DeveloperAction2<VBNetDeveloper >());
}
}
}


The key point is that a generic class is a type itself. The compiler doesn't care about CSharpDeveloper vs Developer, it cares about DeveloperAction vs DeveloperAction. In other words, it needs a relationship between the two DeveloperAction types, not the generic type parameters that created them.

One way to express this:

abstract class DeveloperAction
{
}

class DeveloperAction : DeveloperAction where T : Developer
{
public void DoAction(T item) { }
}
List DeveloperActionList = new List();

In order to get this to compile, we had to use a NON-generic class. And with that you get no polymorphic behavior - the abstract DeveloperAction class has no methods. In this case, there'd be no way to get at the DoAction() method without casting. That's the difference in polymorphism with generic versus non-generic classes.

The lesson learned is simple: You can get real, usable polymorphic behavior plus the benefits of Generics, provided you stick to your old friend, the interface.

12/05/2005

Kudos to GotDotNet Team: VS.NET SCC Workspaces Provider and FIX for switching!

They've been making improvements over at gotdotnet.com, not the least of which is their new SCC plugin to use the GotDotNet Workspaces source control arrangement. Not only does it work very nicely in VS.NET 2005, it also works with VS.NET 2003!

It's just like working in VSS; the only difference is that since you are working via WebServices, it's a bit slower. But everything works! Really a boon to developers who like the Gotdotnet Workspaces concept and have small groups of developers who work together on a project.

The only downside is that when you want to get a project out of your regular VSS provider, IIT BREAKS and doesn't work!


But there are several fixes, the best one I've found is Soenke Schau's Sourcecode Control Switcher.

This little tray app tells you your current provider and let's you switch at will by changing the Registry entries for you. And, you don't need to leave it running. Just put a shortcut to the desktop and bring it up when you need it.

Cool!

12/02/2005

Serializing a Dictionary: Pictures Better than code

As an aside to my recent link about how to fold a T-Shirt, I present for your viewing pleasure the official tutorial on how to Serialize a Dictionary:




BTW, I don't usually do the "Me Too!" mentality thing of linking to other people's blogs since it tends to just muck-up the blogosphere. In this case Brian Johnston has a very funny and revealing poke at the JAVA vs. .NET space here. If you work with Microsoft technology for a living, maybe its time to just count your blessings... (Sorry like so many good things, apparently this went bye-bye. Thanks to Mr. Anonymous Coward commenter who brought it to my attention.).

12/01/2005

Visual Studio.NET 2005: We will sell no wine -- before its time?

Recently we got a frustrated post from somebody on our eggheadcafe.com forums to the effect that "VS2005 is a Piece of Garbage and is bug Ridden" -- rant, rant..

After I got over the initial amusement, I went back to the MS C# newsgroup and noticed the same guy was stirring it up over there too. In fact, a few people did chime in about their own problems. And, to be fair, at least a couple more chimed in with their happiness and warm fuzzy success stories.

I mean, look. Everybody agrees this was an extremely ambitious release. And lots of people accused Microsoft of pushing it out the door too soon; these complaints started way before RTM.

This particular developer was attempting to preserve work he had done in 2003 with SqlDataAdapter by bringing it onto the Component Designer from the Toolbox (its not even in the default list, they want you to use the new SqlDataSource - which is actually quite cool). So he had a legitimate beef, although I think it's really kind of overkill to say that the whole product sucks on the basis of a rather narrow and inflexible project framework version conversion demand.

But at this point, I have to agree that they did rush it out. It's a wonderful piece of work, but It has BUGS man! I mean, Visual Studio 2003 has been out for three years and we will only see the first Service Pack next year! I put one in LadyBug back in August, they said it would be fixed by RTM and it's not. I had to reopen the item and remind them, and I still haven't seen any response.

Have you ever gotten the disappearing IDE bug? I've had it happen a couple of times. You're working on something and you start to type an opening brace or something and -- POOF! It takes off at Warp 9 and man that whole sucker is just GONE!

It's like it was never there! No trace of it ever having been loaded! Scary, man!

It reminds me of that old wine commercial with Orson Welles "We will sell no wine . . . before its time." I bet he never drank an ounce of that rotgut.


Would that it were true though . . .