This post originated from an RSS feed registered with .NET Buzz
by Eric Gunnerson.
Original Post: PM Duties Episode IV: The template strikes back...
Feed Title: Eric Gunnerson's C# Compendium
Feed URL: /msdnerror.htm?aspxerrorpath=/ericgu/Rss.aspx
Feed Description: Eric comments on C#, programming and dotnet in general, and the aerodynamic characteristics of the red-nosed flying squirrel of the Lesser Antilles
One of the things I own for the C# team is the project system. For this, I'm what's
known as a relationship PM, which means that I'm responsible for
something but there's no C# team that does project system work. My job is to figure
out what the C# user needs and drive them to the VS Core project team.
There are lots of good things coming, most of which I can't talk about until PDC.
One thing I can talk about is the C# project templates, which control what you get
when you create a new project or add a new item to an existing project. So, I've been
looking at what code you get, and deciding how to change it.
Here's the VS 2003 version of a console application:
using System;
namespace ConsoleApplication1
{
///
/// Summary description for Class1. ///
class Class1 { ///
/// The main entry point for the application. ///
[STAThread] static void Main(string[] args) { // // TODO: Add code to start application
here // } } }
There's a lot of cruft in
that template. Here are my notes:
The namespace provides little utility at all, as you never refer to this class from
outside.
The XML comment for Class1 is useless, for the same reason.
Why "Class1"? How descriptive is that?
The XML comment on Main isn't useful, because Main is private and can't be called.
The XML comment on Main provides no useful information. If you don't know that Main()
is the entry point for an app, then you aren't going to be helped by the comment.
The command line args aren't used by most apps.
The TODO comment is really, really useless. It's mind-blowingly useless, like the
directions that are on toothpick boxes, or the label on my blow dryer that warns me
not to use it when sleeping. I'm trying to picture the scenario. There I am, working
on my console application, and it doesn't work. I'm perplexed. What should I do? Do
I need to run the debugger? Should I call a co-worker over? Maybe I'll check the task-list
first. Oh, here's a TODO comment, and it says that I need to write some CODE to
make my application work. Thanks, Visual Studio.
Here's the Whidbey version:
using System;
class Program
{
static void Main()
{
}
}
It's just a tiny bit cleaner.
I'm making similar changes to the other templates, get rid of useless comments and
just generally simplifying things. Windows Forms projects will now use partial classes,
with the user code in one file and the designer code in another file.
Note that these changes will not be present in the PDC bits, but
will show up in the beta.