Thoughts from the office by Ed Ball
Friday, February 27, 2004

I've already done lots of reading on the C# programming language, so I must admit that I mostly skimmed The C# Programming Language, by Anders Hejlsberg et al. This book is quite easy to read, and it has anything you'd ever want to know about C#, so if you're writing serious C# code, you'd certainly benefit from having this book available.

Part I is about C# 1.0, and I mainly skimmed the table of contents here. One section that caught my eye was “Atomicity of Variable References,” in which I read that simple reads and writes of integral types of 32 bits or less are guaranteed to be atomic. That's good to know; I'd hate to use a lock around a simple integer if I didn't have to.

Part II is about the eagerly anticipated C# 2.0, and I enjoyed reading about it. I'm greatly looking forward to generics, anonymous methods, and iterators, and enjoyed reading the fine details. It looks like they did a thorough job, and I think the new features will make C# a far better language. Whether it will be good enough to keep me away from C++ remains to be seen...

2/27/2004 4:39:05 PM (Pacific Standard Time, UTC-08:00) | Comments [0] | Books#

It feels a bit odd to review a book that's almost 10 years old, but I wanted a quick introduction to SQL, and Lan Times Guide to SQL by James R. Groff and Paul N. Weinberg proved quite useful in that regard. Being a client application developer, I've done a good job of staying away from relational databases and their associated technologies to this point. I've always secretly wanted to learn more, though, and the increasing ease of interacting with databases (e.g., ADO.NET) finally made me cross the line and, at minimum, read a book.

I used SQLite to explore SQL as I read the book, and it worked out great. There's no complex database server to install with SQLite; rather, there's a simple command-line interface for creating/opening a database and executing arbitrary SQL commands against it. Furthermore, the source code is all in the public domain, so it can easily be used even with commercial products. There's even an ADO.NET interface – SQLite.NET, a SourceForge project that uses the BSD license.

The book is not about any particular SQL implementation, so it proved quite useful in getting the basics, and getting a feel for where the syntax might change among implementations. Most of the book was exactly what I was looking for – simple examples of the various commands that are possible with SQL. I'm certainly no SQL expert after reading this introductory book, but I feel like I have a good foundation, and I'm looking forward to incorporating a relational database in a future development project.

2/27/2004 2:45:37 PM (Pacific Standard Time, UTC-08:00) | Comments [0] | Books#
Thursday, February 26, 2004

Component-Based Development With Visual C#, by Ted Faison, may aspire to be about component-based development, but it is mostly about describing the full breadth of programming possibilities exposed by Visual Studio .NET. To be fair, the first few chapters provide a good introduction to the development process, software components, and component design, including the classic design patterns. Each topic deserves its own book, of course, and many have been written, but it does provide a nice overview.

The rest of the book is about writing components for the .NET Framework in C# using Visual Studio .NET. The book touches on an amazing array of topics, but it is clear that the writer is not an expert on all of them, and, in fact, knows quite little about some of them, as evidenced by frighteningly inaccurate statements about the registry and shortcut files. This book might be useful for programmers that are new to Windows programming with Visual Studio .NET, but, by itself, it will give them just enough rope with which to hang themselves.

(One final note: The Web sites mentioned in the book are no longer valid links. The book is now being sold by Wiley, but I could not find any link to download the source code.)

2/26/2004 2:03:16 PM (Pacific Standard Time, UTC-08:00) | Comments [0] | Books#

I'm really looking forward to the next release of the .NET Framework. There is so much cool stuff coming, it hardly seems worth writing .NET code that targets the current version... Generics is far and away what I'm looking forward to the most. I'm also looking forward to the complete redesign of Managed C++; C# is a great language, but I want the best of both worlds!

Anyway, it sounds like there will be some improvements to Windows Forms as well, which is great news, considering how long we're going to have to wait for Longhorn...

2/26/2004 10:01:50 AM (Pacific Standard Time, UTC-08:00) | Comments [0] | Code#
Monday, February 23, 2004

I enjoyed reading Effective XML: 50 Specific Ways to Improve Your XML, by Elliotte Rusty Harold. Fortunately, I have not been engaging in particularly ineffective XML, but I haven't found practical advise like this anywhere else. Even the introduction was useful, as it clarified often misused terms like “element” and “tag”.

Part 1, on Syntax, encourages us to include an XML declaration and use ASCII for tags, neither of which I can disagree with. I was surprised that he didn't insist that I include the “standalone” attribute in my XML declarations; I seldom create documents that aren't standalone, and feel guilty that I don't include that attribute... His advise to “Stay with XML 1.0” was good to hear, particularly since XML 1.1 was just released; his arguments seem valid to me. I tend to stay away from DTDs – I suppose I just haven't felt that the added complexity would be worth the trouble – so the related items weren't as important to me. I like the concept of using standard entity references (e.g. Ě) instead of character entities (e.g. ě), but the subsequent requirement of dealing with DTDs is too much for me. Also, though I've preferred hyphen-delimited element and attribute names in the past – the first XML-related specifications let me down that path – I'm coming around to appreciate the use of “camel case” for names, as they probably are more readable.

Part 2, on Structure, gives good advice on how to decide between attributes and elements, whether a date should be encoded as a single string (“2004-02-23”) or three elements (“<year>2004</year>...”), and even the proper use of processing instructions. He reminds us that mixed content is still important, and suggests using XHTML as the standard for rich text (or “narrative content”). He almost contradicts the advice about character entities in part 1 that I disagreed with, for the purpose of interoperability with parsers that don't read the DTD. I was educated on the finer points of URIs, URNs, and URLs, as used by namespaces. He gives a little help on picking a schema language, and clearly isn't fond of the W3C XML Schema Language. There are also a few guidelines that seemed obvious to me, but must be in response to common abuses of XML.

Part 3, on Semantics, starts with a great summary of the many XML-related technologies that have become available, in each case giving an unapologetic opinion as to the general usefulness of that technology. Needless to say, I'm now less concerned about the fact that I haven't yet learned XLink, XPointer, etc. He touches on the joy of XPath; I certainly can't imagine using XML without it, and the “non-portable” nature of the SelectNodes methods of Microsoft's XML parsers has been worth the productivity gains. He touches on the difference between “push” and “pull” XML parsers; unless performance demands it, I'd certainly recommend sticking with “pull” – the “push” style of SAX simply takes too much development effort in many cases. The book encourages me to validate documents, a lesson that I learned long ago with SGML, but have yet to bring into the world of XML, probably because DTDs just don't seem like a good fit for XML with namespaces, and no clear winner has yet emerged from the battle of the schemas...

Part 4, on Implementation, made me curious to learn more about “native XML databases,” and wisely suggests that XML has not replaced relational databases. Beyond that, part 4 didn't really hold my interest much, probably because my focus is on Microsoft technologies, and I'm basically locked in to using their tools and techniques. For the sake of the first three parts, Effective XML is definitely worth reading, and I recommend it to anyone developing with XML.

2/23/2004 1:55:33 PM (Pacific Standard Time, UTC-08:00) | Comments [2] | Books#

After reading the first few chapters of Programming .NET Components, by Juval Löwy, I had hoped that the book would primarily give specific advise about how to best do “Component-Oriented Programming” with .NET. The chapter on interface-based programming was a good reminder that I shouldn't abandon all of the component principles I learned when using COM, but most of the book consists of descriptions of the various features of .NET.

The book does examine some of the more complex aspects of .NET, including versioning, multithreading, and serialization. I skimmed the long chapters on remoting and interception; I understand the basic concepts, and will return when I find a need for those technologies. The chapter on security was especially welcome; it cleared up many of the questions I had about code access security in .NET, though I could still use more information and “best practices” in particular. Speaking of which, I unfortunately noticed a few violations of modern “best practices” for deterministic finalization, asynchronous calls, and synchronization, but that just goes to show that you need to keep up with the latest articles as well as reading the good books.

In summary, though I'd like to have read more about how to write great components in .NET, much of the information in the book was valuable, and my knowledge of the .NET framework is broader having read it.

2/23/2004 9:51:42 AM (Pacific Standard Time, UTC-08:00) | Comments [0] | Books#
Tuesday, February 17, 2004

Applied .NET Attributes, by Jason Bock and Tom Barnaby, is all about attributes in .NET. The book is a bit short at 200 pages, at least relative to most programming books these days. It covers the basic concept of .NET attributes, many of the standard attributes provided by the .NET Framework, and how to write and use custom attributes. I was already fairly comfortable with the concept, and the standard .NET attributes are really best documented in books that describe the features that they implement, so the most interesting sections were on custom attributes, and, more specifically, the use of custom attributes in implementing “aspect-oriented programming,” the programming technique that's all the rage these days, at least in terms of blog conversations.

I enjoyed reading the chapter on AOP, though I was ultimately disappointed by the fact that it is very unlikely that I'll be implementing AOP in my own code. For now, the overhead for making .NET classes AOP-compatible is too high, at least with the techniques described in this book, and I don't see the immediate value in supporting AOP for some classes and not for others.

Also, I wish that the example used in the chapter on custom attributes would have been a little more practical. I don't often find myself creating a custom compiler. My favorite example of custom attributes is how it can be used to parse command-line arguments; that application gives you a good idea as to the cool stuff that can be done.

Unless you're looking for a concrete example of how you could do AOP with .NET attributes, I can't say that I recommend this book; it just doesn't give enough bang for the buck.

2/17/2004 11:41:05 AM (Pacific Standard Time, UTC-08:00) | Comments [0] | Books#
Friday, February 13, 2004

User Interfaces in C#: Windows Forms and Custom Controls, by Matthew MacDonald, has the disadvantage of being the third of three books on Windows Forms that I've read recently. There wasn't much in this book that wasn't already covered by the other two. It is similar in content to Erik Brown's book, but doesn't have the overarching application to tie all of the chapters together. Like that book, it doesn't include much on security, localization, deployment, etc. – you'll need to go to Chris Sells' book for that.

The chapter on design was interesting, but I didn't really feel like the concepts were significantly carried through the rest of the book. The information on data binding was great – so much for my presumption that Windows Forms books wouldn't discuss data binding without databases. Hopefully I'll be able to incorporate data binding into a future Windows Forms application and give my newfound knowledge a try. Also, I wasn't familiar with “custom extender providers,” so I enjoyed reading a bit about those, and enjoyed the article on custom layout engines that he references in that chapter.

All in all, I'm glad to have read the book, and it should make a decent reference book as well.

2/13/2004 1:17:49 PM (Pacific Standard Time, UTC-08:00) | Comments [0] | Books#
Wednesday, February 11, 2004

In a way, Windows Forms Programming in C#, by Chris Sells, picks up where Erik Brown's book (of very similar title) leaves off. While Brown's book spends most of its pages describing and using the various controls that are available to Windows Forms developers, Sells' book doesn't talk much about specific controls. It instead focuses on less obvious (and poorly documented) features of Windows Forms and the .NET Framework in general, features that must be mastered to develop and ship a serious Windows Forms application. He does not ignore Visual Studio .NET, but neither is it critical to have a copy to productively read the book.

Unlike Brown's book, each chapter of Sells' book stands on its own. The book doesn't flow as well from cover to cover, but that's okay, because the information is invaluable. As Sells says in the Preface, “this book focuses on the real-world scenarios that aren't covered in detail elsewhere.” True enough; every chapter has stuff that either I didn't know or I had already figured out the hard way. I was particularly enthralled by the chapters on resources, applications and settings, data binding, and multithreaded UI. Most of the data binding material seemed focused on having an SQL database, but there is non-database-driven information in there, and even notice of a critical bug in .NET 1.x that makes data binding to objects more of a chore. Also be sure to read the appendices, which include a colorful essay on the hows and whys of delegates and events.

In summary, if you're doing serious Windows Forms development, you should make sure that you've read this book.

2/11/2004 11:20:08 AM (Pacific Standard Time, UTC-08:00) | Comments [0] | Books#
Tuesday, February 10, 2004

I just read Windows Forms Programming with C#, by Erik Brown. Well, okay, I skimmed some of it; I can't be expected to read every word of these multi-hundred-page programming reference books.

The book is very focused on Visual Studio .NET, which, of course, isn't bad if you do all of your development in that environment, and don't mind certain things being done behind the scenes, but when I'm learning a new technology, I like to stay away from the big tools. To be fair, he frequently shows and explains critical segments of the source code that is generated by VS.NET, so it isn't all that bad.

The chapters of the book follow the development of a “photo album” application, one step at a time. I really liked this approach; the book flows well from beginning to end. If I was less experienced in Windows and .NET programming, and had a bit more time on my hands, I'm sure I would have greatly benefitted from developing the application right along with the book, experimenting along the way. As it stands, many chapters didn't include much that I couldn't figure out from the documentation. That said, I think that the book makes a far more accessible reference guide than the documentation, and when next I work with a Windows Forms control that I'm not familiar with, I'll be sure to read more carefully the chapter in the book that describes it. The “visual index” in one of the appendices (and on the front and back covers) looks like a great way to quickly find the section of the book that describes any given component.

The most interesting chapter to me was the one on data binding. This book is one of the few that doesn't require the installation and use of an SQL database; it was refreshing to see that data binding is possible even with simple .NET objects. I'll think I'd better read that chapter again...

There are many topics missing from the book – security, localization, deployment, etc. – so you'll have to find another source for material that covers the entire software development process for a Windows Forms application. All in all, I think the book does a good job of introducing the reader to Windows Forms development under VS.NET, providing enough detail to figure out what is possible so you can start coding.

2/10/2004 11:58:19 AM (Pacific Standard Time, UTC-08:00) | Comments [0] | Books#
Search
Archive
Links
Categories
Administration
Blogroll