Designing .NET Class Libraries Series Wrap-Up (April 27, 2005)

Posted: May 11, 2005

Please note: Portions of this transcript have been edited for clarity

Introduction

James Z (Moderator):
Welcome to today’s chat. Our topic today is "Designing .NET Class Libraries series wrap-up".

BradA [MS] (Expert):
Hello! I am Brad Abrams, a PM on the CLR team... thanks for comming!

James Z (Moderator):
The expert(s) will be here by the time I'm done posting the rules.

James Z (Moderator):
Now let's have the Experts introduce themselves....

BradA [MS] (Expert):
[JR] Hi everyone, I'm having trouble gettying on as an expert so Brad & I are using the same machine. I'll prefix my comments with [JR]

Joe Duffy [MS] (Moderator):
Howdy everybody! My name's Joe Duffy and I'm a PM on the CLR team. Looking forward to a great chat! Quick blog plug: https://www.bluebytesoftware.com/blog/.

BradA [MS] (Expert):
[JR] Btw, this is Jeff Richter of Wintellect.com

James Z (Moderator):
Let’s begin the chat. We welcome you to begin submitting your questions for our Experts. Remember to use the "Submit a Question" radio button when sending them a question. Enjoy the chat!!

Start of Chat

BradA [MS] (Expert):
Q: I have had this question for a while that besides the ability of having multiple versions of assemblies with different strong names in GAC , Is really strong name good for security purpose as well? what's the other usages of strongly named assemblie
A: [JR] The CLR on load also verifies an assembly's bits to see if any bits in the file have changed. It can only do this for stong-name assemblies and this is another security thing

BradA [MS] (Expert):
Q: i wish i was an MVP!
A: COmming to chats like this is a good first step... as it bloging, posting to newsgroups, etc.

BradA [MS] (Expert):
Q: Would there be any significant changes if the same class were given today?
A: I am happy to say the basics are the same. We are adding new guidelines all the time so I am sure those would be added, but there are not major changes.

Krzysztof Cwalina (Expert):
Q: A lot has been said about not breaking interfaces. But what are the guidelines when changing internal implementation ends up changing the results of a method. Can this be classified as a breaking change? (continued)...
A: Yes. Behavioral changes can be (and often are) breaking. In general any change to semantics is potentially breaking. But changes are unavoidable and you need to decide which of the changes you have to make to your code are only technically breaking and in practice won't affect applications. Kit George (a member of the BCL tema) just posed a nice document describing some of the issues. See https://blogs.msdn.com/bclteam/archive/2005/04/06/405982.aspx

BradA [MS] (Expert):
Q: If there have been significant changes to the JIT, does any of it affect how we would design our classes?
A: [JR] The JITter does produce more efficient code than it used to and it has a new way of calling interface methods that is faster than what was in v1.0 or v1.1. So, if performance stopped you from designing things a certain way, it should have less impact in v2.0

BradA [MS] (Expert):
Q: I beta test over 12 products for Microsoft, and i post in newsgroups as well, i fill out the surveys, and i attend MSDN chats as well as beta chats, what else do i need to do to become a MVP.
A: Sorry, I don't run the MVP program, so I don't know for sure... drop me an email off line

BradA [MS] (Expert):
Q: BradA: How do potential MVPs get noticed?
A: The things Jonathan noted are a good start...

BradA [MS] (Expert):
Q: ... I have some examples: https://support.microsoft.com/kb/327244 describes a bug/workaround in the ComboBox. What if an application relies on the described behavior is ported do Whidbey where the bug was fixed? What is the balance in this case?
A: This is a great compat issue... did you submit it to MSDN Product feedback? that is just the kind of feedback we need right now... see JasonZ's blog https://blogs.msdn.com/JasonZ for more info... BTW, JasonZ is by bosses's boss so tell him I sent you ;-)

BradA [MS] (Expert):
Q: hey, brad, whats ur email
A:BradA@Microsoft.com

Joe Duffy [MS] (Moderator):
So, were there any controversial points you have follow up questions on from the video? https://msdn2.microsoft.com/netframework/aa497261.aspx

BradA [MS] (Expert):
Q: Changes to how we create custom exceptions? I know it has been revised to inherit from Exception rather than ApplicationException. Anything else?
A: [JR] Nothing has changed about how to create exceptions. In fact, deriving from ApplicationException was actually depricated or discouraged back in the v1.0 days so that hasn't really changed either

BradA [MS] (Expert):
Q: Weren't MS aware of the threading performance issues you mention on your blog JR? I assume any perf fixes would be too "dangerous" at this point in time (beta2>rtm)? https://wesnerm.blogs.com/net_undocumented/2005/04/the_art_of_thre.html
A: [JR] I have created a PowerThreading library that will appear on Wintellect.com web site in a month or 2. My library has lots of fast locks in it and a fast thread pool and code to build your own methods that support the asynchronous Programming Model.

BradA [MS] (Expert):
[JR] Fortunately, MS has fixed a lot of the holes in threading in the Whidbey release but performanec has still not be address as much as I'd like it to

Joe Duffy [MS] (Moderator):
Q: Can you guys at Microsoft do the math test for me that i have in another 5 minutes, lol
A: Sure. 1+1 = 3.

BradA [MS] (Expert):
Q: I didn't get that...Why deriving from ApplicationException is discouraged?
A: [JR] Because the guidelines had 2 conflicting points: the guidelines recommended that you use exception classes that are already defined in the BCL when you could and the guidelines also stated that applications should only through exceptions derived from ApplicationException. These 2 guidelines are in conflict and so deriving from ApplicationException was the guideline that got cut.

BradA [MS] (Expert):
Q: Abstract classes or interface?? which one is betetr?
A: [JR] There isn't a hard and fast rule here. It really depends on the situation. I tend to think IA-A relationship for classes and HAS-A relationship for interfaces.

BradA [MS] (Expert):
[JR] Since the CLR supports single-inheritance only, I tend to lean more towards interfaces so that others can chose their on base class

Joe Duffy [MS] (Moderator):
Q: Can we expect interface changes in the FCL after beta2?
A: The primary reason we do beta releases is to solicit customer feedback. With that said, we try to reduce the number of breaking changes we introduce logarithmically as we approach our ship date (and increase the process overhead for making changes exponentially ;)). Both our customers and partners get frustrated when we keep changing public APIs, especially those people who deploy live applications on the Framework. We want to make the migration from Beta2 to the final version of Whidbey as seamless as possible. So in short: we absolutely try to avoid doing it, but we might have some small changes based on very strong customer & partner feedback.

BradA [MS] (Expert):
Q: whats new in Visual Studio .NET 2005 compared to Studio .NET 2003?
A: Oh, big stuff.. generics, edit and continue.. see https://msdn.com for more details!

Krzysztof Cwalina (Expert):
Q: why inheriting from ApplicationException got depricated?
A: An exception type only make sense if there is a programatic scenario for handling the exception type. There are no scenarios for handling ApplicationExceptions , i.e. you would never do catch(ApplicationException){ ... // some code }

BradA [MS] (Expert):
Q: BradA: The ComboBox was just only an example demonstrating behavior changing. The truth is that I'm glad that this bug finally is gone! Can't wait until I do more testing with the rest of DataBinding to see if the other problems were also resolved.
A: Cool... I am glad this helps you, but we still like to know about all these issues so we can help move people to V2.0 easily..

Jeff Richter (Expert):
Q: >>I tend to think IA-A relationship for classes and HAS-A relationship for interfaces(more explanation please)
A: A FileStream IS-A Stream so base class seems good. A String HAS-A collection of characters so an interface seems good

BradA [MS] (Expert):
Q: an application only uses the version of a class library that was at compile time. is it possible that the application be set to accept latest versions of a class library? (sorry if this appears so simple)
A: If you don't change the assembly version number (but you can change the win32 version number) you get this behavior... You can also use something callled publisher policy to get this behavoir...

Jeff Richter (Expert):
Q: an application only uses the version of a class library that was at compile time. is it possible that the application be set to accept latest versions of a class library? (sorry if this appears so simple)
A: [JR] No, it is not possible to set this up once and for all. When a new version of an assembly is available, you can modify an application to use the new version but you have to know the new version number first before you can make this work.

BradA [MS] (Expert):
Q: Guidelines on creating assemblies for use in Sql? Are they different from creating any other assembly?
A: The basic guidelines are the same, but there some additional things you need to think about when creating an assembly for Sql... things like threading, CAS, etc. Drop me a line and I will conact you with someone that knows...

Joe Duffy [MS] (Moderator):
Q: If the CLR only supports single inheritance, how does C++/CLI implements multiple inheritance?
A: Well, the runtime's type system doesn't support multiple implementation inheritence. (It does supports types who are polymorphically compatible with multiple interfaces.) But I am not sure how the C++/CLI compiler implements this. My intuition tells me that they limit multiple inheritence to the unmanaged subset, meaning you can't compile completely down to IL if you use the feature. But if you send me an email (joedu@microsoft.com), I can follow up and get you in touch with somebody who can explain better.

BradA [MS] (Expert):
Q: are you aware that there are many problems installing the new beta 2 of .net framework, it asks you to reinstall 1.1 for some unknown reason when using Microsoft Update?
A: No -- that is not expected... can you report it on the MSDN product feedback site? thanks!

BradA [MS] (Expert):
So -- Jeff and I were just talking... who's book do you like more.. my SLAR or his Applied .NET Framework Programming book?

BradA [MS] (Expert):
Thanks Alfred! Vol2 will be even better thanks to your help...

Jeff Richter (Expert):
Q: BradA: Well.. I don't know Jeff's book, but SLAR rules!
A: [JR] Well, I contributed to the SLAR as well so I feel that it's not a fair question that Brad asked

BradA [MS] (Expert):
OK -- so what was the best lesson in this series? https://msdn2.microsoft.com/netframework/aa497250.aspx

Jeff Richter (Expert):
Does anyone have any suggestion of what they'd like to see me put in the 2nd edition of my .NET book?

BradA [MS] (Expert):
Cool -- one vote for Rico's... coool... anyone else...

BradA [MS] (Expert):
Cool.. thanks Alfred.. those are the core ones...

BradA [MS] (Expert):
Q: Naming Conventions was good cause it got you to post some internal usage guidelines from MS that I know we all enjoyed being able to read.
A: Great - -I am glad that was helpful!

Joe Duffy [MS] (Moderator):
Q: Naming Conventions is such a big issue out there. I've seen people (customers) doing horrible things.
A: Definitely... Hopefully with FxCop support in VSTS, this will help. Do you have any examples of really bad names you've encountered in the wild?

BradA [MS] (Expert):
Q: I think we need to see something additional on designing class libraries that includes unit testing. This really should, IMO, be a core part of any design process.
A: Yes -- that is good feedback, I just reviewed some guidelines around this from the CLR test team yesterday.. we are working on making something externally avialable.

Jeff Richter (Expert):
Q: Jeff, more on security.
A: Yes, I agree I should have a chaopter or 2 on CAS but I don't think I'll have time to make it into the 2nd edition. I was planning on adding generics and threading stuff. More design guideliness stuff, versioning, performance stuff, and best practices/guidelines stuff.

Jeff Richter (Expert):
Q: Jeff Richter: If you need a reviewer, drop me a line
A: I'll think about this and get you're info from Brad if I need you

BradA [MS] (Expert):
Q: There are lots of third pary OR mappers out there.Is there something from Microsoft at the moment? Is really better to use these OR mappers or Microsoft building blocks?
A: Oh, man OR mappers. Yesterday I talked with Anders Hejlsberg about this problem yesterday. We don't have anything to announce at this time, but it is something Anders has taken a personal interest in so you can bet we will see something good before to long.... I

BradA [MS] (Expert):
Q: There are lots of third pary OR mappers out there.Is there something from Microsoft at the moment? Is really better to use these OR mappers or Microsoft building blocks?
A: Let me aslo put in a plug for the PDC... Sept 12 in LA... we will see that some more on it there...

BradA [MS] (Expert):
Q: I don't remember Naming Conventions suggesting anything about database objects. Since it's so easy to create objects like DataSets and stuff up the pipeline, it would be good to see guidelines on this topic.
A: Ahh -- ok, that is a good idea... we will add it to the list..

BradA [MS] (Expert):
Q: I don't know what I would do without unit testing. Its a major security blanket for a developer.
A: I agree! we do unit testing heavily for the .NET Framework developement...

BradA [MS] (Expert):
Q: System.Data.SqlServer used to contact SqlContext. That has moved to Microsoft.SqlServer.Server. SqlContext used to contain a GetCommand that would return a command object for the current context. It no longer can be found in Beta 2. Who do I need to get
A: Drop me an email, I will find the right person for you...

Joe Duffy [MS] (Moderator):
Q: If the CLR only supports single inheritance, how does C++/CLI implements multiple inheritance?
A: Fyi, I pinged Brandon Bray, PM on the C++/CLI team. His response was"The C++ compiler doesn’t record type relationships of native classes in metadata. That information is only known at compile time. As such, we’re able to use value types as a way to encode all of the native C++ classes. The downside is that the types encoded in metadata can’t be used by other languages, and the C++ compiler requires a header file to get all the information it needs to describe the native classes it sees in metadata"

BradA [MS] (Expert):
Q: Any thoughts on security when designing for RANU? Things to consider?
A: What exactly do you mean by RANU in this context?

Joe Duffy [MS] (Moderator):
Q: What's the latest on covariant return types? Are they considered for RTM or orcas?
A: We support co-/contra-variance with generics (although C# doesn't expose this functionality). But as far as supporting it in a 1st class way in the type system, it's certainly not something we're going to do for Whidbey. There are very strong opinions in both directions on this one, so I'm afraid I can't give any indication as to whether we'll do it in Orcas. I personally would lovet o see it.

Joe Duffy [MS] (Moderator):
Q: Joe Duffy: Using twisted hungarian notation for fields for an example: VALQUANTITY for a field that stores a value, CDCUSTOMER for a customer's Id and so on... I was member of a starndard comitee and there was a person who came from a database background..
A: ouch, Ouch, OUCH! Unfortunately, FxCop doesn't check non-public naming conventions... something like Java's checkstyle would probably be useful for this.

Jeff Richter (Expert):
Q: Jeff, there is tons of literature available on generics, design guidelines etc. I think the security would make more of an impact to the reader. Just my opinion.
A: Yes, I kinda agree which is why I'm having a hard time getting excited about what I'd say in the book about generics. Generics does seem to be the most written about Whidbey feature. But I do think I need to add it because my book is about this stuff and it completes the book. In addition, I do think I will have a slightly different take on it. My take will be about how it works in the CLR, performance ramifications and design guidelines/best practices. The problem with CAS is that it si a huge topic and is generally only cared about for client-side apps; not server side. Also, Whidbey has been making some big changes in the way it works and I haven't kept up with all the changes so it will take me a lot of time and I'm hoping to ship the book by Whidbey RTM.

Joe Duffy [MS] (Moderator):
Q: Joe Duffy: Using twisted hungarian notation for fields for an example: VALQUANTITY for a field that stores a value, CDCUSTOMER for a customer's Id and so on... I was member of a starndard comitee and there was a person who came from a database background..
A: ...just to follow up on that, I'd check to see if there's a checkstyle.NET on (say) SourceForge. This was a great tool I remember from a while ago that folks in the Java world use quite frequently.

Joe Duffy [MS] (Moderator):
Q: I haven't tried this, but is the current version of EntLib compatible with fx 2.0, and will there be another release of EntLib before the end of the year to corespond with 2.0?
A: There are plans to publish a v2.0 version, but likely not until the final version of v2.0 ships.

James Z (Moderator):
Q: System.Data.SqlServer used to contact SqlContext. That has moved to Microsoft.SqlServer.Server. SqlContext used to contain a GetCommand that would return a command object for the current context. It no longer can be found in Beta 2. Who do I need to get
A: Thank you all for joining us today. We'll be ending this chat in about 1 minute.

James Z (Moderator):
Great questions, look for the transcript to be posted to https://msdn2.microsoft.com/chats/aa497439.aspx within the next few days.

Joe Duffy [MS] (Moderator):
Thanks for coming by! Take care...

James Z (Moderator):
Q: There are lots of third pary OR mappers out there.Is there something from Microsoft at the moment? Is really better to use these OR mappers or Microsoft building blocks?
A: Alfred, Great suggestion! I will pass this along. Perhaps we could begin RSS feeding them or something.

James Z (Moderator):
Q: James Z: I'm suggesting this again: There could be a way for us to sign in and receive a notification when the transcript becomes available.
A: Alfred, Great suggestion! I will pass this along. Perhaps we could begin RSS feeding them or something.

James Z (Moderator):
OK that's all for now folks!

Top of pageTop of page