tag:blogger.com,1999:blog-7101933101966798446.post4745101959660640292..comments2024-03-17T08:14:57.577-07:00Comments on The View from Aristeia: Publishing Code on Digital PlatformsScott Meyershttp://www.blogger.com/profile/05280964633768289328noreply@blogger.comBlogger21125tag:blogger.com,1999:blog-7101933101966798446.post-28738315162571580252012-12-27T18:55:16.998-08:002012-12-27T18:55:16.998-08:00@Todd Greer: Thanks for your comments regarding re...@Todd Greer: Thanks for your comments regarding reading technical books on phones. My natural inclination is to downgrade the importance of such devices as targets for my books, but I realize that phones are the device you always have with you, and it's good to remind me how powerful an incentive that is to do what can be done to make technical material both look good and behave well on such devices.Scott Meyershttps://www.blogger.com/profile/05280964633768289328noreply@blogger.comtag:blogger.com,1999:blog-7101933101966798446.post-89992371840761917682012-12-26T22:38:20.244-08:002012-12-26T22:38:20.244-08:00I do sometimes find myself reading on "pathol...I do sometimes find myself reading on "pathological" devices, such as my phone (Samsung Galaxy S3) in portrait mode. It's a very convenient way to read the prose portion of books. While it certainly can't be made perfect, anything that can be done for those devices would be appreciated. Perhaps some of the work that has gone into making highly scalable web pages with liquid layouts and scripting can help.<br /><br />Given the difficulty, it might work well to let me tap the code sample to 'zoom in' and view only it. That way, when I then rotate to portrait mode, I don't have to scroll to find it. (My Kindle app seems to have difficulty putting me in the right place when I rotate the device.) A way to switch easily back and forth would help with another problem that is more pronounced the smaller the device. That is that the sample often gets positioned far enough from the discussion that it can be hard to even find what sample is being discussed.<br /><br />In short, we all recognize that it will be far from perfect, but please do what you can to make code samples at least comprehensible, even on difficult displays.Anonymoushttps://www.blogger.com/profile/18070486945490218358noreply@blogger.comtag:blogger.com,1999:blog-7101933101966798446.post-20985727857114065192012-12-15T20:15:36.647-08:002012-12-15T20:15:36.647-08:00@_ _: I'd be grateful if you'd send me ema...@_ _: I'd be grateful if you'd send me email to start a conversation on this topic. I'd love to get your insights into what's possible on Amazon-backed platforms. My email is smeyers@aristeia.com.<br /><br />Thanks!Scott Meyershttps://www.blogger.com/profile/05280964633768289328noreply@blogger.comtag:blogger.com,1999:blog-7101933101966798446.post-22217675970202751862012-12-15T17:52:20.165-08:002012-12-15T17:52:20.165-08:00Hey Scott,
I'm working in the team responsibl...Hey Scott,<br /><br />I'm working in the team responsible for the module which renders content for some platforms at Amazon.com. I agree with you, the experience of reading some code snippets is not optimal. Let me know if I can help you with some rendering features.<br /><br />Thanks,<br /><br />Augusto_ _https://www.blogger.com/profile/05591159496747668599noreply@blogger.comtag:blogger.com,1999:blog-7101933101966798446.post-33020682528265892592012-12-13T10:08:35.416-08:002012-12-13T10:08:35.416-08:00@Bernhard Merkle: Can you please elaborate on what...@Bernhard Merkle: Can you please elaborate on what you mean by "block record" and "left adjusted" formats? As for Kindle, my impression is that some books where ported there without any regard for the appearance of code displays. Avoiding that kind of problem is the motivation for my publishing this blog post. If I know what kinds of problems have arisen in the past, I can work with my publisher to avoid them.Scott Meyershttps://www.blogger.com/profile/05280964633768289328noreply@blogger.comtag:blogger.com,1999:blog-7101933101966798446.post-44130130314351217272012-12-13T10:01:27.386-08:002012-12-13T10:01:27.386-08:00@Yuri Khan: Your expectations should be in accord ...@Yuri Khan: Your expectations should be in accord with the platform you are using. You should not expect color on a monochrome device, you should not expect to be able to copy and paste on devices that don't support copying and pasting, and you should not expect dynamic line breaks from a format not designed to support them (e.g., PDF). On the other hand, I expect my books to be available in a variety of formats on a variety of devices (e.g., <a href="http://www.safaribooksonline.com/" rel="nofollow">Safari</a> (the online book service, not the browser), Kindle, Nook, PDF, etc.), so you should be able to choose the format and device that gives you the feature set you want. At least that's my hope. My publisher and I are talking about this kind of thing now, and there may be format or device limitations I'm not aware of that will require some dialing down of my ambitions. But my goal is that EC++11 looks good everywhere it is available, where "good" is affected by the capabilities of the device you, as a reader, choose to use.Scott Meyershttps://www.blogger.com/profile/05280964633768289328noreply@blogger.comtag:blogger.com,1999:blog-7101933101966798446.post-76510907226230982252012-12-13T09:35:56.571-08:002012-12-13T09:35:56.571-08:00@Billy O'Neal: I'll ask my publisher about...@Billy O'Neal: I'll ask my publisher about font limitations on Kindle and other digital platforms. If we have to play games to get code to look good on Kindle (or elsewhere), and if it's practical to play those games, we'll play them. If different platforms require the use of different fonts, so be it. It's not like C++ developers are unfamiliar with the idea of platform-specific code :-)Scott Meyershttps://www.blogger.com/profile/05280964633768289328noreply@blogger.comtag:blogger.com,1999:blog-7101933101966798446.post-72988626060528701342012-12-13T09:30:53.888-08:002012-12-13T09:30:53.888-08:00@Phi Pig: Certainly you should be able to take for...@Phi Pig: Certainly you should be able to take for granted that cross references are links. As far as I know, in electronic versions of my books, they always have been and always will be.Scott Meyershttps://www.blogger.com/profile/05280964633768289328noreply@blogger.comtag:blogger.com,1999:blog-7101933101966798446.post-2420922233914865712012-12-13T08:19:50.608-08:002012-12-13T08:19:50.608-08:00I am not very familiar with book reader software. ...I am not very familiar with book reader software. My reading expectations are based on the experience with HTML+CSS+JavaScript in a desktop browser.<br /><br />Re: PDF, yes you can search and copy/paste (if not restricted by the publisher), but in the majority of cases you cannot reflow.Yuri Khanhttps://www.blogger.com/profile/00733570647521158003noreply@blogger.comtag:blogger.com,1999:blog-7101933101966798446.post-16618301926150548462012-12-13T00:50:40.858-08:002012-12-13T00:50:40.858-08:00I think also looking at existing examples we can l...I think also looking at existing examples we can learn a lot e.g. take Dave Abrahams book "C++ Template Metaprogramming: Concepts, Tools, and Techniques from Boost "<br /><br />and lets compare the hardcopy, google books and the kindle version i have:<br /><br />Pros:<br />-the source code is <b>extracted</b> from the book and hence is consistent. During the creating of the book I think Dave asserted that it always can be compiled e.g. with gcc.<br />-the source code is available additionally as <b>separate zip</b><br /><br />Cons:<br />-<b>layout format</b> <br />is totally different, e.g. kindle uses block record format while the pdf/google books uses left adjusted format.<br /><br />-<b>font sizes and ratio</b> between them<br />for different things, e.g. math formular, source code, normal text, different fonts and sizes are used which is good and ok.<br />However the problem is that in the kindle version source code font size is bigger and e.g. the math formular are actually pictures.<br /><br />-there are tables containing source code these are pictures, so no copy of source code out of table.Bernhard Merklehttps://www.blogger.com/profile/03783379386662093429noreply@blogger.comtag:blogger.com,1999:blog-7101933101966798446.post-63849059728958048092012-12-13T00:29:20.301-08:002012-12-13T00:29:20.301-08:00This comment has been removed by the author.Bernhard Merklehttps://www.blogger.com/profile/03783379386662093429noreply@blogger.comtag:blogger.com,1999:blog-7101933101966798446.post-12544660266816898152012-12-13T00:18:08.584-08:002012-12-13T00:18:08.584-08:00Sometimes, sample code on a specific subject (say ...Sometimes, sample code on a specific subject (say "smart pointers") will also show something defined elsewhere (say "explicit constructor").<br />The usual way is simply to put a comment in the "smart pointer" sample :<br />explicit Widget(int value) // See chapter 3<br />It would be better if it was a link to the chapter.Anonymoushttps://www.blogger.com/profile/12797481388427647088noreply@blogger.comtag:blogger.com,1999:blog-7101933101966798446.post-53816345490537004692012-12-12T23:58:13.143-08:002012-12-12T23:58:13.143-08:00@Scott:
Perhaps I stand corrected about the font....@Scott:<br /><br />Perhaps I stand corrected about the font. I think it looks fixed-width here; but that could just be the Kindle mangling it. (The default Kindle font is almost fixed anyway)<br /><br />My comment was made in general; not a statement about your books in particular.Billy O'Nealhttps://www.blogger.com/profile/13423715036990970308noreply@blogger.comtag:blogger.com,1999:blog-7101933101966798446.post-49054039197612980722012-12-12T23:09:20.616-08:002012-12-12T23:09:20.616-08:00@Yuri Khan: I don't know of a way to automatic...@Yuri Khan: I don't know of a way to automatically wrap code that produces sufficiently good results to publish, and if one exists, I'd be concerned about its availability on ereader platforms (e.g., iOS and Androd tablets, Kindle, Nook, etc.). Having said that, if you can point me to such software, I'd love to play around with it.<br /><br />As for PDF, it's clearly a digital form. You can search it, you can copy from it, you can link from it, you can send it via email, etc. Those characteristics clearly distinguish it from print publications.Scott Meyershttps://www.blogger.com/profile/05280964633768289328noreply@blogger.comtag:blogger.com,1999:blog-7101933101966798446.post-37439826323120530572012-12-12T22:55:05.498-08:002012-12-12T22:55:05.498-08:00Another basic reader right that rules out images i...Another basic reader right that rules out images is the right to configure the font face. And yes, I take that for granted, for code as well as prose.<br /><br />I also take for granted that the code will use my display space efficiently. That is, if I am reading from a desktop monitor at 1600×1200, it won’t be hard-wrapped at 45 characters.<br /><br />In fact, I think it would be not too hard to develop a client script that would smart-wrap code to the allotted width, with line continuations properly indented.<br /><br />Lastly, please do not regard PDF as a digital form. Layout-wise, it is still ink on paper in a digital disguise.Yuri Khanhttps://www.blogger.com/profile/00733570647521158003noreply@blogger.comtag:blogger.com,1999:blog-7101933101966798446.post-50000483263030460992012-12-12T20:23:29.023-08:002012-12-12T20:23:29.023-08:00@Billy O'Neal: Both EC++/3e and ESTL use a pro...@Billy O'Neal: Both EC++/3e and ESTL use a proportional font. Do you think that detracts from the code's readability? (It's a neutral question. Probably the most common request I get from people is to use a fixed-width font for code.)<br /><br />As for the trade-off between attractive code on some devices and unattractive code on others, my goal is that the code looks good on all devices (other than pathological ones). There are various ways to do that, but the problem, if there is one, is mine and my publisher's, so don't be so quick to make concessions. Trade-offs are necessary only when you can't come up with a way to satisfy all the constraints, and my goal is to find solutions that obviate the need for trade-offs.Scott Meyershttps://www.blogger.com/profile/05280964633768289328noreply@blogger.comtag:blogger.com,1999:blog-7101933101966798446.post-31066234805835982302012-12-12T20:08:58.064-08:002012-12-12T20:08:58.064-08:00(Oh, and I would say that I would rather see unrea...(Oh, and I would say that I would rather see unreadable mess in a 6 inch display in exchange for good looking code on more reasonable displays rather than the reverse.)Billy O'Nealhttps://www.blogger.com/profile/13423715036990970308noreply@blogger.comtag:blogger.com,1999:blog-7101933101966798446.post-29476924218463639192012-12-12T20:07:37.096-08:002012-12-12T20:07:37.096-08:00I know this is kinda obvious -- but a fixed-width ...I know this is kinda obvious -- but a fixed-width rather than a variable-width font is usually a requirement for readable code. (Which unfortunately makes the space problem worse)<br /><br />Luckily, even on a 6 inch (Kindle-esque) display, rotating to landscape mode is usually fine. (At least, Effective C++ 3rd Edition and Effective STL look reasonably good that way)Billy O'Nealhttps://www.blogger.com/profile/13423715036990970308noreply@blogger.comtag:blogger.com,1999:blog-7101933101966798446.post-50479210191135791602012-12-12T20:07:23.637-08:002012-12-12T20:07:23.637-08:00@Brian: Back in the bad old days before color disp...@Brian: Back in the bad old days before color displays were the norm, syntax highlighting took the form of things like displaying keywords in bold. There's more than one way to skin that particular cat.<br /><br />As for text lines being around 45 characters long, presumably you have some particular device in mind. If there's a limitation, it doesn't come from E-ink, it comes from the package the E-ink display is part of.Scott Meyershttps://www.blogger.com/profile/05280964633768289328noreply@blogger.comtag:blogger.com,1999:blog-7101933101966798446.post-76921708658087537522012-12-12T19:03:06.198-08:002012-12-12T19:03:06.198-08:00E-ink displays are (for the most part) grayscale, ...E-ink displays are (for the most part) grayscale, so syntax highlighting will have limitations on those devices; also, they tend to be in portrait orientation. Text lines are around 45 characters at a comfortable font size for me. Bad line breaks may be the only option, but with obvious exceptions like long // comments and literal strings, C++ should be fairly tolerant of line breaks.Brianhttps://www.blogger.com/profile/05701551597353289235noreply@blogger.comtag:blogger.com,1999:blog-7101933101966798446.post-21168041340964668032012-12-12T18:48:41.319-08:002012-12-12T18:48:41.319-08:00Although it probably falls more into the "nic...Although it probably falls more into the "nice to have" bucket than the "absolute necessity", one more thing that would be <i>really</i> nice would be some way to see diffs/changes to the code.<br /><br />Hard though many of it find it to believe, it's barely possible that the initial version could be slightly less than perfect, and being able to see changes directly rather than trying to compare to what we think we remember.<br /><br />On the other hand, you might want to apply that to everything, not just the code.Jerry Coffinhttps://www.blogger.com/profile/05654532802780255271noreply@blogger.com