Browse by Tags
All Tags »
C# (
RSS)
Every so often, somebody points out how bad of a metric code coverage is . And of course, on its own, it doesn’t tell you much: after all, it’s a single number. How could it possibly reflect all the subtlety (or lack thereof) of your designs and of your testing artillery? Of course, within all the various *DD approaches, some better than others enable you to know whether or not your code conforms to its requirements, but I thought I’d take a moment to reflect on the general idea of a software metric and how it relates to the mothers of all metrics: physical ones, cause you know, I used to be a scientist. Proof: the lab coat on the picture. The theory of measurement is at the center of all experimental physics. This comes from the realization...
There’s been some debate recently on the new “dynamic” keyword in C# 4.0 . As has been the case with many features before it, some love it, some hate it, some say it bloats the language, yadda yadda yadda. People said that about lambdas. Me, I’ll just use it where I see a use case, thank you very much. In the case of dynamic, another frequent comment is that a statically-typed language should not try to look like a dynamic language. Well, I just don’t believe in that distinction. Being dynamic is a trait that a language can have, and some have it more than others. But as soon as a language has a dictionary type or indexers, and most modern languages do, it starts having dynamicity. What people call a dynamic language is just one where it’s the...
I just posted the following snippet on Twitter. The exercise is to write meaningful and preferably cool code that fits in a Twitter message along with the #twitcode keyword, which leaves 130 characters. private static readonly byte [] _blankGif = Convert .FromBase64String( "R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAEBMgA7" ); I can’t wait to see what people come up with. Monitor the results from here: http://twitter.com/search?q=%23twitcode or from the Atom feed: http://search.twitter.com/search.atom?q=%23twitcode Read More...
I know as a good microsoftee I should be supportive of what my employer does no matter what it is, and I might get fired for this post, but Eilon’s latest article is wrong on so many levels I have to step up with whatever integrity I have left and fix this mess. In his post, he exposes the new ShrödingOr<TDead, TAlive> type that will be introduced in .NET 5.0 as part of the System.QuantumEntanglement namespace. Well, let’s face it, the current implementation has nothing quantum about it. Here’s how I would have written it: namespace System.QuantumEntanglement { public class SchrödingOr <TDead, TAlive> { private Complex _howDead; private Complex _howAlive; public SchrödingOr( Complex howDead, Complex howAlive) { _howDead = howDead;...
In the work we’ve been doing with Rob on the Kona commerce app , our quest for extreme pluggability has led us to look at quite a few interesting features of ASP.NET compilation. Features I didn’t know about before Dmitry and David pointed them out for me. I thought I’d share… It starts with the <%@ Assembly src= %> and <%@ Reference virtualpath= %> directives which you may have seen show up in IntelliSense when building a page. But what are they doing exactly and what differentiates them? They both enable you to reference code that is in a different file in the site. With both of them, you get full IntelliSense on the referenced code, but they don’t reference the same kinds of files. @Reference is meant to reference a specific class...
I’ve done some tricky work with delegates recently and I’ve had a hard time trying to reflect over the signature of a delegate type. I feel a little silly now that the solution to this has been provided to me by Eric Lippert . It’s actually quite simple, just reflect over the Invoke method: MethodInfo invoke = typeof ( Func < string , bool >).GetMethod( "Invoke" ); Console .WriteLine(invoke.ReturnType.Name); I hope this helps others… Read More...
In SP1 for Visual Studio 2008 and Visual Web Developer 2008, C# introduced a new feature to provide 'live' reporting of compilation errors. Unfortunately, the introduction of this functionality also introduced a bug where in certain cases, false C# compilation errors appear in the Error List for ASP.NET Website projects. Specifically the following is a list of issues you may have experienced due to this bug in SP1: If you have a breakpoint in a code-behind file. On project open, you get incorrect errors in the Error List for that code-behind file (e.g. – button1 is not declared). These errors do not go away until you open that code-behind file. Once you open the code-behind file, the errors go away. When you open a code-behind file,...
I’m flying to San Jose tonight for tomorrow’s OpenAjax Alliance face to face meeting , which Microsoft is hosting. On Friday, we are also hosting a new event that aims at establishing a dialogue between JavaScript library developers and Microsoft. We’ll have talks from the IE, Visual Studio and ASP.NET teams, as well as talks from members of the community. This should be very interesting. Then I’ll be flying to L.A. for the PDC . If you’re going to be there and want to chat, feel free to drop me a note at bleroy at Microsoft. I’ll be in the room during Stephen Walthers ’ session on jQuery and ASP.NET on Tuesday from 5:15 to 6:30 (403AB). I’ll also do a short demo in Scott Hunter ’s talk on the ASP.NET 4.0 Roadmap on Monday from 1:45 to 3:00...
Well, at least a Dot Net Slacker ... My first article on DotNetSlackers just got published. It shows how to handle the back button with ASP.NET Ajax using pure server code. Check it out (registration required): http://dotnetslackers.com/articles/ajax/HandlingTheBackButtonFromServerCode.aspx Read More...
For some reason, there's been a lot of buzz lately around immutability in C#. If you're interested in algorithms and data structures, it's a fascinating subject. Immutable objects, according to Patrick Smacchia , have the following advantages: They simplify multithreaded programming. They can be used as hashtable keys. They simplify state comparison. A good introduction to immutable types by Patrick Smacchia : Immutable types: understand their benefits and use them More on immutability usefulness: Immutability, Purity, and Referential Transparency Immutable types can copy the world… safely! Luca Bolognese on implementing immutable value objects: Creating an immutable value object in C# - Part I - Using a class Creating an immutable value object...
More Posts
Next page »