More Of The Same?
If you have read any of Francesco Balena's previous excellent and widely praised books you will probably already have an idea in your mind of what to expect with this latest one. However this book isn't simply a revamp of the previous ones and for some people that discovery came as a bit of a shock.
It's very natural to assume that this book is going to be the updated version of the previous ones. However this isn't really the case. This time the author has purposely chosen to take a narrower focus of topics, but to deal with those topics - which he assesses to be the core areas required for mastery of the 2005 version - in particularly fine detail.
Some people were surprised about this change of approach and as a result some of the early reviews on Amazon and similar review sites were negative - an almost unheard of event when it comes to Balena books! In particular, the complaints centred on major topics that seemed to be missing; Some of the advertising that had been used - such as this being the "Definitive One-volume reference" were also questioned. So, it came to the point that the author felt that he needed to respond and clarify the situation. Here is what he said:
I am writing a "review" of my own book to ensure that potential buyers know exactly what the book contains, how it is structured, and why.
First and foremost, this book does **NOT** cover all the topics that its 2002 and 2003 editions do. Most notably, it doesn't cover Windows Forms, ADO.NET, ASP.NET, plus other advanced topics such as serviced components, and security.
The point is, there are so many new things in the .NET Framework 2.0 and a single book can't cover them with the necessary level of detail. If I had squeezed all these topics in a 1400-page book (which is the largest book my publisher would allow me to write), the result wouldn't be satisfactory anyway. If you are interested in these high-level topics, you should purchase a book with a narrower focus, for example the excellent "Programming ASP.NET" by Dino Esposito.
After a lot of hard thinking, I decided to focus solely on important topics that, in my opinion, very few books cover adequately, namely the Visual Basic 2005 language and the most important base classes in the .NET Framework 2.0: basic data types, arrays and collections, resources, files and streams, object serialization, threading, PInvoke and COM interop.
After I took the decision, I had to face the problem of choosing the best title for the new edition. Some portions of this book are taken from its previous editions, therefore the title should have been close enough to make the relation clear. At the same time, the title should have been different enough to emphasize that it isn't a new edition the **same** book. In the end, I opted for appending "The Language" to the original title, hoping that this difference was apparent enough as to have readers of previous edition look more closely at its Table of Contents and understand that some chapters were missing.
The new edition covers in all the new features of the language a very detailed manner, including generics, the My Namespace, unsigned integers, partial classes, operator overloading, and custom events.
But this book is more than just a reference book; rather, it is about **programming techniques** that you can implement with Visual Basic 2005 and base classes in the .NET Framework 2.0. For example, I devote an entire chapter to explain how reflection can be useful to solve recurring programming problems in a very elegant manner, whereas another chapter describes how you can custom attributes to implement plug-ins for Windows Forms application and n-tier, data-centric applications. The chapter on regular expressions shows how you can use this under-utilized .NET feature to parse html files, read comma-delimited and fixed-length data files, perform quite sophisticated input data validation, and more.
Finally, it makes little sense to focus on the language and know nothing about the IDE, and for this reason the book devotes over 110 pages to improving productivity by means of the old and new features of Visual Studio, such as macros, code snippets, tracepoints, unit testing, code coverage, code analysis, and more.
You can read more about this book, including the complete Table of Contents and a couple sample chapters, on my blog hosted by the dotnet2themax web site.
Given that clarification, potential buyers will now be in a much better position to decide if this book will be useful to them.
So, Who Should Read This Book?
In his book Introduction the author says that "The short answer is that this book is for all Visual Basic 2005 Developers". He then goes on to refine that answer by listing several classes of potential readers.
Having now worked through much of the book content myself now, I find it easy to agree with his first one line answer (all VB 2005 developers) but would add the rider: "as soon as you are ready for this level". In other words, this is not a book for beginners, even though the initial chapters do cover a wide range of core basic topics. However, it isn't just an Expert book either. Or an Intermediate one. It's a bit of all of them and in truth, it's even harder than usual to identify exactly the answer to the usual question of "Who should read this book?". If I was forced to come up with the definitive answer I would say "If you are going to continue using VB 2005 and want the means to improve your knowledge and skills as you reach higher and higher levels then you should read this book".
As a reference source for techniques it is superb. For clear explanations in detail on those areas selected for in-depth coverage, this is classic Balena. But if you want the more hand-holding introduction to a wider range of VB.NET subjects then you should probably check out his previous VB.NET book before moving on to this one.
I think you'll get the idea of who the publishers want to attract if you look at the back cover blurb. It says:
Discover how to:
• Compress files, manipulate ACLs, use semaphores, and exploit other new capabilities in the .NET Framework 2.0
• Implement generics to define a type-safe data structure
• Use inheritance, polymorphism, interfaces, delegates, and attributes to write flexible applications
• Use the My namespace to perform common tasks more easily
• Work with the new editing and debugging features of Microsoft Visual Studio 2005
• Master regular expressions and perform complex text searches and input validation
• Take advantage of streams, serialization, and threading techniques
• Implement advanced programming techniques based on custom attributes, reflection, and on-the-fly compilation
• Interact with legacy code by using PInvoke and COM Interop
• Understand key differences from Visual Basic 6.0
I don't think any .NET Newbie could complain that they were misled into thinking this is a beginners book after reading that.
At the bottom of this page you'll find a fairly comprehensive Table of Contents, but if you want the whole picture in much more detail then you should view the author's website to see the detailed contents list in PDF format. There you will find a 14 page breakdown of the 4 Parts, 22 Chapters and innumerable Sections within each Chapter, and you can view it here.
The first five chapters will take you through an overview of their individual topics at a bit of a canter. If you are new to VB.NET then you may find your head whirling at this stage and you'll have that weird feeling you sometimes get that your eyes are scanning the words but it's not all going in. But if you have used VB.NET 2002 or 2003 then I think you'll find these chapters very useful for clarifying areas that you didn't previously fully understand. In my own case, this was the topic of Boxing and Unboxing. I had vaguely understood the concept previously, but the clearly written example in Chapter 2 finally enabled my woolly grasp to crystalise into genuine understanding of (a) what it is and (b) the implications of their use.
This first Part is very useful as a way of reinforcing topics you have already had dealings with, reminding you of things you'd known but forgotten and, of course, to introduce you to general information that had up until now not appeared on your .NET radar.
Part 2 covers a range of Object-Oriented Programming subjects. These include not only those topics you may have carried forward from your .NET 2003 knowledge but also new features only now made available in VB 2005, such as Partial Classes and Operator Overloading and, of course, Generics. In fact, the complete 36 page chapter devoted to the subject of Generics is one of the ones you can download and view in PDF format from the author's web site. The link is here. If you find that you can't access the page then you may have to go back a step and register with the site, which is a temporary nuisance, but a relatively small price to pay for access to the information. The website link for this book is here.
In Part 3, the widely titled "Working with the .NET Framework", the topics of .NET Basic Types (some not quite so "basic" as others!) are covered in detail, followed by Arrays and Collections, and then Regular Expressions are demystified somewhat. Files, Directories, Streams, Assemblies and Resources are also covered. The brand new for 2005 My Namespace gets it very own chapter and contains more detail than I recall reading in any other source - excellent!
Part 4 is titled "Advanced Topics", (but don't let that fool you into thinking that the preceding topics are kindergarten stuff!). They include a monster sized chapter on Reflection, plus comprehensive coverage of Custom Attributes, Threading, Serialization, PInvoke and COM Interop. From what I see on the VB Forums currently, Reflection in particular is a much underused and often misunderstood topic; if you haven't had much dealings with it in your VB.NET journey thus far then you should really home in on this chapter. Inevitably some of the samples are longer than those in earlier chapters, but the effort will pay long term rewards. You can in fact view this chapter courtesy of the dotnet2themax website.
I wrote the quick summary above while I was working through the book myself. It wasn't until I visited his web site today that I see that the author has included his own short version of the book contents and this is reproduced below:
Part I : The Basics
1. Introducing the .NET Framework (12 pages): a quick overview of basic concepts in .NET programming.
2. Basic Language Concepts (70 pages): modules, classes, variables, arrays, operators, etc. plus what you need to know about inheritance and attributes so that you can read next chapters, before chapter 8 and 19.
3. Control Flow and Error Handling (40 pages): If, Select, For, For Each and other basic statements; error handling, with many not-so-obvious techniques to improve code efficiency and programming style.
4. Using Visual Studio 2005 (56 pages): the many new features of VS2005 IDE, plus many old features that not all developers know; how to write a code snippet for VS2005; templates, refactoring, and a brief but intense tutorial on VS macros.
5. Debugging and Testing (56 pages): breakpoints and tracepoints, data tips, how to write a cusom visualizers, trace commands and trace listeners (including custom listeners), benchmarks and profiling, unit testing, and code coverage.
Part II : Object-Oriented Programming
6. Class Fundamentals (42 pages): the "usual" story about classes, methods, properties, etc. plus the new partial classes and operator overloading, all peppered with the description of relatively unknown programming techniques.
7. Delegates and Events (26 pages): a small chapters with many details and secrets on how to use these VB features in real-world apps. It includes the new custom events.
8. Inheritance (34 pages): inheritance at its best, including visual (form) inheritance and many real examples.
9. Object Lifetime (28 pages): everything you might need to know about garbage collection, the Dispose/Finalize pattern, weak references, GC generations, object resurrection, and other advanced techniques that can take your app to the next level
10. Interfaces (28 pages): how to define a custom interface and, above all, how to leverage those that .NET provides you with, such as IComparer and IEnumerable.
11. Generics (40 pages): half of what you want to know about this new great .NET 2.0 feature (the second half is in chapter 13), including constraints, nullable types, and many examples of programming techniques that are based on generics.
Part III : Working with the .NET Framework
12. .NET Basic Types (50 pages): working with strings, numbers, and dates at their best, including many little/big new features of .NET 2.0
13. Arrays and Collections (53 pages): arrays, jagged arrays, "traditional" and generics collections, plus many tricks for writing less code that runs faster.
14. Regular Expressions (40 pages): a reference of regex syntax, plus many practical examples on data validation, data parsing, and even code parsing. If you aren't familiar with regexs you are missing a great occasion for writing better code in less time.
15. Files and Streams (42 pages): an overview of all the types in System.IO and the many new features in .NET 2.0, including ACL support, compressed streams, and the TextFieldParser type.
16. The My Namespace (48 pages): how to use the My namespace and how to extend it as you need.
17. Assemblies and Resources (44 pages): despite of their importance, resources (either simple or localized) are used rarely and unproperly by most developers; this chapter includes a complete description of the many important features added to NGEN.
Parti IV : Advanced Topics
18. Reflection (58 pages): there is a lot to say about reflection; among the many examples I wrote an app that generates code on the fly, a scheduler for undoable actions, and a universal comparer class.
19. Custom Attributes (46 pages): this chapter includes a few complete and nontrivial examples of how a custom attribute can make your coding simpler, for example by means of Windows Forms plugins and a framework for n-tier apps.
20. Threads (54 pages): the Thread object, asynchronous delegates, thread pool, the SyncLock statement, all the synchronization types, including the new Semaphore. Plus a section on threading in Windows Forms aoos.
21. Object Serialization (32 pages): binary and SOAP serialization, version-tolerant serialization in .NET 2.0, the new attributes for serializatoin, custom serialization, serialization surrogates, the IObjectReference interface, and more.
22 PInvoke and COM Interop (40 pages): How to interact with unmanaged code: calling "classic" DLL and Windows API methods; using COM components (including the new registration-free components); writing .NET components that can be used from COM apps.
A Good Investment For You?
The Balena style is often described as being "concise" and I think this is a fair description. There is very little duplication, code samples are kept as short as possible and (unlike your reviewer!) the author doesn't believe in using 100 words if 10 will do. This has to be accepted and acceptable, otherwise - given the maximum available pages in a book - the number of topics covered would be reduced even further. So for those who find it dry or would have liked more amplification, my advice would be to read through the problem topic again (a couple more times if necessary) as it is all there to be discovered and understood, given a little perseverance and code sample experimentation.
I have a particular bee in my bonnet about typos and errata. I know that they are almost inevitable, but some publishers and indeed some individual authors are very poor at posting these up in an easily accessible place and form. Happily, Francesco Balena isn't one of those authors and, even though the book hasn't been in print for a great length of time there is already a useful, regularly updated, viewable list of all typos and errors that have been found so far. The list is available here.
"Programming Microsoft Visual Basic 2005: The Language" is much more than just a language reference book. The basics of VB 2005 are given reasonable coverage within the space limitations, but for my money the strength and great value of this book lies in those specialised topics in the later Parts. The author draws on his deep understanding of .NET in order to bring you insights into many of the dark corners of this subject, drilling down in illuminating detail on specifically chosen topics.
If you have some VB.NET experience and want to strengthen your knowledge base, be more productive and understand in detail the new features of VB 2005 then this book is a must-read for you. Once you realise that this isn't simply an update of his earlier books, but a fresh book with a different approach, you will have no cause for disappointment.