Santalic tailfans, part two

As I have said before many times, there is only one sensible way to make a performant application. (As an aside: perfectly good word, performant, deal with it!) That is: Set meaningful, measurable, customer-focused goals. Write the code to be as clear and correct as possible. Carefully measure your performance against your goals. Did you…

36

A nasality talisman for the sultana analyst

The other day my charming wife Leah and I were playing Scrabble Brand Crossword Game (a registered trademark of Hasbro and Mattel) as is our wont. I went first, drawing the Q and a bunch of vowels. Knowing that the Q is death to hold onto, I immediately opened with QI for 22 points. I…

24

Properties vs. Attributes

Here is yet another question I got from a C# user recently: I have a class that represents a business rule. I want to add some rule metadata that could be used by consumers to retrieve a friendlier rule name, description, and anything else that makes sense. Should this information be exposed as an attribute…

11

Long division

A thing that makes a reader go hmmm is why in C#, int divided by long has a result of long, even though it is clear that when an int is divided by a (nonzero) long, the result always fits into an int. I agree that this is a bit of a head scratcher. After…

12

Why no var on fields?

In my recent request for things that make you go hmmm, a reader notes that you cannot use “var” on fields. Boy, would I ever like that. I write this code all the time: private static readonly Dictionary<TokenKind, string> niceNames =   new Dictionary<TokenKind, string>()   {    {TokenKind.Integer, “int”}, … Yuck. It would be much…

35

Reading Declarations

Wow, lots of good “hmm” moments in the comments to yesterday’s post. Keep them coming! Many of these resonated strongly with me. One in particular was thinking back to the day when I finally internalized the reality that in C/C++, the declaration “int * px;” does not break down “int *” and “px”, but rather…

13

Things That Make You Go Hmmm

As you might have gathered from the number of times I make a blog post beginning with “I got the following question from a reader the other day…” I field a lot of questions about the C# language (and in the past fielded a lot of questions about VBScript and JScript.) Each of them is,…

60

Future-Proofing A Design

Last time on FAIC a user asked for guidance on the potential pitfalls of refactoring an automatic property into a regular explicit property. This is just an example of a far more general problem: how can we design programs so that they are easy to get right when things inevitably change in the future? This…

9

Automatic vs Explicit Properties

Here’s a question I got from a C# user last year, a question I get fairly frequently: User: With “regular” explicit properties, I tend to use the private backing field directly from within the class. Of course, with an automatic property, you can’t do this. My concern is that in the future, if I decide…

16

Book News

Happy new year all — I hope 2008 was a good year for you and that 2009 will be better. I myself was crazy busy at the end of 2008, working on a number of at-work projects and personal projects which I’m not going to blog about at this time. I hope to get more…

6