Welcome to another issue of the Newsletter. The conference is only two days old, but the brainwashing repetition has begun. Since I will try to avoid repeating information, the only manifestation you will see is that this newsletter should be noticeably shorter than yesterday. Then again, I might go on a rant and make up the difference myself - you'll just have to read the whole thing to see for yourself. A special welcome to our 4 new subscribers. If any references to previous topics leave you lost, you can check out previous issues in the STCTM public folder.

Errata

BS from NY pointed out that I inadvertently typed UML in place of XML in two places in yesterdays issue. Go figure.

Barbarians at the Gates

This morning's general session was highlighted by an appearance by Bill Gates. Since I figured this might have the least amount of actual content of any session, I skipped it and did a little work in the room. Since Plural and Bill Gates (wow - that types a lot like Bill Gaut - coincidence?) had crossed paths in the flimsiest of ways the night before, I decided I could fill in this section with an anecdote about last night. Last night was the official Exhibit Hall reception, where developers making salaries way above those of the average American fight the crowds and stand in line to get free stuff like 14 cent frisbees and 6 cent rubber bouncy balls (I got a free box of Altoid mints and a CD case...hee hee). About 8 of us were standing beside the Plural booth chatting when who walked by but the big man himself (actually, he's not so big, I think I could take him). He was pretty much by himself, there was one person noticeably accompanying him (I don't know if there were others less obvious hanging around). Then this guy (not from Plural) comes up and starts talking to him very animatedly. Mr Gates carried on quite a lengthy conversation while we all tried to think of how we could go up and meet him or get him actually into the booth for a picture. Then we realized that no one had a camera, so we went back to drinking beer and staring at him openly. Finally Ronan gave in to curiosity and went over to stand by the pair to see what they were talking about (they were literally within about 4 feet of all of us). The whole time people were wandering right by in their quest for cheap plastic crap without even noticing him. One guy even bumped with his back pack (I hate those guys - there's always a couple of them on every flight I take). Anyway, back to the conversation. It finally broke up and Bill moved on, with the crowd figuring it out at this point and starting to gather. According to Ronan, the guy's company had a lot of code written in VB 3.0 and wasn't going to be able to take advantage of all this .NET stuff and wanted to know if Microsoft was planning anything to help them out. Bill was very gracious for quite some time until he finally said (paraphrased), "Hey, we wrote that stuff 8 years ago, gimme a break!" Let's look at the effect of this guy on the GNP. Bill Gates has worked for Microsoft about 22 years and is up to about 400 billion dollars in personal stock (stop that, the number is close enough for entertainment purposes). Assuming he works a 60 hour week for each of the 22 years, that makes his time worth around $100,000 a minute. That means this ten minute conversation took about $1,000,000 of Bill Gates time - time he could have spent trying to get his hands on an Avanade Systems Frisbee.

What I forgot about Bill's morning keynotes is that his speech is not what you go to see - you go to see all the videos that have been professionally produced that they show before the speech. Word back from people who went is these were even funnier than the recreation of the Volkswagen commercial in 1998. I will just give you the highlights that I heard about-

  • One section with Bill Gates as Austin Powers and Steve Ballmer as Dr. Evil ("I put the sin in Syntax, Baby")
  • A McLaughlin group sketch featuring John McLaughlin, Diane Sawyer, Tom Brokaw and others
  • Bill and Warren Buffett in front of Judge Judy to settle a $2 bridge bet

If you have never seen one of these Gates videos, they are always extremely well done, must cost a fortune and must be an incredible hoot to be a part of.

As much as I would like to go on rambling about whatever interests me, I'm sure that some of you probably would like to read about what went on in the sessions. Today consisted mainly of smaller breakout sessions where you chose a topic you wanted to learn about from about 6 at any given time during the day. I will tell you about the ones that I went to, plus try to get some input from other attendees if there are any I can't get to that seem particularly pertinent.

Architectural Overview of the .NET Framework

I figured this was going to show us what was going on inside of the .NET framework, but it concentrated on the features provided by the Common Language Runtime. As such there was a lot of repetition from yesterday, but a couple of good nuggets anyway.

  • They reiterated the goals (more reuse, less plumbing code in applications, etc.)
  • The Common Language Runtime is tightly integrated to each language
  • Simpler deployment

One thing they went over in a little more detail was security. Security is what they are calling Evidence based - privileges - based not just on the user of the process, but the code being loaded. Code from strange places has to have security information associated with it. Also, code that is already on your machine can query if every node on the call stack has the proper privileges before executing its functionality on their behalf. This means that ILoveYou would not have been executed because even though the Outlook user had privileges, the code would not have been approved to run. And if the code had tried to execute some component that was already on your machine that did have privileges, the component would have figured out that the virus didn't have the privileges to call its methods and refused.

Learned a little more about versioning (yeah, I know, it's really hard to get excited about versioning). When you compile a component, the version of each referenced component is stored in the metadata. Then, if a new version is copied onto the machine, the correct version is still used thanks to the metadata. This behavior can be overridden administratively, causing the latest version of the dependency to be loaded no matter what.

Learned a lot more about metadata (program information stored along with the executable module). It is not stored in XML format as discussed yesterday, but in binary format. It is convertible to and from XML as well as to and from a COM type library. Here's a list of stuff stored in it-

  • Description of the deployment unit (the EXE or DLL - called the assembly) -Name, version, culture[, public key]
    -What types are exported
    -Dependencies
    -Security permissions needed
  • Description of types -Name, visibility, base class, interfaces implemented
    -members
  • Custom Attributes -User defined
    -Compiler defined (i.e. the const operator in C++ is not support by CLR, but can be indicated through a compiler defined custom attribute)
    -Framework defined

Metadata is used debuggers, profilers, proxy generators, serialization (ie SOAP) and more.

An Assembly is the packaged unit (one or more EXEs or DLLs). Security permissions are granted on an Assembly basis.

What's New in Visual C++ .NET

This class started out showing features in a C# environment without clear explanation of what crossed over to C++ and what didn't. I think most of these were IDE features and will transfer over, but I will still mark these items with C#.

  • Windows can be configured to disappear when not being used, similar to the toolbar at the bottom of the windows desktop
  • Change the name of a class in a Properties window and it is changed everywhere in the code (this would normally require search and replace through multiple files)
  • C# - Syntax errors are marked, before compilation, with a red underline, like a misspelled word in Word
  • C# - type '///' above a method definition and an XML formatted comment block, including arguments, will appear for the method. This is stripped out by the compiler to make an XML based documentation file for the component. This information is also used in the tooltips for intellisense, showing a description of a function as well as a name. The argument documentation shows up in the autocomple intellisense as well.
  • C# - Code can be collapsed, outline style, so just the function definitions show. These can then be espanded one at a time or all at once.
  • C# - There is a language context for MSDN help, so if you are in C++ and ask for help on String, you won't see all the VB String functions, just the C++ ones.
  • Help is constantly available for highlighted values in a dynamic help window.
  • Errors messages are formatted better and have much better information. Really.
  • The clipboard becomes a stack, where multiple copied values can be iterated through on paste.
  • There's better MFC/ATL integration
  • There's a command window in the debugger to enter real time commands

There are extensions to the language that are the pathway to .NET. These include new keywords (prefaced with __) and attribute programming. Code written and compiled to take advantage of CLR is called managed code. There are 3 options for migrating to managed code-

  1. Recompile the entire assembly with the CLR options turned on
  2. Mix managed code and native in a single EXE or DLL
  3. Make classes managed one at a time
Introduction to C#

C# seems to be causing a real buzz this week. Microsoft claims that the .NET platform contains millions of lines of C# code. The C# sessions are all being held in the main hall. Here are the checkbox features that were covered in this session, afterward I discuss some of the more complex issues-

  • C# supports only single inheritance, multi-inheritance syntax is supported, but only for interfaces - the interfaces must then be implemented in the class
  • Structs are stored inline only (on stack), don't allow inheritance and automatically implement a copy constructor. This makes them ideal for small data structures since they require no garbage collection and make more efficient use of memory.
  • Access directives include all C++ (private, public and protected), plus internal - which allows access from any code in the Assembly
  • All types are based on the CLR types. Pre-defined types are really alias's for CLR types, ie int = System.Int32
  • All IDL, pragma, .DEF files, etc are all done with Attributes
  • You can iterate through arrays with the foreach keyword
  • A feature call parameter arrays provides the functionality of var args in a type safe manner. It looks like it isn't as efficient as the C/C++ way, but it's A LOT easier

There are three features of the language that deserve special mention - Events, Indexers and Unsafe Code.

Events

Events are integrated into the language - giving me the impression that they wrap around COM events so we don't have to worry about those if we use C#. First you define the event signature, using a function prototype. Then write the code in the class that triggers the event. Finally, write the code in the client class that handles the event. Here's an example-

Define the signature-

public delegate void EventHandler(object sender, EventArgs e);

Define the event and firing logic-

public class Button
{
    public event EventHandler Click;
    protected void OnClick(EventArgs e)
    {
        if (Click != null) Click (this, e);
    }
}

Done!

Indexers

Indexers work a lot like operator[]. You add an indexer for the class like this-

public class ListBox : Control
{
    private string[] items;

    public string this(int index)
    {
        get
        {
            return items[index];
        }

        set
        {
            items[index] = value;
        }
    }
}

Unsafe Code

When you need to get to the bare metal, there's a feature called Unsafe Code, essentially "inline C" code so you can do low-level code without leaving the box. This allows you to do high performance code while still in C#. Russ Williams pointed out that this is a lousy name and should be changed. Can you imagine being in a design review with a client and saying, "OK, this is a very important spot of the application that needs extra performance, so we're going to use Unsafe Code." I don't think so.

I will close this section with a quote from Allen Broadman-

"One thing you could mention in tomorrow's email. C# is radically different from C++, much more so than Microsoft implies. It is really closer to Java than to C++. For example-

  • no destructors, just a syntax that looks like a destructor gut which provides a function that only gets called by the garbage collector
  • no templates
  • nothing that resembles the standard C++ library, such as STL, iostreams, etc. This is the most significant part of C++
  • standard services (I/O, etc) are provided by the runtime environment

A senior C++ developer will find that their transition to C# is hardly any different from a transition to Java. This is because the bulk of the learning curve is in learning the library interfaces, not the language syntax. It doesn't matter if it is Java or C#, in either case it's a new library for fundamental services"

 

.NET Framework: a COM Developer's Perspective

Sounds good doesn't it? Russ Williams, Allen Broadman and I all thought so. After 20 minutes we realized that it was yet another overview of the CLR so we all slipped out the back. Russ and I went upstairs to...

Rich Client Programming with Win Forms

I had these confused with something else, so when we walked in and saw all these cool things happening on the screen I was thrilled. Then we realized that this was one of the features that required a "Smart Client," with ActiveX controls downloaded or installed on the client and IE 5.5. See more discussion of this stuff in the Letters section below.

Letters, We Get Letters

I'm getting alot of mail about the newsletter, which is great because it shows people are reading it. I especially like the complimentary ones...er...one. I'm sorry that I don't have time to answer all the mail, but each issue I will try to answer as many as possible. The letters I choose may seem capricious and arbitrary but that's because...well that's the kind of guy I am.

________________________

Not wanting to leave well enough alone after yesterday, SH from California writes again, saying-

"Hey, I took music theory and a Physics of Music course in college, and C# and D flat are not the same note, unless you are referring to the tempered scale which is, in fact, an average [of] the correct tunings for all possbile keys, i.e. none of the notes are correct."

Dear SH,
Yes you are correct. Now please stop acting like the guy in class that noone ever liked or I will have to remove you from the subscription list, whereupon you will have to get copy of the newsletter from the STCTM Discussion Public Folder like the people that try to get free newspapers out of the recycle bins at the subway stations. -Ed

________________________

Along a similar line, CM from Redmond writes-

"Quisp is not defunct and is available in the upper midwest USA. I believed everything I read until then.... "

Dear CM,
Please review my reply to SH. Besides, aren't being confined to the upper midwest USA and being defunct not all that different? (Don't flame me, it's just a jokel. Hey, we kid because we love). -Ed

_______________________

MN in MN (hey, that's pretty cool) asks-

"...has any mention been made of a billing model that would live in this space so that you could, as you state, just connect to a web service as if it was an app, but then every time the service is used a small usage chage is made and then billed monthly for instance?"

Dear MN,
MSFT hasn't given any clues along these lines, but the Plurite's here have discussed it. Options we see are a subscription basis where a fee is paid for any access to the site. Since it is possible to track where hits come from, a monthly bill system would work as well. No one really knows yet. - Ed

______________________

JR from Washington asks-

"Any info on security issues with using SOAP?...it's a way to call code on the web server through the firewall, seems like a big security hole"

Dear JR,
From what I have read, security is handled through the firewall, limiting access to the SOAP functionality by screening incoming http based on where it came from and what it wants to do. I will keep my ears open for more details. -Ed.

_____________________

DS in Washington asks-

"Has any mention been made of cross-platform aspects of this functionality..." [blah blah blah] "...?"

this question went on and on, but you get the idea -Ed.

Dear DS-
This really covers two areas. The server side all creates Web Services which are based on SOAP which appears to have some cross-platform appeal. A web service can be implemented in Corba, Perl, COM or whatever and still look the same to the client. Microsoft's server tools are written to build on Microsoft servers, so I don't see too much of a problem.

The other area, the client side, is entirely different. Microsoft wants to put .NET on both ends of the connection, but does offer alternatives. They are introducing two ways of improving the client experienced, Win Forms and Web Forms. Web Forms are less powerful, but are cross-browser. They are based on objects that are instantiated and manipulated in ASP+ on the server side that then stream out HTML when they go across the wire to the client. Pretty Cool. Win Forms are more powerful, but require .NET and IE 5.5 and ActiveX on the client side - my personal prediction is that this feature will be DOA. From what I've heard from Plurites down here, every client requires cross-browser capability so this will seldom be used. If a client finally comes along that doesn't care about cross-browser capability, the learning curve to suddenly learn WinForms probably will make it more expensive than just writing the cross-browser stuff we already know. My prediction is that Win Forms will be DOA. I can't wait to get a copy of this newsletter in the mail two years from now when we roll out our 50th Win Forms application.

Til Next Time,

Biff Gaut
Chief Typesetter, Biff's PDC Newsletter