Down to Barnes and Noble

published: Fri, 28-May-2004   |   updated: Thu, 27-Oct-2005

Just got back from Barnes and Noble, two computer books in a plastic carrier bag.

I had to go. I'm designing and implementing a multitier app at the moment (and will be for the next few months) and I'm deep in the business layer and thinking about the communications between it and the UI/Presentation layer, which raises questions about remoting, and then I discovered that I no longer had my copy of Advanced .NET Remoting by Ingo Rammer. I'd lent it to Anson Horton in the C# team just before I left Microsoft last December and I never got it back. Sigh. So, it was off to B&N to buy a replacement.

I picked up the new copy of the book and then I saw the Delphi shelf. I say "shelf" but of course anyone who's wanted to buy a Delphi book in, oh, let's say the last five years will know that the word means 8 inches or less of space. Believe me I know, I only saw my book once in a book store (my local Borders) and it was unencumbered by any Delphi companion volumes. Anyway, this B&N's Delphi "shelf" just had two copies of one particular book, facing out: Delphi for .NET Developer's Guide by Xavier Pacheco and others. I couldn't resist and picked it up as well.

(Although I'll admit to not really needing it, I do like supporting authors I know by buying their books. I know how long it takes to write a book, and how much all those hours are worth at the end—about a dollar an hour in my case. So the least I can do is to buy their book.)

At home I decided to check up and see whether X had read my blog post about Delphi Informant from last year. He'd essentially written an article on the System.Collections namespace, one of a series, using information he was going to put in the eventual book. From that article I'd identified several missing or erroneous points that indicated that the article was too light and possibly too hastily written, and I wondered whether he'd corrected them or not.

Here's the list of my criticisms of his discussion of the Stack class from the article, and whether they've been addressed in the book.

  • He calls stacks a "FILO" data structure; but all of my algorithms books tend to call it LIFO (yeah, nitpicking, I know). Not addressed, and it shows that I can still be nit-picky <g>.
  • The Peek() method is called Peak at one point. This was in the text of the D.I. article and it's disappeared from the book.
  • One of the constructors for a Stack allows you to specify the initial capacity for the Stack instance; what is the default capacity if you don't use this constructor? This has been addressed and the book states that the default capacity of the Stack is 10 items.
  • He mentions that you can create a stack using the items from another collection; in which order are the items added to the stack (i.e., in which order would they be popped)? Not addressed.
  • He shows how to enumerate a stack, but doesn't say in which order the items are returned: in pop order, or in push order? Not addressed, although it can be inferred from the screenshot of the output.
  • How is the stack implemented internally? Not addressed, but probably not important in this type of book.

So, so far, we're not doing very well. Unfortunately though, there are other errors that have crept in.

  • The ToArray() method does not return a new ArrayList instance, it returns a new array.
  • The description of the ToArray() method doesn't say in which order the items from the stack are returned in the array (a similar problem to the ones I noted before).
  • He writes a simple procedure to enumerate through an IEnumerable object and uses it to enumerate through a Stack instance, and makes a note in the text of how this is good programming practice since the method can be reused. Unfortunately, the one variable in the method seems to imply a stack (it's called enumMyStack), which is bad programming practice (it could confuse a maintenance programmer).

Ummm. Not happy. (Especially when I note that the code example for the Queue class was obviously derived from the Stack example by badly using search and replace. The word "populate" in a comment becomes "Enqueueulate".)

I'll spend some more time on the book later and report further. But, for now, Ingo Rammer calls...