Show HN: I wrote a book about WebAssembly

410 points by raboukhalil ↗ HN
Hey HN!

I've been working on a book about WebAssembly over the last few months, and it's finally available at http://levelupwasm.com!

Why a book on WebAssembly you ask? Well... WebAssembly is awesome (obviously ) but it's certainly not the easiest thing to learn. So I wrote this book as a practical intro to using WebAssembly in your web apps.

I would appreciate any feedback!

93 comments

[ 2.6 ms ] story [ 174 ms ] thread
That's a really expensive (and I can afford it). How did you figure out these prices?
Seems like a pretty standard price for a non-fiction book to me..?
Not for a book of 75 pages. The price and the amount of content don't seem to be in balance.
Unless it is of great quality perhaps. But I do agree, it seems like just a bit too much.
This very common line of thinking is how books that ought to be 75 pages balloon out to 225 pages, using 3x the words to convey the same amount of content.
Should you not set the price on the value of the content, not the amount content?

If the book enabled you to e.g. create and sell a WebAssembly project quicker or win a big client project that requires WebAssembly then $29 shouldn't be worth thinking about to most developers.

Books aren't priced by the number of pages
I agree. Look for example on book called "Learn WebAssembly" by Mike Rourke which contain similar content on 328 pages and is priced at €16.00, have free preview and code examples
Seems like it's in the same price range as a lot of other similar books and courses. Authority and Marketing for Developers are two that spring to mind. I'm sure if you subscribe to his mailing list there'll be some sort of sale on at some point.
Yes that's right! I did base my pricing on books like Authority
The pricing is in tiers. Just the book is $29.
The book looks good (I like the demos of the examles), but what motivated you to choose that pricing scheme?
The capstone project and little pacman game look pretty interesting. Think you can spare a short portion of the book to show what the writing is like? I find them to be some of the best litmus tests of what I'm about to get myself into on a technical book purchase.
Thanks Posibyte! Here's a sample section about how to compile jq to WebAssembly: http://levelupwasm.com/sample-jq.pdf. But note that it's from Chapter 7, so some of the HTML portions might not make complete sense without reading the previous chapters, but hope it gives you a sense of the writing style!

Also, here's the table of contents in case it helps: http://www.levelupwasm.com/toc.pdf

Thank you!
No problem, thanks for the idea! I added the TOC and sample chapter to the landing page too since it seems like a common question.
Hey, if it's about web why not provide the option of reading it on web itself? Today I saw someone selling 'offline-first' on dead-tree medium and thought to myself: Really? Does he not believe in offline-first capability of web enough that he went with the older more inefficient medium for offline reading?

Can we as developers not do better?

Above aside, congrats on publishing your book!

WebAssembly is super-interesting, I have bookmarked the page and will buy as soon as I get home.

Thanks marvindanig. Sorry I should make it more clear--the book is digital, so no dead trees here! :)
(comment deleted)
(comment deleted)
Table of contents and sample chapter?

Webassembly for genomics sounds cool :)

Yes! Here's the table of contents: http://www.levelupwasm.com/toc.pdf

And for a sample of the writing, here's the section on compiling the CLI tool jq to WebAssembly: http://levelupwasm.com/sample-jq.pdf (though note that it builds on previous material so it doesn't re-explain everything)

Edit: Also, if you're curious about using WebAssembly in genomics, check out https://github.com/robertaboukhalil/aioli/ and https://github.com/robertaboukhalil/fastq.bio, a tool to get a preview of DNA sequencing quality that uses WebAssembly to speed up the analysis portions.

Awesome! Thank you.
A short (or partial) screencast (might grab people... specially if the quality is good.
NCI Chromatic - Cancer Genomes with WebAssembly:

https://chromatic.nci.nih.gov/

That's so cool, thanks for sharing! Do you know where I can find more info about how it was built/which portion of the app uses WebAssembly?
This provides access to hundreds of public and tens of thousands of restricted access cancer genomes (and often the matching "normal" samples): so you can see and visually verify mutations. Interestingly, too, you can check out germline polymorphisms which might predispose someone to get cancer.

Basically all the work is done in the browser : gzip decompression, custom parsing of sequencing alignment, png generation, etc. Lots of data are pushed to the client at load time like gene location information for genome build "hg38" (the latest). Server only provides reference sequence and sample genomic alignment "slices" for the region of interest. So, all the state is handled in the browser, server only provides trivial "wget" requests.

It is mostly wasm (source is C compiled with emcc). The front page is the requisite html/javascript start page. Pages are created in wasm code and pushed to JS for updating the DOM. Lots of calls to emscripten_run_script("your javascript here"). DOM manipulation straight from Rust/Go/C would be cool but it is not here yet.

Upside is server simplicity and security ... and no downloading and setting up complicated software.

https://www.ncbi.nlm.nih.gov/pmc/articles/PMC5987889/

Code is done by the government so it's public domain. (Your tax dollars at work !)

Nice, I'll check it out! It's really exciting to hear of others using WebAssembly for genomics.
Hey congratulations ! Funny enough, I had offers to write a book on WebAssembly, almost 2 years ago, after writing an article[1] on that topic that somehow ranked #1 on HN for a day :) Had to decline but never doubted someone more experienced would write one!

[1]: https://news.ycombinator.com/item?id=14495893

Thank you! Really nice article btw, I like that you go into that much depth.
Looks great. I would definitely buy this if there was an option for a printed book.
Just picked up the “complete edition”. Really looking forward to going through it all. This looks great!
Not sure if you're a shill, but you sure seem like a shill to me.
It's an expertly played 4.25 year long con...
I was thinking more like a friend of the author..
haha, nope, no idea who d2xdy2 is but I highly appreciate them for buying the book though! :D
Just a developer in Atlanta.
Thanks, looking forward to hearing your thoughts on it!
Does the book cover anything on rendering with OpenGL or graphics libraries?
Yes! Chapter 8 talks about graphics; the Pacman example shows how to port a C++/SDL2 Pacman clone to WebAssembly and OpenGL (with Emscripten). That said, the focus of that chapter is porting games like that, but it doesn't go into writing OpenGL directly.
Honest feedback: Pricing is high.

Also, to me, this doesn't look like a good way to use Show HN. A link to Amazon wouldn't be different than what you just did.

While shameless self-promotion would be an issue, I think this is exactly in line with what HN (and even Show HN) is for. Although that's really up to Dang et al.

It's a topic that is highly relevant to this community and for which there is high demand, given the number of Web Assembly tutorials that make it to the front page. Obviously, it's commercial, but so are many of the projects in Show HN. The ones that aren't are still self-promotional in some manner.

I often find that looking at book sites is an interesting way to learn what technologies are getting popular and I'm always curious to see the projects used to teach these things. Posting a book's website can start a conversation, whereas an Amazon link is more likely to start purchases and little more.

Finally, writing a technical book is an impressive accomplishment. Specifically, it's an impressive technical accomplishment.

Regarding price, $29 seems quite reasonable for a technical book. Many cost $35-45, and that's without getting into textbooks.

Thank you jamestimmins, that’s also my understanding of Show HN
Show HN is explicitly self-promotional... sure, it's usually used for software projects of some sort, but I don't see any reason that it shouldn't be used for a book you wrote, especially when it's very topical, relative to the community here.
Congratulations on shipping! You accomplished something that vanishingly few people do. You should be incredibly proud of yourself.

Always Remember: the people on this site complaining about price are not your customers, and that’s ok. There are always people on this site that complain about price. When I launched my book and it got on here half the comments were about the price instead of the book itself. Ignore them. They’re noise. Focus on selling to your audience.

Not completely true, i might complain about the price of a car dosent mean i dont want to buy it
Well here it’s more a self published pdf than a book. It didn’t pass a publisher screening nor got an ISBN so it’s hardly a "real" book.
Yes, the ISBN is what gives it that booky authenticity.
(comment deleted)
FWIW, my second printing of Donald Knuth's Fundamental Algorithms from 1969 lacks an ISBN.

So either it is also not a book, or else OP is in good company.

If I remember correctly you can get an ISBN for any self published book without much hassle. I used to do a magazine with a friend and we self published with an edition of 100 for each issue. Getting the ISBN was easy. Congratulations on writing a book, and don't let anyone tell you it's not a real book, just because you don't have a publisher or it didn't get printed yet!
As a Canadian resident I get free ISBN's for the books I self publish. It takes about 2 minutes online to get one assigned.

In the US you just buy them

Nice work. A small note - you might want to redirect http->https on your site, especially as you are taking payments. You wouldn't want a MITM to redirect your customers to another payment processing page.

Also my browser is reporting your https certificate as invalid so sort that out too.

Thanks for the tip! Luckily I don’t process payments myself but use Gumroad to do that, so payments are safe, but I’ll get an https certificate for the landing page.
if someone mitms your landing page, they'd be hijacking the payment links to redirect to their phishing hook rather than your payment service.
So much PR of this book is everywhere, as if Brendan Eich himself wrote it!
Haha, I can confirm Brendan is not the author. Just curious though, where else have you seen this book mentioned?
How can web assembly deal with per-env variables? Need to recompile for every environment? That means recompile at startup, since I deploy the same artifact to different envs and allow the env to define its vars. For this reason, as a sys admin, I hate web assembly (and most other asset pipelines)
This seems to be a book about unsing emscripten to get c/c++ to run in the browser. What if I want a book about writing wasm from scratch?
Looks nice. If you are planning to expand this, I would be interested in a comparison of the different toolchains (e.g. Emscripten vs. Go vs. Rust). Currently, I would choose the toolkit of my favorite language, but I have no idea what kind of consequences such a choice has.
I see the sample chapter has an autoconf porting example. Is porting a CMake based project covered anywhere in the book?
I don’t have an example that specifically uses cmake, though similar principles apply but you’d use the emcmake utility. That said, thanks for the feedback! I’ve added that to my list of things to add to the book.
Intersting, I've been looking into this recently and this might be the thing I need to finally get stuck into it. Pricing seems reasonable, I'm not sure about other comments saying it's a little high.
Congrats! Any comments on how straightforward you found completing the book? Did you get stuck at any point? What was the most difficult part?

Also, do you have a marketing plan? How are potential buyers going to find this?

Random SEO tips from a quick look: clean up you heading hierarchy (start with H1, nest H2 - H5 appropriately; right now they're pretty random), add ALT text to all images (the ones with source code could get you more search hits for example), add a meta description and also add HTTPS (very important for security as well).

Thank you for the tips! I'll be writing an article in coming weeks about my experience writing this book. This is the second book I self-publish, and unlike the first one, I actually tracked how much time I spent on each category of tasks (writing, editing, marketing, head scratching, etc), so the article will also include that. Stay tuned!
Looks cool!

If I don't know any C++ (and never plan to) but am learning Rust, do you think there is value here? Or is really focusing on the C++ -> WASM experience?

Thanks! Yes the book focuses on C/C++, but you don't need very much C/C++ knowledge to follow along in the book.

Most of the time, we treat C/C++ libraries as black boxes that we compile to WASM, though in some cases like Pacman, we do have to modify the original code, but you should be able to infer what we're doing from the context and the text.

I'm getting your book - thank you. Also wanted to say I really like the site you have put together. Minimal yet everything there. Perfect.
Congratulations on your book! May I ask why you choose self-publishing road instead of publishing it on publisher? I am not saying one way is better than the other. I am just wondering.

Is it because no interest from the publishers? Or is it because you think the royalty percentage from publishers is too low? Or you don't have any particular reason? It's just feel natural to do self-publishing.

Also, do you hire editors?

Thanks! I like to self-publish mostly because I can craft the book in my own way and move faster. I also enjoy being able to touch all aspects of the book, including the design and marketing.

This is actually my second self-published book (first one was about wrangling data on the command line with bash), so it does feel natural to self-publish at this point!

Why not place the compiled demos directly on the website?

This could show the practicality of the approach, e.g. that the demos work in every browser. It also shows (hopefully) something that can be done only in WebAssembly, and not in plain JavaScript, which can provide motivation to actually learn about WebAssembly.

Also, I'd like to see a TOC and sample chapter.