(C) Daily Kos
This story was originally published by Daily Kos and is unaltered.
. . . . . . . . . .



I just published a book today [1]

['This Content Is Not Subject To Review Daily Kos Staff Prior To Publication.', 'Backgroundurl Avatar_Large', 'Nickname', 'Joined', 'Created_At', 'Story Count', 'N_Stories', 'Comment Count', 'N_Comments', 'Popular Tags']

Date: 2023-05-16

A few hours ago, I published my eBook Java with TDD from the Beginning on Smashwords. The book is not really relevant to Daily Kos, aside from a few fleeting remarks about the pathology of the very wealthy (as in billionaires and trillionaires).

But I figure that some people reading this might be interested on the process of publishing an eBook and how to go about doing it, and Smashwords does make the process reasonably easy. If the topic of my book does interest you, I include a 75% off coupon code at the end of this article.

The book is about programming in Java, starting with the basics, but with test-driven development (TDD) as close to the beginning of the book as I could manage. In too many books and courses, even courses that students pay thousands of dollars for, testing software is treated as an afterthought.

One of the strangest deficiencies in the Java Development Kit (JDK) is the lack of a class (or object template) to represent money amounts. Unfortunately, money’s way too important in our lives, and a lot of our software needs to deal with money amounts.

For reasons I don’t care to get into here (but which I do discuss in the book), programmers should not use floating point numbers for money calculations. The “big decimal” class is better for financial calculations but still lacking in ways that you don’t have to be pathologically wealthy to care about.

So Java programmers either need to get a third-party library or make their own from scratch. There has been a proposal to add a money amount class to the JDK, but given how slowly Java has added features Martin Odersky suggested almost twenty years ago (generics, lambdas, pattern matching, etc.), don’t hold your breath.

In my book, I use the money amount class as an example of the TDD process. I hope it’s a more engaging example of TDD than the lame toy examples that are usually used for this purpose.

I am aware that Kent Beck’s TDD book also uses money amounts to illustrate the TDD process. But to make sense of his book, you need to already know Java. If I’ve written my book well, you can learn TDD from it without already knowing Java, you will learn Java and TDD pretty much in tandem. If I’ve written it well.

The first part of the process of publishing a book is obviously writing the book in a format that copyright law recognizes. For Smashwords, the easiest way is to write it in Microsoft Word, making sure to save in the old *.doc format, not the newer *.docx format. That’s what I did for the other books I’ve published on Smashwords. It should work very well for most fiction and nonfiction texts.

But for this one, with it being about computer programming using Java, I figured I needed something less WYSIWYG, and Microsoft Word would get in my way with too many wacky automatic corrections. I figured I would write this book as a bunch of HTML files conforming to XHTML 1.1, and then stitch them together into an EPUB file.

When I started publishing with Smashwords, you could only upload Microsoft Word files, even though the site provides EPUB and other formats (these are made by a proprietary tool that Smashwords uses to convert Word files to other formats). Later they started accepting EPUB and OpenOffice files.

This book took me a heck of a lot longer to write than I wanted it to. Six different versions of Java came out while I was working on this book. However, the software industry’s pretty much stuck on Java 8, and only more recently has there been any widespread moves to Java 11 and Java 17 (these are LTS versions, a concept I explain early on in the book).

I had hoped to publish last week, but I realized that understanding the EPUB format was going to take me way too long. I worried I’d have to import the HTML files into Word and then painstakingly make a bunch of time-consuming adjustments.

But then I decided to trust an EPUB tool, in this case choosing Calibre, which is free and open source. I still had to make a bunch of time-consuming adjustments, including changing the file extensions on a hundred files.

The first EPUB file Calibre made for me had way too many errors, according to the EPUBCheck tool. It looked pretty good in Adobe Digital Editions, so I was confident it would look good in other eBook readers.

I wouldn’t care about what EPUBCheck says, except that Smashwords requires a green check from EPUBCheck before they distribute your book to Apple, Barnes & Noble, Kobo, etc. Of course if you submit a Microsoft Word file then you spare yourself the headaches of deciphering EPUBCheck’s opaque error messages.

There are other requirements for Smashwords to distribute your book to other bookstores that still apply if you submit a Word file instead of an EPUB file. It’s worthwhile to distribute to other bookstores, even though you get a smaller cut of the sales.

My book is $18.99 but you can get it for $4.75 with coupon code DF59E, limited to 100 redemptions within the next couple of weeks. There’s also a 50% off coupon that will be good for much longer. These coupons are only good on Smashwords.

If you’ve published on Smashwords, please feel free to give the title of your book in the comments, and any coupon codes you care to share.

[END]
---
[1] Url: https://www.dailykos.com/stories/2023/5/16/2169775/-I-just-published-a-book-today

Published and (C) by Daily Kos
Content appears here under this condition or license: Site content may be used for any purpose without permission unless otherwise specified.

via Magical.Fish Gopher News Feeds:
gopher://magical.fish/1/feeds/news/dailykos/