Everything but the language design…?

So I’ve been reading some history of programming languages. And one question that came up a lot is ‘What made this language popular? Why did it live, where others have failed?’ There have been a bunch of different answers, for different languages, and they don’t really have much to do with language design. And it…

0

Reading performance counter data in .NET

Nothing you can’t easily write yourself, but while playing around, I wrote this one myself, and learned one or two things. Firsltry, it demonstrates the wrinkle that when reading % processor time you need to specify the instance name of the processor, or the special instance name “_Total”. Secondly you’ll notice that the % CPU…

0

Tests should explain something

I sometimes see unit tests which are downright confusingly opaque. Being a unit test, they are testing some smallish piece of code. Unfortunately by the time I finish reading the test I am none the wiser for what the importance of the code in question is, and what role it is meant to play in…

0

Is IQueryable poisoning your interfaces?

Thanks indirectly to a comment on my previous post, today I read ‘IQueryable is tight coupling’ (disclaimer: his words). I feel like it contains an interesting mixture of truth and panic, and makes a fine discussion topic. The main interesting truth he mentions is: nobody implements IQueryable fully! Yes! If you’ve used an ORM, you’ve…

2

Revisiting – how to make your EF queries testable

So, some time back I spent some time agonizing around testability of code which has to talk to a database. I now think I have found a somewhat reasonable answer, which assumes that you are using some kind of LINQ query relational database mapper like EntityFramework which my samples are based on. It has these…

4

Some code patterns I don’t love in C#.

Pattern 1: TryGetFoo that returns boolean. MyEnum ret;if (Enum.TryParse<MyEnum>(normalized, true, out ret)) { return ret; } else { return null; } You would think this slightly more concise line would work MyEnum ret;return Enum.TryParse<MyEnum>(str, true, out ret) ? ret : null; But it turns out that is no good. Compiling the ternary operator, compiler can’t…

2

Azure Web Roles + RoleShared. Grrrrr…

I had a deployment to azure failing yesterday, and I thought ‘I know what caused this. It’s a dll dependency break from upgrading to Azure SDK 2.3.’ Of course I was right. But looking at how I was getting screwed by the new sdk switch, I felt surprised at the mechanisms involved. Of course first…

0

The lexer hack

I found recently I like to do the coding more slowly and intersperse more reading than was once the case before the internet was large. The internet is frickin huge now. Try finding what you are looking for. Anyway, I roughly found what I was looking for today in ‘the lexer hack’ http://en.wikipedia.org/wiki/The_lexer_hack So what…

0

Scripting vs module systems…

A well known pain point of the CLR is that loading your program and running a few lines takes too long. While I don’t know where exactly my beliefs came from, my beliefs are that this is because of a) assemblies needing to be JITTED from MSIL in order to executeb) in order to JIT…

0