I aced it!
You Passed 8th Grade Math |
![]() |
a geek trapped in a cool guy’s body
Trapped online since 2004
I aced it!
You Passed 8th Grade Math |
![]() |
I’ve been reading Brad’s blog for, well, as long as I’ve been reading blogs. I always found great little tidbits of .NET knowledge on his blog: performance tips, Framework conventions and idioms, as well as pointers into the .NET Design Guidelines. So when this book, Framework Design Guidelines: Conventions, Idioms, and Patterns for Reusable .NET Libraries was announced, I was pretty excited about it; as soon as it came out, I made sure I got my hands on a copy. This book gives advice for programmers designing .NET libraries so that they resemble the .NET framework itself, allowing other programmers to pick it up more easily.
The book is very succinct, which I like. It’s arranged like a functional specification with chapters, headings, sub-headings, sub-sub-headings… Every section has a number and a title. It’s very orderly making it easy to read: everything is in digestable little chunks. With only nine chapters and topping out a lean and mean 327 pages including Annexes, the book has a very tight focus. For each section, they have a set of advice codified in quick little comments: DOs, DO NOTs, CONSIDERs, and AVOIDs. The bold highlights for those points make it easy to find when looking this up as a reference.
Like I mentioned at the beginning, I’ve been reading Brad’s blog for a couple of years (Krzysztof’s for about a year). I’ve also been using FxCop for a while on my projects, so a lot of the advice was already familiar to me, although there were a number of times that I went: “Oh yeah! I remember that.” Even still, I definitely learned something in every section. I also appreciated, even though .NET 2.0 hasn’t shipped yet, advice on generics; it means the book will last at least another version of the framework, probably more. The most helpful thing about the book were the annotations for the guidelines by Brad, Krzysztof, and other programmers both from within Microsoft and without. Those sections were great for two reasons: 1) since it reads like a technical document, the annotations put a human face on the writing; and 2) they point out where they screwed up the framework. All the little warts on the framework: misnamed classes, inappropriate interfaces, Exception types that are useless (like ApplicationException) are outlined in the text. That’s really good: it shows that these guys really care about putting out a great product and that creating a framework is f-ing hard; there’s a lot to consider. I recommend you follow all their advice. I’ve been trying to follow the guidelines for my project at work. Following the advice makes it a lot easier to version my framework and it makes it more .NET-like, so I can save time on documentation ;). I only disagree with one section on System.Uri for a special, but important, case that I happen to be stuck in. (Say, that sounds like a good idea for a blog post.)
I heartily recommend this book if you’re developing in .NET; even if you’ve got a one-project solution and you’re only using Framework classes (i.e. you’re not developing a framework), this book will benefit your efforts. If you are developing a framework targetting .NET, this should be mandatory reading.
DO buy this book.
DO read it cover to cover
DO review it periodically.
AVOID other books that claim to help you with this stuff. (More to follow on that.)
Mr Haack posted recently about a topic near and dear to my heart: inheriting from Exception. To keep FxCop quiet, there is a surprising amount of code to write when creating your own exception types, as Phil notes: make it serializable, implement four constructors, etc. It can be tedious to do that every time you create your own exception. So, code generation is definitely the way to go, however, this is where I must respectfully part ways with Phil.
After playing with both code snippets and item templates, I find item templates to be a superior method for class-level code generation. Unfortunately, in all the betas of VS 2005 I’ve tried, there is no easy way to generate an item template easily (File -> Export Template never works, although I’ve not used any of the CTPs). I’ve outlined how to do it for beta 1 in a previous article. There are very few differences with Beta 2 and hopefully RTM (elements became attributes in the vstemplate file). Then creating a new FxCop-compliant Exception class is as easy as adding any class file to a project. On the other hand, a code snippet requires a file to already exist and if you’re abiding by the Microsoft’s guidelines of one public type per file (you are, right?), then you have to do all that work up front.
But the above advice is essentially useless for everyone: VS 2005 isn’t out yet (but it’s close)! Wouldn’t it be great to get this with Visual Studio 2003? Well, you can’t by default: that’s one of the reasons VS2005 is so compelling. However, there are third party tools to help you. Before it became not free, CodeSmith allowed you to generate code at the file level, so I whipped up this template file for all my Exception building needs. Just run it in CodeSmith (v2.x if you’re lucky (and cheap)). Of course, there is the way Phil does it as well. Your mileage may vary.
Download the CodeSmith FxCopException.cst template.
To be really nice to all 3 readers at jasonkemp.ca, I also whipped up an FxCopException item template for VS 2005. Aren’t I sweet? Just drop it in My Documents\Visual Studio 2005\Templates\ItemTemplates\
Download the FxCopException Item Template for VB
Download the FxCopException Item Template for C#
Last night, Mr. Fox and I went to see Audioslave live in Vancouver: Great fuckin’ show!
Tonight’s top 10 list is the top ten things about going to see Audioslave live in Vancouver.
10. Full and broken ferries delayed us so much that we missed the first act whom I had never heard of.
9. The wafts of pot smoke that passed us by after being patted down by the gruff, yet gentle, security staff for drug paraphernalia.
8. Seether(the other opener)’s last song: a cover of Nirvana’s Drain You.
7. Spoonman with the real Spoonman.
6. Chris Cornell’s working the crowd, which I wasn’t expecting to be very good.
5. Black Hole Sun. Chris Cornell solo. Acoustic. Everyone singing along.
4. The roadies changing a snare drum in the middle of song.
3. Tom Morello’s stage presence and insane guitar tricks. (I would have loved to be down on the floor to watch him play)
2. All the fans’ fist pumping and head banging to the Rage covers: Killing In the Name Of, Sleep Now in the Fire and an instrumental Bulls on Parade.
And the number one thing about going to see Audioslave live in Vancouver:
1. All the tits.
Joel wrote a piece a few months ago entitled Hitting the High Notes. It seemed to piss a lot of people off, as Joel is wont to do. (I agree with Joel, and also with Jeff Atwood: most software doesn’t need to hit the high notes.)
Well, now Eric Sink, the id to Joel’s ego, whom Joel holds in high regard, has responded with an excellent piece. Worthwhile; you should read it.