C
There are 6 entries for the tag
C
At the first glance .NET events are an easy and harmless way to decouple components. The former statement is true but the latter is not. The reason is that whenever an instance of a class subscribes to an event published by another class a strong link between these two is established. By strong link I mean that the subscriber(listener) won't get garbage-collected as long as the publisher is alive. The only way to break that link is to unsubscribe from the event which might be easily omitted as the link is not explicit. Additionally there are cases when explicit(deterministic) cancellation...
CLR generics are great and there is no doubt about that. Unfortunately, C# doesn't expose the whole beauty of it because all generic type parameters in C# are nonvariant though from CLR point of view they can be marked as nonvariant, covariant or contravariant. You can find more details about that topic here and here. In short the "nonvariant" word means that even though type B is a subtype of type A then SomeType<B> is not a subtype of SomeType<A> and therefore the following code won't compile: 1 List<String> stringList = null; 2 List<object> objectList = stringList; <-- this...
After the Joel Spolsky presentation that launched IJTC there was a panel discussion which meant to explore all the future directions that Java as a platform might take. The participants were talking about the future in a kind of sad way and the discussion toured out to be mainly a never-ending stream of complaints. Basically people were concerned about:
Java 6 is not implemented on Leopard
mobile phone specs on the vendors web sites don't list Java as a feature, something like Java ready sticker
lack of...
Yesterday I read a blog post that meant to discuss possible naming conventions for LINQ but it turned out that the most interesting part of it was something completely different. Namely, Krzysztof Cwalina wrote that we don't have to implement IEnumerable and IEnumerator to be able to iterate through an object(collection) using foreach statement. It's enough that a class exposes GetEnumerator() method. It doesn't have to implement IEnumerable interface. At the beginning I thought that it's just another example of syntactic sugar and that the C# compiler generates implicit IEnumerable declaration on our behalf. But then I opened ildasm.exe and...
As I mentioned earlier I always wanted to read C# via CLR by Jeffrey Richter. Finally I got it a few months ago and while I was sick I read it. I think it's just brilliant because: I like the way Jeffery explains problems.He is strict and precise whenever it's needed but no more. As far as I know he is not a Microsoft employee which lets him express criticism of everything that deserves it. It reveals lots of things that you will never be aware of unless you start thinking in an illogical way. Unfortunately CLR and/or C#...
You can call me a purist but from my point of view the most valuable feature of C# is its consistency and explicitness. It seems that there are 2 teams at Microsoft that work on C#. One of them introduces great features like LINQ but the second one seems to support laziness of any kind and keeps introducing features that may(will) confuse software developers. Unfortunately it looks like the 'bad' team is not going to stop its activity. Their last idea which is called partial methods and is dedicated to code generator vendors smells like a C/C++ concept. Why? Because a partial method consist of method...