top | item 23281568

How to write a programming book

166 points| aqui_c | 5 years ago |aquicarattino.com | reply

68 comments

order
[+] lmilcin|5 years ago|reply
What pains me about programming books is that due to the market pressure the balance is skewed extremely in the direction of beginner material and there is precious little material for advanced users.

If you look at other branches of knowledge, say electronics, there is couple of books for beginners and then massive selection of highly specialized books for experts.

I get that part of this is due to multitude of languages, paradigms, frameworks, etc. but I suspect that a huge part is due to the fact that programming book writers have huge incentive to make the book palatable to absolute beginners and anything else seems to be a sure way for the project to tank.

[+] dkersten|5 years ago|reply
Another thing that bothers me is that most intermediary books on a topic tend to start with a good chunk of beginner stuff. For example, many game programming books will cover a ton of beginner material at the start, same with graphics books or books on a particular programming language. I shudder to think of how much duplicated content that I will never read because I'm no longer a beginner is sitting in my bookshelf. If I buy an intermediary or advanced book, I don't need a recap giving me the absolute basics! Eg if its an intermediate-level programming language book, don't tell me how to do simple conditionals or loops or something that I definitely already know to consider an intermediate-level book...
[+] taphangum|5 years ago|reply
This is the exact problem that I am working on with my project https://fromtoschool.com. Where we write books and create courses that teach new programming languages and frameworks to experienced developers, using the languages and frameworks that you already know.

The style we use to teach is optimized for speed of learning and teaches this way using the 'constructivist' method. I expand on this learning style, and why it is so effective more in this post: https://fromtoschool.com/why-most-programming-tutorials-are-....

[+] Swizec|5 years ago|reply
As someone who writes programming stuff, yes this! I avoid complete beginners and aim for junior to mid.

The problem is that this is still a crazy fast growing field. Say we double in number every 5 to 10 years. That means at 5 years experience you are more experienced than half the industry.

That’s mindboggling.

Newbies also need more help and are more willing to pay for help.

Oldbies only pay for help when entering a new area. Like a fortran engineer picking up React or a JS person getting into C++

One problem is that software engineering doesn’t quite value experience yet. Easier to throw 3 newbies at a problem than 1 senior who’s never seen this new tech anyway.

The other issue is that engineers are smart and motivated by problem solving. They’d rather figure it out themselves than take all the fun out by just learning it like a normal person and reaping the rewards.

Also advanced stuff often gets so in the weeds that only you and 50 of your friends in the whole world even care. Or it’s so specific to your company tht only other people at your company care.

[+] cosmodisk|5 years ago|reply
I remember reading a comment on why there's a shortage of very advanced books in databases,where the author argued that anyone who know his stuff at that level is more likely to keep it to himself, because there's tons of money to be made+ lots if proprietary stuff nobody wants to be open about.
[+] alexashka|5 years ago|reply
What advanced material are you looking for?

A lot of research papers can be found online for free. What problem are you trying to solve that you feel would be helped by advanced material not found in research papers and/or computer science textbooks?

For me, the problems I've encountered that I thought were problems of lack of advanced learning material, have turned out to be problems of absence of tooling, libraries, frameworks and the will to create them.

In my particular case - I became an iOS developer and found out we're still paying people 100k+ to manually create trivial phone apps that fetch trivial database queries via json and display them in rather trivial ways on screens.

You wouldn't believe the number of people working on any given banking app that lets you display your past transactions and transfer money in-between accounts - it's basically a folder/file viewer with pre-defined file types and a couple of pre-defined actions for each. We've had folders, files and transactions to ensure correctness for decades! People are still re-creating these features!

Why do we have separate banking apps that do the exact same thing and why does displaying text fetched from a database and letting you modify it in the most trivial way, a job that pays 100k+ while producing bug ridden code?

There is no book to solve this problem and I believe most of the people employed in software development are churning out or maintaining this type of code. As a result, the market for advanced techniques in computer science is incredibly tiny - if you removed the idiotic whiteboard waterboarding techniques, academia and R&D at big corporations, you'd find out that there is maybe a few thousand people world-wide who are genuinely interested in putting advanced computer science to use.

I'd say this hypothesis explains why we don't have any actual progress in the field, just more javascript frameworks (simplifying, of course ) :) It doesn't explain very well what those billions of dollars in R&D at big corps are accomplishing besides removing ports from laptops and coming up with new keyboard mechanisms that fail when dust falls on them (lol) - maybe we're one day away from a quantum computer that changes everything? I have my doubts :)

[+] billme|5 years ago|reply
Generally speaking, books as a format make no sense. I have seen the financial records for number of popular tech book authors — and numbers related to them having published, for example: products, services, consulting & speaker fees, etc. If the author is trying, they make way more money from the numbers related to them publishing than the book sales.

If you like writing long form tech guides, do yourself and your audience a favor, figure out how to publish your materials for free digitally and grow an audience you have direct one-on-one access to, then allow people to order paper versions if that’s what they prefer.

Then, writing a book becomes easy: grow audience, provide an outline, get feedback, write more, write testable code, get more feedback, etc.

Anything you write (as in subsection) should have a timestamp of when it was: written, rewritten, last reviewed, test, environment tested, etc.

[+] munificent|5 years ago|reply
> Generally speaking, books as a format make no sense.

This is such a silly assertion. Books have been one of the most effective ways for an informed author to get large, complex topics and rich experiences into a another persons head literally since the Roman Empire.

Even in today's world where we have an infinite number of other formats and media to choose from, millions of people still prefer and learn from books. The ability to encode spoken language into a series of written words that can be consumed at a pace the reader controls is one of the most powerful technologies humans have ever invented. And an author taking the time to organize an entire body of work into a single coherent linear narrative is one of the most effective tools to move information across brains.

> I have seen the financial records for number of popular tech book authors

I think what you're trying to say is that conventional tech publishers make no sense economically, and I am inclined to agree with that. The idea that an author can do 90% of the work and get 10% of the royalties is just bananas to me. That kind of royalty sharing only made sense in a time when publishers formed a hermetically sealed cartel preventing independent authors from easily accessing bookshelves. Those days are thankfully over.

It is possible to make decent money from writing technical books if you self publish and build an audience yourself.

[+] qznc|5 years ago|reply
If you go for free and online anyways, then you can pursue more interesting formats like Quantum Country [0]. It seems to include a spaced repetition mechanism. I have yet to try it though.

[0] https://quantum.country/

[+] freedomben|5 years ago|reply
I love buying pre-releas books from Prag Prog (which isn't exactly the same but similar to what you described). Especially since things change so fast, if you have to wait for a finalized, published version of the book, it's usually outdated by the time it even hits the shelves (not entirely of course, but parts of it). If the author(s) publish pre-releases frequently, it can be a fantastic reference.
[+] Syzygies|5 years ago|reply
This is relevant to me because I'll likely be teaching Linear Algebra online in the Fall. I'm rethinking support materials from scratch. This article does not rethink its genre from scratch. And I nearly stopped reading, unwilling to take advice from a fixed pitch body font.

I've learned dozens of programming languages, and I find programming books increasingly unreadable. They all give me that feeling of ADHD that actual programming heals.

I've also made progress learning various human languages. No single approach works. Doing crosswords in old age doesn't fight off dementia but does make one better at doing crosswords. For language aquisition, read with the sole goal of getting better at reading. Listen with the sole goal of getting better at listening. Repeat phrases in the car as if that's a self-contained game one plays. Then trust that these separate skills will integrate as one travels; they do.

For anyone who has learned the board game of Go, it's interesting how books on Go are compartmentalized. There are books solely dedicated to short timescale tactics, for example.

After a few programming languages, one can easily absorb the "short timescale tactics" of a programming language, and still be at a loss on idiomatic ways to assemble complete programs. Just as the best mathematicans only read original literature, the best programmers simply read code. A programming book can ease the transition to reading code. We should be clear that this is our primary goal.

One experiences a more intense sensation of comprehension, reading and understanding how a short complete program works, than reading any neverending text that ambles on. Take a cue from human language aquisition: Programming books should deliver a sequence of "aha!" moments of comprehension, teaching language constructs through explanations of a sequence of cleanly separated short complete programs. Their success should be measured in terms of the enjoyability and intensity of the experience of reading code this way. Leave it to the reader to find other ways to put together the rest.

[+] ivansavz|5 years ago|reply
Good luck with the LA book. It is a beautiful subject with so many applications, so a great opportunity to do an original take on it.

In case this is might be helpful, here is a preview of the LA book I wrote[1] and the condensed four-page-in-small-font tutorial version[2]. You might also consider using a computer algebra system for teaching, see [3] for my take on LA using SymPy. Last but not least, I highly recommend the CMapTools software for creating concept maps, which can really summarize the field in a very compact form[4].

[1] https://minireference.com/static/excerpts/noBSguide2LA_previ...

[2] https://minireference.com/static/tutorials/linear_algebra_in...

[3] https://github.com/minireference/noBSLAnotebooks#no-bullshit...

[4] https://minireference.com/static/tutorials/conceptmap.pdf

[+] redtexture|5 years ago|reply
I would be interested in what materials you come up with, and what resources you are looking at to make your course up. Syllabus.
[+] assadk|5 years ago|reply
I found this quite insightful. Thank you.
[+] Vaslo|5 years ago|reply
One thing that is constantly left out of books is challenging problems with solutions for the user to cement the new ideas they’ve learned in actual examples. It’s very easy to read along and nod your head but it’s very hard (at least for me) to incorporate my new skills without memorable hands on examples.
[+] TrinaryWorksToo|5 years ago|reply
As a reader, what I do is make up my own challenges. Do I feel comfortable modifying the code and knowing it will still run error-free?
[+] yesenadam|5 years ago|reply
Gee, write a program using what you just learnt and see if it works. You want someone to tell you what program to write?! I assume it's a book for kids, or a school textbook, when I see exercises like that. I don't understand the demand that books not only tell you things, but tell you how to learn everything in them too.

Apologies, I really tried to make this not sound condescending!

[+] KineticLensman|5 years ago|reply
I think the article is really general advice about (tech) writing, not about writing a programming book. There is very little if anything specific to programming itself, e.g. e.g. the types of code fragments you should use as examples.

Also, apart from the line:

> You can always ask feedback from people you trust to gain confidence

there is no mention of getting someone to proofread or even copy edit the book. This would also seem really important for a programming book - e.g. to check that the examples work away from the author's dev environment.

[+] ghaff|5 years ago|reply
>there is no mention of getting someone to proofread or even copy edit the book. This would also seem really important for a programming book - e.g. to check that the examples work away from the author's dev environment.

You're actually talking two different things.

Someone needs to proofread/copyedit the book. Full stop. And, unless you have a partner or particularly close friend who will/can do a careful edit for you for a case of beer and a pizza, you're going to have to pay someone.

For a programming book (or other types of technical books), you probably need a technical reviewer. If it's just a sanity check for technical accuracy, colleagues etc. can probably do that. But to work through all the code in a book, again, someone will probably have to get paid.

[+] aqui_c|5 years ago|reply
Indeed, there's no remark about it because I wanted to split the act of writing from the publishing of the book. The sentence on asking feedback was geared towards checking the ideas, having an overview of what you've written by someone else (which is not the same than proofreading).

All what you mention as missing, is part of my current ongoing process, and I still haven't learned nor tested enough as to summarize it.

[+] csours|5 years ago|reply
> "If you ever start the path of writing a book, you should ask yourself why you are doing it."

I've wanted to create a short video series for my workplace, but I'm stuck on what the approach and theme should be.

The series would be about automotive assembly, and I have a lot of things to talk about, but I keep getting stuck on what people would be interested in and what would be helpful.

[+] sitkack|5 years ago|reply
Start with a round table, provide a space so that people open up about what they find confusing, try to map out the knowledge gaps.

Is this about design for manufacturing from an assembly standpoint? Would it also cover repair? The spark plugs on a VR6 are inaccessible, can you fix that?

[+] throwaway_pdp09|5 years ago|reply
This would be interesting if I could read it. Would it be possible to display text without enabling JS?

I have read several IT books recently and they aren't good. Basic stuff like visibility of diagrams, presenting advanced subject matter but also supposedly in a way that will teach you programming, or having pages of code to illustrate something trivial.

[+] dorkwood|5 years ago|reply
Someone needs to make a Hacker News bingo card. "Doesn't work with JS disabled" would definitely be on there.
[+] aqui_c|5 years ago|reply
I'm working on that. I just used a stock template for the website.
[+] JadeNB|5 years ago|reply
> Would it be possible to display text without enabling JS?

No, because then how would it set up pullquotes like "If you don't set a baseline somewhere, you risk starting a book that grows backward" that you can tweet at the push of a button? (Is that really a thing? I guess it must be somewhere, but it's new to me on a (I guess) programmer's blog.)

[+] carapace|5 years ago|reply
Yeah, I'm getting pretty sick of sites that want to run JS to show static content.