-
Notifications
You must be signed in to change notification settings - Fork 3.6k
What's the best way to clearly show differences between two blocks of code? #187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I just flipped through Land of Lisp to see if/how they handled this (since it's also a nostarch book, albeit about 5 yrs old). They have a general code annotation system with little circled numbers: It's sometimes but not always used to point out changes.. in this example, there's a line removed between the 1st and 2nd code blocks and it's not annotated in any way, just pointed out in prose. The Ruby Programming Language has a couple of spots that are side-by-side that i kind of like ( but this might not always work if the lines are long :-/ |
How do other books handle this? I'm not sure how your french is, but the long-form tutorials on OpenClassrooms are in the most well-written ressources for french speaking people who are learning programming on their own. e.g. their C++ tutorial. Maybe you can draw some inspiration from there? For this particular issue, they seem to repeat most of the code. Eventually indicating missing snippets with |
I've talked about this with our editor at nostarch and we're going to do a combination of cutting down the context (but still giving some context), bolding, and the circled numbers like in land of lisp. I think that'll cover it, for print at least. So I'm changing this to be labeled "after print" -- I think it's also a valid issue online, but we have things like toggling open/closed, offering multiple formats, linking to diffs, etc that we have at our disposal on the web. |
I'm in an issue-cleaning-out mood, and since we have resolved this for print, I'm closing this unless people have an issue with how the online book presents this. |
From #180 (comment).
Problem
If we start with one pretty sizeable chunk of code, and then modify it to build on it, we need to make it clear what parts have been added, modified, or deleted when going from the first block to the second block. This will help readers to follow along with less of a chance of getting a weird error because they missed an edit.
Possible solutions
lookwork ok?The text was updated successfully, but these errors were encountered: