jaybaz [MS] WebLog

We believe in nothing.

Browse by Tags

Tagged Content List
  • Blog Post: 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",...
  • Blog Post: 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 enable cross...
  • Blog Post: 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...
  • Blog Post: 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...
  • Blog Post: 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 hard...
  • Blog Post: 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...
  • Blog Post: 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; This tradition has been...
  • Blog Post: 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 on is clarity. Writing...
  • Blog Post: '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...
  • Blog Post: 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...
  • Blog Post: Won't Fix or Postponed?

    In our bug database, when resolving a bug, you have to select a “Resolution”. Obviously you can resolve as “Fixed”. Other options include: By Design - this isn’t a bug, we meant it to work this way. Not Repro - you were mistaken, this bug doesn’t exist. Postponed - this is a bug, but we won’t fix it...
  • Blog Post: Separating out unit tests

    This question came up on a customer chat today. It’s probably interesting to a wider audience, so I’m posting it here. I'm currently doing TDD with NUnit. With the upcoming testing tools in Whidbey, how do you see the separation of tests from production code taking place? I'm curious about how best to...
  • Blog Post: A Factory pattern

    The idea popped in to my head, so I wrote it down. I’m not sure what it’s good for, but here it is: class C { private C() { } public static class Factory { public static C New() { return new C (); } } } class Program { static void Main ( string [] args) { C c = C . Factory .New(); } }
  • Blog Post: How do you ship software?

    I surely don't need to tell you that we've been working on Whidbey for a while now. You probably wish we would hurry up & ship the thing. Me, too. However, we still have some bugs left to fix. Most were found by our QA, but many came from Ladybug . Thanks for all of those. We also got a whole lot...
  • Blog Post: Some good feedback on the Range post.

    Dithermaster says “it's *much* easier to find out of they DON'T overlap” and proposes: ! ( (end2 < start1) || (start2 > end1) ); If we apply DeMorgan’s Law, we get: (! (end2 < start1) && !(start2 > end1) ); And (end2 >= start1) && (start2 <= end1); Right? Even simpler...
  • Blog Post: Comparing ranges

    Ryan Farley talks about comparing date ranges . In his post is this phrase “ First range represented by r1start to r1end and second range represented by r2start to r2end ”. Aha, a code smell! 2 things that are related should have that relationship represented in code. It’s the Range pattern, which Fowler...
  • Blog Post: What are named indexers?

    Someone asked me about this, so I decided to write up the answer here in case other folks are interested. Indexers are pretty well documented on the web; I’ll quote some here. http://www.csharphelp.com/archives/archive140.html C# introduces a new concept known as Indexers which are...
  • Blog Post: Refactoring the XMLNotepad

    I’ve been reading Extreme Programming Adventures in C#. Currently reading Chapter 28 (Undo). Through most of the book, there has been a bit of Refactoring that the code has been crying out for. At first I thought Ron was waiting to until the duplication got worse, thereby justifying the Refactoring...
  • Blog Post: A way to do named indexers.

    In this entry on Ladybug , a customer asked for named indexers in C#. Here’s one way to get it: class Car { object [] wheels; public WheelsHelper Wheels { get { return new WheelsHelper ( this ); } } public class WheelsHelper { readonly Car _outer; public...
  • Blog Post: The hidden costs of a Refactoring

    Looking over our oldest C++ code, there is, of course, a lot of potential for Refactoring. That’s a nice way of saying that it sucks. We learned about Refactoring because we wanted to build good tools for our customers. Along the way, we also realized that we wanted to Refactor, too. One...
  • Blog Post: More about the event class

    In Popular patterns around events? , several folks mentioned that a usage example would be a good idea. As I put one together, I found some small changes to make to the code. Just goes to show you that thinking about your consumer is a good idea. Since this is a class for people writing classes...
  • Blog Post: If test fixtures could be private

    Last one for the day, then I go home. You’ve read Test Methods are neither Methods nor Tests . You’ve dried off & are fully recovered. This is the practical reason why NUnit should remove the ‘public’ requirements from test fixtures. I didn’t include it in...
  • Blog Post: Test Methods are neither Methods nor Tests

    Put on your life vest & tankini. We’re heading off into the deep end again. You’re doing TDD . You are happy with the results, enjoying the thrill of going fast . As with most C# projects done test-first, you have some code that looks like this: class C { ...
  • Blog Post: Popular patterns around events?

    In Properties with events: another attempt , Omer said: I would rather have a protected virtual OnSet method and AfterSet event than just an OnSet event (also consistant with the naming convention ;). I know understand that this is a common pattern found in .Net, which I didn’t know...
  • Blog Post: Making regex less painful

    So, Regex is darn powerful. But they’re hard to write correctly, hard to read, and hard to verify. To wit: Regex repositories around the ‘net, where you can find regexes instead of writing them. ( google ) Regex tools – Eric’s Regex Workbench , Codeproject’s...
Page 1 of 4 (87 items) 1234