Tuesday, March 3, 2009

Experience Report: My C++ Books on Kindle

I recently announced to my mailing list that, unbeknownst to me (and, as it turns out, my editor), two of my C++ books have been made available on Kindle:
Two of my books -- Effective C++ and Effective STL -- are now available for Amazon's Kindle. I haven't seen these editions myself, so I can't tell you anything about them. Since I don't have a Kindle, this is unlikely to change anytime soon. If you try these editions, please let me know what you think of them. You'll find links to the Kindle editions of these books at http://www.aristeia.com/books.html .
Shortly thereafter, Herb Sutter wrote me as follows:
I downloaded a Kindle sample of one of your books, which included enough to see some source code examples. In general it looks good, except for one thing: Source code is rendered badly. The text is clear, but the two problems are:

a) Line length (though not as bad as narrow magazine columns & what iPhone would be like): Medium-long lines have bad wraps that make the examples a pain to read. But line length is probably going to be an issue for all small-form-factor devices.

b) Proportional font => comments don’t line up. It’s possible to get fixed-width fonts on Kindle but you have to try hard and use the <pre> tag explicitly. For more, see Larry O’Brien’s recent blog note about targeting technical docs to Kindle, including the comment about getting Greek text to work by explicitly using UTF-8.
Herb included a couple of quick-and-dirty screen shots, including this one:

The code examples, which I'd carefully formatted for the font and page width of the printed book, were apparently moved to the Kindle without any reformatting consideration, so the Kindle tossed in new line breaks wherever it felt they were needed. The result, unsurprisingly, is awful. This is consistent with my belief that the chances of writing a book with anything beyond straight prose that looks good on multiple devices is close to zero. The more special formatting that's needed (e.g., for recipes, poetry, code, etc.), the more care an author (and his or her publisher) is likely to need to take.

Bearing in mind that my recent C++ books use two ink colors (black plus a red highlight color for places where I want to focus readers' attention), Herb wrote:
Some text that I think you had as red or some other color looks gray on Kindle. It’s still readable, if a little less distinct. Probably the best that can be done given that Kindle 1 only has a 4-level gray scale. It’d probably look slightly better on a Kindle 2 with a 16-level gray scale, but only slightly since you do have to make it gray enough to be distinct and so I’d imagine you couldn’t just use levels 14 and 16 for example.
I discussed the problem of writing for devices with different capabilities such as color in an earlier post.

Herb concluded:
If you’re serious about thinking of targeting devices like Kindle or iPhone, it’s worth having one.
I replied:
Practically speaking, I'm sure you're right, but this is the kind of thing I'd like my publisher to address for me. I want to focus on content, not device-dependent presentation issues. One of the things my publisher should do is investigate the landscape of output devices, then give me advice on what I should or should not do in my ms to keep it cross-platform-friendly.
I thank Herb for his mini-review of my books on Kindle and for his permission to use his material here.

3 comments:

Anonymous said...

Well, this post certainly made me think!

1. I'm surprised it could be news to you (and your editor) to learn the Effective C++ books had been released in a new format, and horrified at the mess made of code samples.

2. Part of me thinks: electronic version = online = free distribution = surely it should be simple to just give Herb Sutter a free copy? Why does he only get a sample? Another part of me thinks this is the kind of muddled thinking publishers have to fight against.

3. Herb Sutter suggests "If you're serious about thinking of targeting devices like Kindle or iPhone, it's worth having one." Well, clearly this blog shows you're serious; in fact I'm surprised to learn you're so interested if you don't own a Kindle or iPhone.

Scott Meyers said...

Unfortunately, the release of my books in a new format without any review by me, my editor, or, from what I can tell, any human entity whatsoever doesn't break any new ground, at least not at Addison-Wesley. They do print quite well, in my experience. When it comes to bits and bytes, they have a lot to learn. Multiple-device publication is an area where they seem to be rather at the beginning of the learning curve.

As for my interest in Kindle/iPhone, etc., it's based on likely reader interest. Personally, I prefer paper for reading, and some electronic version on my full-size computer screen for searching. But my goal as an author is to serve my readers, not me, so what I prefer isn't very relevant. I suspect I'll never embrace small-screen devices, but I also suspect that many people will. That being the case, I want to be sensitive to how I can best provide them with the information I have to offer.

Samanta said...
This comment has been removed by a blog administrator.