tag:blogger.com,1999:blog-7101933101966798446.post5066052814799503918..comments2024-03-17T08:14:57.577-07:00Comments on The View from Aristeia: Draft EC++11 ItemScott Meyershttp://www.blogger.com/profile/05280964633768289328noreply@blogger.comBlogger49125tag:blogger.com,1999:blog-7101933101966798446.post-81657409665663857952013-03-09T00:35:07.547-08:002013-03-09T00:35:07.547-08:00Fixed width font. Having begun coding in character...Fixed width font. Having begun coding in character consoles with Turbo Pascal editor, this should be considered as bad habit that must change.<br />Syntax Colored code with colored highlighting, unless multiple statements from an advanced library are grouped like 3 to 4 lines of OpenGL in which case colorfulness would be distracting.<br />Fixed-pitch code font, syntax-colored code, bold highlighted code felt more comfortable, but red had strong imprint if you really want to teach stubborn me a thing or two :DAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-7101933101966798446.post-29165749811019677712013-02-26T16:33:11.551-08:002013-02-26T16:33:11.551-08:00@Zimbot: Can you please elaborate on your final pa...@Zimbot: Can you please elaborate on your final paragraph (regarding controlling vertical alignment)? I'm not sure what you mean here.Scott Meyershttps://www.blogger.com/profile/05280964633768289328noreply@blogger.comtag:blogger.com,1999:blog-7101933101966798446.post-69577276824637427072013-02-26T15:58:23.442-08:002013-02-26T15:58:23.442-08:00For your samples: fixed, and font color change.
B...For your samples: fixed, and font color change.<br /><br />But that doesn't mean these choices are necessarily the best. Other alternatives might be better.<br /><br />In particularly, the background color idea is probably better than the font color change, if only the color change is more subtle (but still noticeable). The yellow highlighting is so extreme that it makes it difficult to notice anything just beyond the edges of the highlight (for me, anyway). But glaring extremes are rarely as pleasant as merely "readily distinguishable" changes. That goes for font color changes as well, but since there is not as much pixel area, the change can be less distinguishable there. If you go with a thinner font, the font color change has to be even greater to afford the same effect. I think that's a good reason to use background color instead.<br /><br />Similarly, it isn't (IMHO) the fixed-width aspect of a fixed width font that is important. Rather, it's clarity and accuracy of perception. Most proportional fonts can put things too close together and make it hard to distinguish parentheses from curly-braces (or O from 0, etc.). But this does not have to be the case for all proportional fonts. <b>I strongly suspect that with the <i>right choice</i> of a very clear proportional font, the code could be even more clear and palatable than the best fixed-width available.</b> But I cannot suggest any existing fonts that might fit the bill. Maybe they're yet to be invented.<br /><br />Whether you find such a proportional font or not, I think it is still a splendid idea to use proportional font for comments. Proportional is a more readable change than simply switching to italics. Italics are hard to read. But you need comments to look different. So I say use a standard proportional there even if nowhere else.<br /><br /><br />The other reason it is important to use fixed-width when writing code, and then reading it afterward, is that you want to control the vertical alignment of similar items (not just where lines begin). But in this case, the font will be permanently fixed and you can arrange that alignment in every case for the specific font in use. Thus it shouldn't be a big problem; just some extra work for you.Zimbothttps://www.blogger.com/profile/06195777520954024293noreply@blogger.comtag:blogger.com,1999:blog-7101933101966798446.post-31258908567473756332013-02-25T12:15:42.900-08:002013-02-25T12:15:42.900-08:00proportional code blocks look awkward. Fixed width...proportional code blocks look awkward. Fixed width with a bold highlight should be ok or a gray shade. <br />By the way, a formatted version per use taste sounds good ;)Anonymoushttps://www.blogger.com/profile/00586030751495160399noreply@blogger.comtag:blogger.com,1999:blog-7101933101966798446.post-92015719587119368552013-02-23T19:47:04.399-08:002013-02-23T19:47:04.399-08:00@Zenju : or PDF could just support styles dynamica...@Zenju : or PDF could just support styles dynamically so you can (re)set a given file on the fly even after it is produced. Sebastian Gansonhttps://www.blogger.com/profile/13695237404497494975noreply@blogger.comtag:blogger.com,1999:blog-7101933101966798446.post-77281577185690040942013-02-22T17:50:46.830-08:002013-02-22T17:50:46.830-08:00I prefer two colors. The highlighting is too jarri...I prefer two colors. The highlighting is too jarring for me to read. I don't mind the proportional font. The use of bold seems the least obvious and would be far too easy to miss. Your code snippets tend to be fairly brief, so the syntax highlighting doesn't seem all that helpful.Bret Kuhnshttps://www.blogger.com/profile/17759126306939608739noreply@blogger.comtag:blogger.com,1999:blog-7101933101966798446.post-58908855445497220142013-02-18T04:20:22.363-08:002013-02-18T04:20:22.363-08:00I much prefer code to be in a fixed width font.
A...I much prefer code to be in a fixed width font.<br /><br />As for the colouring: I use a B&W Kindle, so I don't mind as long as it's still visible there.Kaz Dragonhttps://www.blogger.com/profile/13272310026172140396noreply@blogger.comtag:blogger.com,1999:blog-7101933101966798446.post-57698233516047140022013-02-16T17:19:45.307-08:002013-02-16T17:19:45.307-08:00The fixed width code is much easier for me to read...The fixed width code is much easier for me to read; I just expect code to be fixed width.<br /><br />For the highlighting, I prefer syntax colored code with bold. The yellow highlight is just to garish to my eyes, and the syntax coloring really helped break things up when I was going through the two examples.Robert Zehhttps://www.blogger.com/profile/12647206624571931529noreply@blogger.comtag:blogger.com,1999:blog-7101933101966798446.post-52129432658607142662013-02-16T08:33:54.374-08:002013-02-16T08:33:54.374-08:001. Definitely the monospaced font.
2. As for the ...1. Definitely the monospaced font. <br />2. As for the highlight, I sort of like the idea with the yellow, however I have a hunch that printed that would come out quite bad. So I would say the bold option, however I would also advise for the usage of the light grayish background color, so you can see on a glance what's code and what's explanation. Bernathttps://www.blogger.com/profile/07228196280385568067noreply@blogger.comtag:blogger.com,1999:blog-7101933101966798446.post-9831140598603647082013-02-15T22:46:51.491-08:002013-02-15T22:46:51.491-08:00@Zenju: In principle, the idea of generating a cus...@Zenju: In principle, the idea of generating a custom presentation of a book based on user preferences (e.g., an Astyle configuration file) is one I like. I even discussed this idea in <a href="http://blip.tv/file/1976570" rel="nofollow">a presentation I gave at the TOC Conference in 2009</a>, though I was focusing more on color choices than formatting. Technically, it should not be that difficult to implement, but I think it's currently beyond the state of the practice in general-purpose technical publishing. I've been talking with the publisher of my past C++ books about how to approach <i>Effective C++11</i>, and the notion of treating digital versions of books as primary (instead of as secondary versions derived from primary print versions) is something that is still considered rather experimental. With that in mind, I suspect that setting up the infrastructure needed to support on-the-fly book formatting is not something that's likely to happen soon. On the plus side, when such capabilities are available, I see no reason why the manuscript I plan to produce would not be in a good position to take advantage of them.<br /><br />The world of publishing is changing, but the movement isn't as fast as I'd like. If you know of publishers who are offering anything like the personalized formatting you've proposed, I'd be very interested to hear about it.Scott Meyershttps://www.blogger.com/profile/05280964633768289328noreply@blogger.comtag:blogger.com,1999:blog-7101933101966798446.post-59948435520855328742013-02-15T19:23:10.820-08:002013-02-15T19:23:10.820-08:00I definitely prefer the simple red/blue coloring -...I definitely prefer the simple red/blue coloring - does a good job of highlighting what is different/important without clutter. <br /><br />No strong preference on fixed vs. proportional, so I'd say go ahead with proportional if it makes it easier to fit stuff in...besides, it'll give the book that 'Effective' look and feel =)Anonymoushttps://www.blogger.com/profile/13576765696966153425noreply@blogger.comtag:blogger.com,1999:blog-7101933101966798446.post-45293068189660061052013-02-15T14:13:25.100-08:002013-02-15T14:13:25.100-08:00Soliciting for opinions tends to draw the stronges...Soliciting for opinions tends to draw the strongest of opinions... <br /><br />Q1. <br /><br />I find both equally readable. <br /><br />Q2. <br /><br />I have some difficulty noticing the <b>bold text</b>. In that style, the varying colors are already drawing my attention. <br /><br />The other two styles - yellow highlighting and the style you've historically used - both seem digestible to me. Drewhttps://www.blogger.com/profile/16515752933413693487noreply@blogger.comtag:blogger.com,1999:blog-7101933101966798446.post-58351210478128852172013-02-15T11:03:29.934-08:002013-02-15T11:03:29.934-08:00@Scott: I think I have the perfect solution. Since...@Scott: I think I have the perfect solution. Since your new book will be flexible with regards to target platform, there could be the following online service: You upload an Astyle configuration file and download the final pdf of your book. - This can't be that hard to program (but I'm not volunteering!). Your book would have the best code formatting of all C++ books out there. And one of the problems that really matter to people would finally be solved.Zenjunoreply@blogger.comtag:blogger.com,1999:blog-7101933101966798446.post-20521346585578453252013-02-15T10:55:23.583-08:002013-02-15T10:55:23.583-08:001) Fixed-pitch font, definitely (smaller is okay t... 1) Fixed-pitch font, definitely (smaller is okay to fit more...)<br /> 2) Code: Syntax-coloured<br /> Highlighted code:<br /> - *Not* bold. Doesn't stand out enough<br /> - Highlight ok but use a more mellow color than yellow<br /> Personally I like following look for highlight:<br /> - Lightly colored (pastel / low opacity)<br /> - Slightly rounded corners on the highlight<br /> - Subtle border (same colour as highlight but slightly darker)<br /> That's pretty specific, I know, but I think it looks great! The rounded corners can even work for "blobs" of highlight that span multiple lines of code.<br /> (I Must have seen this look somewhere but I can't remember which program.)<br />Darynnoreply@blogger.comtag:blogger.com,1999:blog-7101933101966798446.post-27440268491766970852013-02-15T10:47:08.587-08:002013-02-15T10:47:08.587-08:00@Zenju: Well, every style that is not the one you ...@Zenju: Well, every style that is not the one you use is an outrage, right :-)Scott Meyershttps://www.blogger.com/profile/05280964633768289328noreply@blogger.comtag:blogger.com,1999:blog-7101933101966798446.post-24431339733710599822013-02-15T10:39:28.184-08:002013-02-15T10:39:28.184-08:00@Scott: This is outrage - but fine, I'll grud...@Scott: This is outrage - but fine, I'll grudgingly accept this style of braces... :) you somehow seem to know that I'll buy your book anyway...Zenjunoreply@blogger.comtag:blogger.com,1999:blog-7101933101966798446.post-80915980270104700812013-02-15T10:34:18.023-08:002013-02-15T10:34:18.023-08:00@Zenju: Thanks for you comments. Regarding placeme...@Zenju: Thanks for you comments. Regarding placement of braces, I'm afraid you're going to have to live with my style, sorry. The code has to look right to me, too :-)Scott Meyershttps://www.blogger.com/profile/05280964633768289328noreply@blogger.comtag:blogger.com,1999:blog-7101933101966798446.post-20810865291680077752013-02-15T10:21:41.831-08:002013-02-15T10:21:41.831-08:00Q1: fixed-pitch font, because this is what program...Q1: fixed-pitch font, because this is what programmers are used to see and therefore is easier to read.<br /><br />Q2: Syntax-colored code with yellow highlighting, again since syntax-highlightning is what programmers see on a daily basis. Mono-colored code in books is hard to read<br /><br />Suggestion for a "Q3": I don't like the java-style brace indenting, because it isn't symmetric. And since I don't use it, this style is harder for me to read on books.<br />I'm not sure what the general programmer preferences is, but after syntax-highlightning, this is the next important style consideration. Maybe you could do a poll on this one, too?<br /><br />void foo {<br />};<br /><br />vs.<br /><br />void foo<br />{<br />};<br /><br />Zenjunoreply@blogger.comtag:blogger.com,1999:blog-7101933101966798446.post-1904511364981496372013-02-15T10:12:10.072-08:002013-02-15T10:12:10.072-08:00I don't think the bold highlighting stands out...I don't think the bold highlighting stands out enough (not even close actually). If you really want bold then you'd have to make it really bold.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-7101933101966798446.post-22516827607743262372013-02-15T07:21:24.172-08:002013-02-15T07:21:24.172-08:00I prefer a fixed point font with syntax highlighti...I prefer a fixed point font with syntax highlighting. For highlighting the example, I'd rather see a different fixed point font (something visually quite distinct), italic, underline, or preferably a dotted outline around the code you want to draw attention to.Acy Stapphttps://www.blogger.com/profile/13671713367016176979noreply@blogger.comtag:blogger.com,1999:blog-7101933101966798446.post-52240424823112504712013-02-15T00:47:37.644-08:002013-02-15T00:47:37.644-08:00I use a proportional font with syntax highlighting...I use a proportional font with syntax highlighting when working, so that is what would appear most natural to me. However, most code is presented in a fixed font, so I find that easy to read too, and that's probably what most others are used to.<br /><br />Bold face doesn't stand out very well in code examples. I prefer a bright colour (e.g. red vs blue/black for normal code), but if you're going to use syntax highlighting then a coloured background might be better unless you have a bright colour that is not otherwise used for syntax.Anthony Williamshttps://www.blogger.com/profile/12888842046584695509noreply@blogger.comtag:blogger.com,1999:blog-7101933101966798446.post-46435739634430335612013-02-14T19:58:42.320-08:002013-02-14T19:58:42.320-08:00#1: I find fixed-width fonts easier to parse, prob...<b>#1:</b> I find fixed-width fonts easier to parse, probably because that's just how I usually view code. <br /><br /><i>One good reason for fixed-width fonts:</i> if the choice is between you spending time fighting with a variable-width font (to get indentation or special characters looking good) or creating new and interesting content, I'd prefer the new and interesting content.<br /><br /><b>#2:</b> I like the syntax-colored code with yellow highlighting. The level of bolding that you demoed doesn't really draw attention to the differences that you want to point out, so that's no good. And having a small amount of syntax highlighting makes the rest of the code much easier to parse.Nate Kohlhttps://www.blogger.com/profile/09103578332500591317noreply@blogger.comtag:blogger.com,1999:blog-7101933101966798446.post-74413401257894123512013-02-14T13:46:13.062-08:002013-02-14T13:46:13.062-08:00I like syntax colored code with *red* for highligh...I like syntax colored code with *red* for highlighting. Basically in your two-color example everything is blue unless its highlighted red, but I think it would look fine and more clear to use use blue/teal/black for non-highlighted code. Bold is harder to find at-a-glance than red is. Blue/teal/black offer better readability than just blue.<br /><br />I also prefer fixed sized font on screen, but variable sized is fine when on paper with a good font.mmocnyhttps://www.blogger.com/profile/00585754106557615292noreply@blogger.comtag:blogger.com,1999:blog-7101933101966798446.post-19386348094655117112013-02-14T11:42:01.367-08:002013-02-14T11:42:01.367-08:001. In larger code samples (4+ lines) I think the p...1. In larger code samples (4+ lines) I think the proportional font is harder to read because it squishes up more in the same space. That being said, I think I can get used to either, so the difference is minor.<br /><br />2. Syntax-colored code with yellow highlighting. The bold is too subtle for me.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-7101933101966798446.post-32398970149195256032013-02-14T10:32:21.224-08:002013-02-14T10:32:21.224-08:00It is my opinion you should use a Fixed-pitch code...It is my opinion you should use a <i>Fixed-pitch code font, blue "normal" code, red </i><b>[and bold]</b><i> highlighted code.</i><br /><br />-I believe most people identify a fixed pitch font as code, so despite the fact that it takes more space I prefer the look of code.<br />-Using two colors (i.e. blue and red) helps highlight the targeted example code. I would also bold the targeted code to further help with monochrome display and print and color blindness.<br />-The yellow highlight looks garish to me.lumentelumhttps://www.blogger.com/profile/05632939294174864791noreply@blogger.com