AboutSQL Server, Analytics, .Net, Machine Learning, R, Python Archives
About Me
Mitch Wheat has been working as a professional programmer since 1984, graduating with a honours degree in Mathematics from Warwick University, UK in 1986. He moved to Perth in 1995, having worked in software houses in London and Rotterdam. He has worked in the areas of mining, electronics, research, defence, financial, GIS, telecommunications, engineering, and information management. Mitch has worked mainly with Microsoft technologies (since Windows version 3.0) but has also used UNIX. He holds the following Microsoft certifications: MCPD (Web and Windows) using C# and SQL Server MCITP (Admin and Developer). His preferred development environment is C#, .Net Framework and SQL Server. Mitch has worked as an independent consultant for the last 10 years, and is currently involved with helping teams improve their Software Development Life Cycle. His areas of special interest lie in performance tuning |
Wednesday, January 31, 2007.NET Framework Design Guidelines (Book Review)
I believe that good technical books fall roughly into 3 categories:
Who should read this book? Architects, API and Framework designers, lead developers, junior developers who want to be senior developers(!). Basically, anyone who is designing frameworks or writing code targeting the .NET framework. The book is divided into 9 chapters and 3 appendices. The guidelines are presented in 4 major forms: Do, Consider, Avoid and Do Not. The authors choose a single language for the examples (which are in C#), which rather being a snub to VB.NET developers is rather more of a complement, as they mention they wanted the book to appeal to the widest audience. A DVD is also included containing several hours of video presentations. This book represents the condensed wisdom and best practices of literally hundreds of developers, and a number of well known and respected, industry heavyweights have annotated the book, providing discussion and reasoning behind the guidelines. 1. Introduction This chapter is a brief introduction and discusses the qualities of a well designed framework and the philosophy behind the design. In summary, frameworks are: simple, expensive, full of trade-offs, borrow from previous designs, are designed to evolve, are integrated and last but not least, are consistent. 2. Framework Design Fundamentals Offers principles and guidelines central to framework design. Talks about scenario-driven design (very similar to TDD), having a low barrier to entry, self documenting wherever possible, the principle of layered architecture, API usability studies. 3. Naming Guidelines Consistent and accurate naming is an essential principle of designing and writing all code. Krzysztof writes: “The team that develops the .NET Framework Base Class Library spends an enormous amount of time on naming, and considers it to be a crucial part of framework development.” As a consultant, poor method naming is something I see often. As Steven Clarke notes, methods should be named according to what they do, not according to some implementation detail. 4. Type Design Guidelines This chapter provides general guidelines for the design of types and covers some of the associated subtleties and tradeoffs. This is a heavily annotated chapter, brimming with excellent advice. 5. Member Design This is one of the slightly longer chapters (57 pages), and follows on from chapter 4, covering basic guidelines that should be followed when designing members of any type. It covers the design of properties, constructors, events, fields, operator overloads, and parameters. I seem to learn something new each time I re-read this and the preceding chapter. 6. Designing for Extensibility How do you ensure that your framework will be extensible and stand the test of time? This chapter covers unsealed classes, protected members, events and callbacks, virtual members and abstractions. The annotations in this chapter contain several gems of advice, including determining the trade off of extensibility versus performance and some of the subtleties of creating types with virtual members. 7. Exceptions This chapter is surely the definitive reference for exception handling. It covers the reasoning and benefits behind using exceptions and the best practices in creating and using them within frameworks. Required reading for all developers. [David M Kean posted excellent advice on which exceptions to raise here.] 8. Usage Guidelines This chapter covers guidelines for the use of common types in publicly accessible APIs, implementing common interfaces and extending common base classes. 9. Common Design Patterns Chapter 9 does not cover the subject of design patterns in general; rather it discusses a limited set of patterns that are frequently used in the .NET framework. Conclusion There is little doubt that a few paragraphs can adequately capture what is contained in the Framework Design Guidelines, or the amount of cumulative effort that has gone into producing this distilled wisdom. If you are a serious .NET developer then you should definitely have access to a copy of this must-read book. My favourite quotes from the book: “I have always felt that a key characteristic of a framework must be consistency”, Anders Hejlsberg in the foreword. “Frameworks must be designed starting from a set of usage scenarios and code samples implementing these scenarios.” Labels: .NET Framework, book review, design, microsoft Tuesday, January 30, 2007Writing Quality Code - Free e-Book
Dave Glover posted a heads-up on this great, free e-book written by some our local Aussie talent, Dr Neil Roodyn, Nick Weinholt, Rocky Heckman, Mitch Denny, Paul Glavich and Adam Cogan. You can download it from here (and the dnl reader from here) .
When to Throw Specific Exceptions
David M Kean has posted excellent guidelines on what specific exceptions should be thrown from within your .NET code. For an overview, see my post here.
VS2005 Cheat Sheets
A few months ago I posted Visual Studio 2005 IDE Productivity Tips and Tricks, and I just noticed that Rob Caron posted about these very handy VS2005 Cheat Sheets which can be downloaded from Microsoft.
Monday, January 29, 2007PowerShell Cheat Sheet
The PowerShell team have released a pdf cheat sheet which you can download here.
Sunday, January 28, 2007Be Your Own Client
Don Box posted that Chris Sells has long been an advocate of 'Be your own client'.
This approach is not just suited for API design, but for just about any design task, especially user interaction. ASP.NET AJAX 1.0 Released
Probably old news for most people, but just in case you missed it ASP.NET AJAX 1.0 was released a few days ago. You can download it here.
Friday, January 26, 2007Great CSS Techniques
I recently purchased "The Zen of CSS Design" by Dave Shea and Molly Holzschlag and I would highly recommend it to any web designers or graphic artists working in the area of web design. You can visit the accompanying site CSS Zen Garden which is "A demonstration of what can be accomplished visually through CSS-based design", and tries to address "the need for CSS to be taken sereiously by graphic artists."
I also came across this link to a collection of excellent CSS techniques to solve common design tasks. Well worth book-marking: 53 CSS-Techniques You Couldn’t Live Without If you are interested in this topic you should check out the recently released CSS Control Adaptor Toolkit from Microsoft, which basically enables ASP.NET 2.0 controls, which normally render as HTML markup, to be emitted as pure CSS based output. Scott Guthrie has a quick introduction to what they are and how they work here. UPDATED: I also came across the CSS Handbook site. Also, check out this CSS cheat sheet. For discussion on the pros and cons of Table versus CSS layout see Bill Merikallio and Adam Pratt's Why tables for layout is stupid. There's a more balanced look at the two approaches at Tables vs. CSS: PROS and CONS. (saw this via Scott Mitchell over at 4GuysFromRolla) Labels: ASP.NET, control adaptors, css, design, html Thursday, January 11, 2007What Would You Do Next?
Darren Neimke posted an interesting question on a situation many developers/managers find themselves in. I’ve quoted it in full below:
Even though Darren posted this over a week ago I thought I would chip in with my 2 cents worth and attempt to answer some of these questions, beginning with a few of my own:
#2 and #3 are really the same thing. #3 is preferred (more than one scenario occurs when the use case has alternate paths, but these still achieve the main goal of the use case)
As soon as you have a set of use cases, you can perform textual analysis upon them to figure out candidates for your classes and methods (nouns and verbs). By this point, you should have enough information to break up your application into smaller pieces of functionality, and have a better handle on how much development time is required. Tuesday, January 09, 2007A Little Gem of a Book: “The Elements of C# Style”
Here is some condensed wisdom for C# programmers from a ‘must read’ book, The Elements of C# Style. This book models itself in the tradition of “The Elements of Style”, and is a similar physical size, which means you can easily read it cover to cover in very little time.
I did find a couple of typographic errors and one bit of advice which is considered wrong if you go with the recommendations in the Framework Design Guidelines by Brad Abrams and Krzysztof Cwalina; namely, point #157 states that you should derive custom exceptions from ApplicationException. These should be derived instead from System.Exception. I believe point #48 should read: Sunday, January 07, 2007.Net C# Singleton Pattern - Best Practice
What is the best practice way to implement the Singleton design pattern in C#? You might be surprised at the number of flawed examples there are out there; many of the articles I looked at were incorrect (some subtlely, some not so) and several were on high traffic, popular sites!
This excellent article by Jon Skeet not only discusses several ways not to do it, but also the correct way: public sealed class Singleton { // Prevent compiler adding a default public parameterless constructor private Singleton() {} public static readonly Singleton Instance = new Singleton(); // Explicit static constructor instructs compiler // NOT to mark type as ‘beforefieldinit’ // Remove this if you do not need to guarantee lazy instantiation static Singleton() {} } The static constructor is only required if you want to guarantee lazy instantiation (which Jon explains here.) See also this MSDN article from Feb 2002. Saturday, January 06, 2007Perth .Net UG Meeting - 10th Jan 2007
We are starting the year with an exciting talk by David Lemphers on his explorations into .NET and Robotics, 5:30pm, Weds 10th Jan 2007.
Please note that this meeting will be held at the Microsoft offices, level 14, QV1 building, NOT at the new Excom venue. Look forward to seeing you there! He is also presenting on SQL server to the SQL UG the following evening at Excom. Chance Quotes
Nick Randolph tagged me a while ago as part of the ‘5-things’ tagging meme pervading the ‘blogosphere’. Try as I might, I couldn’t find 5 things about me that I thought others would be interested in knowing (sad, I know), so instead here’s a few quotes and food for thought from interesting people about chance:
Chance favours the prepared mind – Louis Pasteur. I will study and get ready, and perhaps my chance will come - Abraham Lincoln God does not play dice [with the universe] – Albert Einstein Men are not prisoners of fate, but only prisoners of their own minds - Franklin D. Roosevelt Fortune can, for her pleasure, fools advance, And toss them on the wheels of Chance - Juvenal (55 AD - 127 AD) No victor believes in chance - Friedrich Nietzsche A lie gets halfway around the world before the truth has a chance to get its pants on – Winston Churchill When a man is pushed, tormented, defeated, he has a chance to learn something – Ralph Waldo Emerson Fortune knocks but once, but misfortune has much more patience - Laurence Peter Great lives are the culmination of great thoughts followed by great actions - Peter Sinclair Chance is always powerful. Let your hook be always cast; in the pool where you least expect it, there will be a fish - Ovid (43 BC - 17 AD) The Churchill quote is a bit of an odd one out. |
ContactMSN, Email: mitch døt wheat at gmail.com LinksFavorites
Blogs |