Preface


If you've picked up this book, you're probably among the many programmers who have come to appreciate how powerful the Microsoft .NET Framework can be as a platform for development. But you've also learned that, as with any platform, .NET has quirks that can trip up even the savviest programmer. Have you been surprised by feature behavior in the .NET language or the .NET Frameworkincluding the CLR and Framework Class Libraryor in Visual Studio .NET? If you've worked with .NET for any length of time, I suspect you are nodding your head with a sigh of agreement. Experience teaches us what to do and what to avoid, but in programming, we commonly acquire our knowledge the hard way: by making costly, hard-to-debug and time-consuming mistakes. My goal in writing this book is to save my fellow developers from some of that pain, by sharing the experiences (and bad code) that brought the pitfalls of .NET to light for me, and showing you how to avoid them (and write code that works).

I started working with .NET when it was in pre-release Beta 2. The following years have been a lot of fun. However, there have been days (and nights) when things were not so obvious, when the code would behave, shall I say, strangely, given my expectations as an experienced developer.

The gotchas and guidelines presented in this book have come from three sources: First, the insights I have gained from developing .NET applications. Second, the questions raised by the hundreds of inquisitive software developers I've had the privilege of training. Third, the thought-provoking articles and discussions I have come across at symposiums, user-group meetings, the Internet, as well as the MSDN documentation itself.

What's a GOTCHA? According to Merriam-Webster, gotcha is defined as follows:

     "Main Entry: got:cha     Pronunciation: 'gä-ch&     Function: noun     Etymology: alteration of got you     : an unexpected usually disconcerting challenge, revelation, or catch." 

For me, .NET gotchas are those things that pop up unexpectedly when you're programming in .NET. Things that are buried, just waiting for you! It is as if the environment is there, aware of its own idiosyncrasies, watching you as you work, but unable (or unwilling) to warn you as you fall into one of its traps.

I'm not talking about those little annoying quirks in Visual Studio that make it misbehave occasionally, nor the transient flaws you see while working with the debugger or editor. In this book, I focus on the .NET Framework and language features that have consistently exhibited behavior that was not obvious to me. Why should you be interested in learning about these? Because knowing these little gotchas will help you avoid mistakes. You'll develop applications more quickly. Some solutions will improve the performance of your applications. Others will help you stay clear of problems that will make your code incorrect. Yet others will help you with hidden problems such as proper garbage collection.

Most books on .NET start by assuming that the reader knows little about it. Those books are intended to bring readers up to speed with .NET or one of its associated languages. As more and more people learn to use any technology, a need arises not just to learn how use it, but how to use it well, and do things right. Because experience is our best teacher, it always takes a few years for books that address those needs to appear.

Consider my own case, some years ago. I had taken the time to learn the C# language and was a serious developer (or so I thought), working hard to put the features and facilities of the language to prudent use. One day in the early '90s, I walked into my colleague's office and found a book entitled C++ FAQs by Marshal Cline on her table. Picking it up, I asked "Why would anyone who knows C++ read a book that lists questions and answers?" She smiled. I flipped through a few pages, and before I knew it, I found I had been standing there for several minutes reading the book, page after page. She finally interrupted and said, "Why would anyone who knows C++ be reading that book for so long?" I found it to be invaluable and bought a copy for myself (and I still have that book and its next edition in my library!) Other great books that I have enjoyed reading are Effective C++ and More Effective C++ by Scott Meyers, Essential COM by Don Box et al., and Effective Jav a by Joshua Bloch.

Programming in .NET has entered a stage where a large number of developers have learnt how to program what was a brand new platform only a few years ago. The time has arrived for books that teach good practices. I hope this book will serve, like the classics on COM and C++ that have preceded it, to educate software developers on the dos and don'ts of programming the .NET platform.



    .NET Gotachas
    .NET Gotachas
    ISBN: N/A
    EAN: N/A
    Year: 2005
    Pages: 126

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net