Today I'm attending Brad Abrams and Krzysztof Cwalina's talk on "Framework Design Guidelines". I got a copy of their new book just for attending -- cool! Of course, we were all affected by the power outage in LA which delayed things for a bit. I think it was all the flat screens, projectors, computers and geeky gadgets here at the PDC that caused the problem...
I spend a lot of time reading Brad and Krzysztof's blogs so it's really neat seeing them in person.
Anyhow, they are essentially going over much of what their new book is about, how to design a great public API that is in the same style and has the same best practices as the .Net Framework itself. Lots of great learnings.
To give you a sample: when you are defining EventHandlers, its best to create your own delegate and have a subclass of EventArgs as your second parameter... even if you don't have anything specific to put in it now. Why? Because if you ever need to pass arguments to your listeners of that event (by changing the delegate definition), you'll have to break the API for all listeners.
Generics makes the definition of the EventHandler much nicer now that they have a generic EventHandler type that takes two types, one for the sender and one for the EventArgs.
0 Comments:
Post a Comment
<< Home