Wednesday, June 17, 2009

CLR and .Net Framework: Some information to share

.Net Framework 4.0 in on the way and Vance Morrison, an CLR architect has talked about the how CLR has evolved from the the very beginning to till now. With .Net Framework 2.0 CLR version 2.0 was released. But with .Net Framework 3.x the CLR version was the same, i.e., CLR version 2.0. Now with .Net Framework 4.0 CLR version 4.0 is going to be launched. So Where is CLR version 3.0? Actually this does not exists and will never exists. To keep the CLR and .Net Framework version consistent CLR is named from 2.0 to 4.0.  I have recently come to know some new information about CLR and .Net Framework that are summarized below:

We can see source code of an assembly (if it's not encrypted) with reflector. Doesn't it break intellectual property?

Reflector unveil the source code and someone raise question about intellectual property but just unveiling source code doesn't mean the everything. A successful software system is more than just source code. Successful system is composed of dev team, test team, marketing policy, support team etc

Exception Modeling in CLR need to be optimized (As  per CLR Architect Vance Morrison)

The exception modeling in .net framework need to optimized. But the problem is that this will change the way programmer works. So changing the exception modeling, exiting exception handling may not work.

String Manipulation in CLR can be optimized (As per CLR Architect Vance Morrison)

By default string in .net takes two bytes of space as this is Unicode string. But in real world most of the systems are not multilingual system and needs only ANSI characters. So this is kind of waster of resources. Also more than 25--30% of the total resources in a system is string. So reducing the string size to half we can save around 10-15% of resources. So as per Vance Morrison, he has a vision to do something to make the string types configurable so that developers can specify which string they want to use.

Interface uses may create problem from version to version

We can't add default implementation of a method in an interface. For example in a class library version 1 an interface Interface1 has two methods. But in version 2 another one method is added. The problem is that with that new version of class library the older code will break. So Microsoft is working on .net framework to provide a way to say version 2 that "hey If this new method doesn't exist then create a default method"

Why multiple inheritance is not supported in c#?

The simple question is to make the implementation easier. If a class ClassA inherited from three different base class Base1, Base 2 and Base3 and each of them has a property (i wanna say state foo) then in composite object ClassA it might be difficult to find out which foo is to be incorporated in derived class. Some programming languages like C++ has virtual concept which may solve the problem but it make the inheritance model more complex and dotnet framework did not follow the path. These problem becomes even complex with diamond problem. State(class fields) are bad in this multiple inheritance as you need to decide which state to keep in case of multiple inheritance. But multiple contracts (methods) are fine as we can call the base contract(method) from derived one with prefixing base one (say Interface1.Contract1(), Interface2.Contract1() etc). So whether to allow multiple inheritance or not was a design problem for CLR designer and they choose not to allow multiple inheritance to avoid complexity with implementation. If multiple inheritance is supported then developer had to dealt with problems like diamond problem.

No comments:

Post a Comment