Here are some of the questions I asked to Krzysztof Cwalina (Reusable frameworks design guru & PM@Microsoft) on 17 March 2009.
Question (Gopala): In C#, why don’t we have a feature called “Extension properties” just like extension methods ? This feature is available in F#.
I got a scenario during my development to add an extra property for System.IO.FileInfo class (like for example File Id)
Answer(Krzysztof): It was just harder to add this feature to the language. Maybe at some point in the future.
Question (Gopala): How to find out the size of a reference type (preferably with nested reference types)? Is there any operator like sizeof which calculates the size of a reference type?
Answer(Krzysztof): No, there is no easy way. Reflection is the only one I know. Just watch for performance
Question (Gopala): Why C# doesn’t allow method level static variables? Is there any alternative approach to use method level static variables in C# just like in C++?
Answer(Krzysztof): I don’t know/remember this design decision
Question (Gopala): As we know the only .NET language where we can use global variables is CIL …why global variables are not allowed in C#?
Answer(Krzysztof): Public static variables are global
Question (Gopala): In your design guidelines you have mentioned not to catch exceptions of type “Exception” (i.e. Generic exceptions) and instead we have to catch exceptions of specific type. This is a good practice but I have seen lots of products (including Microsoft products) don’t follow this guideline.
Some of the products I was talking about is:
1. Microsoft enterprise library exception handling application block
Answer(Krzysztof): Yes, this is a special case of a library for handling and logging exceptions.
2. Most of the code samples from MSDN
Answer(Krzysztof): This is good point. I don’t think the samples should do it. I think they do it for simplicity, but samples should show good practices.
3. Some products(Applications) which are developed in our company.
Answer(Krzysztof): Applications might sometimes want handle Exception. The FDGs are for libraries
Question (Gopala): I heard that initially interfaces were used in the design of ASP.NET provider model and later on most of the interfaces were replaced with abstract classes. What is reason behind this core design change?
Answer(Krzysztof): This is described in the Framework Design Guidelines.
Though I asked lot many questions I remember only these ones.
Guys, Try to answer my questions or Feel free to put comments\ suggestions.
Answer for one of my question is available @ Eric's blog...
ReplyDeletehttp://blogs.msdn.com/ericlippert/default.aspx?p=3