properties vs. fields... again

Eric Gunnerson just posted Properties vs public fields redux… It’s no secret that I agree with Eric whole-heartedly on this matter.  I’ve posted about this before as well: http://blogs.msdn.com/jaybaz_ms/archive/2004/04/29/123333.aspx.  Fundementally, the problem is one of “speculative generality”, where you are writing code today that has no use, because you think that it might be needed…

6

random debugger tip: catching COM exceptions

I was cleaning out some old mail and came across this tip.  You can tell it was a long time ago, because it really only matters if you’re writing COM objects, something I haven’t done in a long, long time. Some parts of Visual Studio use COM as a layer to handle cross-thread calls and…

1

The next Accidental Difficulty in software

First, go read this article by Joel: Book Review: Beyond Java.  He mentions this list, of great advances that have address some accidental difficulties in software: Assemblers Algebraic languages (including Fortran) Structured languages (Algol-60 and C) Declarative languages (including SQL) Memory-managed languages (including Lisp, VB, and Java) First, I’m disappointed he didn’t list C# next…

3

Finding the correct source

From a previous comment: > A copy of the source tree that exactly matches that test VS. Why IDE unable to keep track versions of sources for me ? Why not embed meta-information in PDB’s on how and there to retrieve correct source file version ? Actually, it does.  In VS2005, the debugger team added…

0

slack

There was some discussion here about the book Slack.  For months I have haven’t had any time to participate, or even observe in such discussions.  But this discussion appeared a few days after the Beta 2 work dropped off.  I was spending 4+ hours each day in meetings to discuss Beta 2 bugs; it was…

0

What I'm doing these days

Gee, this blog has been pretty quiet.  Why?  Could I have lost interest in the connection with all the C# developers in the world?  No! My responsibilities have drifted somewhat, to areas that make less sense to blog about. Dev Lead I’m the development lead for the C# editor, which means that my team creates…

5

Thoughts on bit fields.

In C there is a long tradition of using bit fields to store a collection of boolean values:       enum     {         TF_KEYWORD          = 0x0001,         TF_MEMBER           = 0x0002,         TF_IDENTIFIER       = 0x0004,         TF_STRINGLITERAL    = 0x0008,         TF_CHARACTERLITERAL = 0x0010,     } TOKENFLAGS;       DWORD dwTokenFlags = TF_KEYWORD | TF_MEMBER;  …

6

Performance of 'for' vs. 'foreach'

I saw someone ask if ‘for’ or ‘foreach’ is faster.  I was surprised.  My code is often slow when I first write it, but it’s never something that could have been fixed by a microoptimization like that.  So I wrote this: In my code, I find that the most important thing for me to focus…

12

'switch' in C#

On Eric’s blog, a discussion about ‘switch’ statements in C# & why they require ‘break’ inspired this post. One of my favorite principles in the design of C# is that it forces you to be explicit when that removes confusion.  The best example is the way that the language doesn’t let you accidentally override a…

20

Safely firing an event, Part 3

Take another look at Safely firing an event.  According to Grant, there’s another issue here.  The JITter may optimize away locals in situations where you think want them for thread safety.  So the recommendation to make a local copy is not as valuable as we had hoped.   Grant’s recommendation is to mark the event…

15