Ryan Bigg — Testing, Independent Publishing, and Rails

Ryan Bigg is a Melbourne-based Ruby and Go developer, a 2011 Ruby Hero, and the author of the Leanpub book Multitenancy with Rails and co-author of the Manning books Rails 3 in Action and Rails 4 in Action. In this Leanpub Podcast interview with Len Epp, Ryan talks about how he became a developer, why he’s devoted to test-driven development, his frustrations with traditional publishers’ tool chains, and his move to independent publishing.

Len Epp: I usually like to start these interviews by asking people for their origin story. Could you tell me a little bit about how you first became interested in software development?

Ryan Bigg: Yeah, sure. I’ve always been interested in computers as far back as I can remember. The first computer that I accurately remember was a Commodore 64. We would play Paperboy on it. You had to insert the cartridge and type run or load, and then play the game that way. Dad was doing this invoicing system for his work as a photocopier technician, building it in a language called Clipper, and he found this function of Clipper that played music. He came to me with this big binded manual thing and said, “look, this lets you play music,” and he showed me, if you type play seven it would play a note, and then you play 75 and it would play a higher note. We made music using Clipper, and that was my first experience with programming.

Then I did HTML and CSS probably when I was 9 and 10, and I’ve been doing web really ever since. I enjoy it. You’re always learning new things. You’ve got Go coming to the fore now, Elixir. Ruby was the cool kid back before, and now it’s getting to the enterprising, everyone’s done Ruby level.

Len: And how did you come to be so interested in Ruby and Rails?

Ryan: Between doing HTML and CSS I went and did a network engineering degree. While I was doing that, our parents wouldn’t give me pocket money, I had to work for my living. I was working at a supermarket which paid close to minimum wage, which isn’t so bad in Australia admittedly. But I was doing PHP work on the side, getting paid a lot better than at the supermarket. So I wound back my supermarket hours and started doing more PHP contracting.

Then a friend of mine said to me, “hey, you should check out this Ruby on Rails framework.” And I watched the initial video with DHH where he goes, “whoops,” a lot, and “look at all the things I’m not doing.” It was just fascinating. This is so much better than PHP. There’s little containers that you can put your things in, whereas PHP was you’re just going to chuck all the database logic in the file, all your view logic in the file, your control logic in the one file, and Rails gives you these little boxes. There was this video by Gregg Pollack and his mate Jason something, and they had little jars of things: “this is your controllers and these are your models and these are your views.” That just resonated so strongly with me. Over the next couple of months, I stopped being a PHP programmer and became a Ruby on Rails programmer.

Len: You write on your blog at RyanBigg.com about how much you value the community and how good the people are that you encounter within it.

Ryan: The first speaking gig I did was at the Adelaide Ruby Users Group, talking about creating models in Rails, I think it was. I’m very glad it wasn’t recorded. It would be very embarrassing right now. Since then we have these events in Australia called Rails Camp. What we do is we get like a hundred nerds, and I think this one is going to be a hundred and seventy nerds, and we go out to some remote location. There was one in New Zealand a couple of years ago where we went to the top of a mountain which had no radio, no TV, no phone, no internet, nothing, just completely disconnected from the world. So we mirrored RubyGems, took it up to the top of the mountain, and coded Ruby, Haskell, JavaScript, whatever for four days. That’s the kind of community that I really enjoy, spending time with people who are doing very similar work to what I’m doing, seeing what they’re doing and how they’re doing it, and learning from them.

Len: For people who aren’t familiar with it, what’s the tech community like in Melbourne?

Ryan: Oh, busy is a good word for it. There’s JavaScript meetups, there’s Ruby meetups, there’s Go meetups, there’s Elixir meetups, there’s Haskell meetups, functional programming meetups, PHP web dev. If you’re a web dev in Melbourne and you don’t have work, there is something wrong with you. There’s a huge startup ecosystem here too. We’ve got AngelCube, which is run by Nathan Sampimon. I can never say his name right. Let’s just call him Nathan S. He runs a startup accelerator. They have a bunch of startups in a place called Inspire9, nice office space that I worked out of a couple of years ago.

Len: You have a great post called Congratulations, where you tell a story that seems like it might have some biographical elements, about how you got into test-driven development and behavior-driven development. Could you tell us how that became so important to you?

Ryan: It’s based on a true story. In 2008, I was working for a company and we developed this learning platform, before learning platforms were cool. I changed this part of the application which had a count of maths classes, and the count was wrong, so I changed it. Then the client called my boss, and my boss said, “hey, you changed the count, why did you change the count?” I said it was wrong, and he’s like, “no, no, no, it was right, that’s the way the client wanted it.” Without the tests we had no way of proving that that change was exactly correct or wrong.

There were much more serious issues past that. One day I removed the Hpricot gem, which is the precursor to Nokogiri, and that took down production when somebody else deployed the next day, because there were no tests asserting that our code was actually working. There were parts of the code depending on it that I didn’t realise, and we had an angry phone call from the client. I actually ended up getting fired from that job because I wanted to do testing and I was arguing for testing. The boss was like, “no, we don’t have time for testing,” and then when I would break things I would say, “well, if these were tested then things wouldn’t be breaking as often.”

Len: And the second part of the story was that you went to another place and there you successfully convinced them to use testing, or they already were?

Ryan: They were already using testing. That’s when I was working for Dr Nic, and that’s when I saw the light. Dr Nic, famous Rubyist from years and years ago, one of the original famous Rubyists. I got to work under him and he’s fantastic. I tell this story all the time: when I’d take a feature to him he says, “does it work?” And I’m like, “yeah, it does, let me show you.” And I click login, fill in the username, fill in password, click submit. And he’d be like, “no, no, no, no. Show me the test.” Or when he asked me to run him through the feature again, he’d pretend like he wasn’t watching.

He hammered into me that if you’re not testing, you’re doing it wrong. So I’m just testing all the time now, because it’s a good form of post-traumatic stress. Being hassled by him and heckled by him all the time has actually improved my craft. So it’s a net positive.

Len: What is behavior-driven development, for someone who might not be familiar with it?

Ryan: My understanding of it is that you want to test that a part of your application is working in a specific way. Let’s use the login example again. You want a link that says login, and then a form that has a username or an email field and a password field and a submit button at the bottom. You want to make sure that when a person enters a valid username, valid password, and they hit the submit button, they can log in. That’s the behaviour that you’re testing. Before you do any work, you write the test, then you make the test pass, you add the login link, you build the form and all the other associated code around that, and then it passes.

If that feature breaks in any way, like the login link goes missing or the underlying authentication logic changes, you have a test that can break. Also, if you’re building another feature and a bug pops up, you can write another test with that existing framework. That framework provides you a way of writing regression testing. And regression testing, I think, is the big win of behavior-driven development and test-driven development.

Len: How would you characterize resistance to testing from the developer side?

Ryan: If you asked me this question three, four years ago, I would have said they’re stupid. Now I’m just like, there are merits to not testing your code. You can develop the code much quicker and you can build a prototype. But then I wouldn’t go using that prototype without tests around it. So I chuck out the prototype, rebuild it with tests, and assert that it’s actually working correctly. I try and tell people this, and some of them listen. That’s why I built a book around test-driven development. I think the only proper way to build an application is to write the tests. All my books that build applications, Rails 3 in Action, Rails 4 in Action, Multitenancy with Rails, build tests first, and then they build the functionality, because I think that’s the right way of doing things.

Len: Speaking of your In Action books, they were published with a traditional publisher, and you have a blog post about your breakup with them, where you say you have great respect for the people there, but it was their tools and workflow that drove you away. Could you explain what that experience was like, and how important the tool chain must have been for you to make that kind of decision?

Ryan: They’re bloody Muppets. I like the people there. They’re well-intentioned. They’re technologically illiterate, that’s how to put it lightly. The tool chain was writing in DocBook, which is XML, so I was hand-crafting XML. To start a book you’d have a book tag, and inside that a chapter tag, and inside that a section tag, and inside the section tag a paragraph tag, or a listing block tag. There’s like three tags you need for a titleized code example, and writing that was exceptionally painful.

Then you had to upload it to the SVN server, which might have had conflicts, so you’d need to pull down everyone else’s changes at the same time. Then you need to log into the Manning website, find your book in the list of all the books they’ve ever published, click on the little book icon, click on the chapter, scroll down to the bottom of the list of revisions, click on the little radio button at the bottom, and then click on update. And that would update it for the editor.

I got upset with that process about two months in, and I built my own review system which I called Twist, because every good book has a twist in my opinion. I built it overnight. I started about 2 p.m. that day, furiously coding. I was actually angry for the first couple of hours, and then I was just like, this needs to get done, and wouldn’t it be cool if it did this, wouldn’t it be cool if it did that. I went downstairs about 11 p.m. and thought, that’s weird, my housemate’s not here, he was forever on the couch or on the dining room table. Isn’t it dinner time? Then I look at the microwave and go, holy crap, I’ve been coding for nine hours, in my own little hole for nine hours, and I built this thing and it works, and now I’m bloody hungry, I’m going to cook some food and go to bed.

So I built that, and people were very happy with it. That tool is what helped me write Rails 3 in Action, not Manning’s review tool chain at all. With Twist I was able to add my own reviewers, they were able to leave Markdown-based comments, and it was just so beautiful to work with. I’d never write a book in DocBook ever again because of it.

Len: I imagine the reviewers that you brought in to Twist responded positively to it as well.

Ryan: Yes, that’s right. These other reviewers never got to see Manning’s system. Manning wouldn’t let them in because it gives them access to all the other books. Only authors who are contractually obliged to not share the other books are allowed access to that system.

Len: Why do you think conventional publishers are so resistant to improving the way that authors write books? We hear this at Leanpub, I’ve had personal experience with it, Leanpub’s co-founders have had personal experience with it. Why aren’t people who ought to be in the business of making books motivated to make the process of making books better?

Ryan: It’s worked this way forever, and retraining the people to use new systems is going to take too much effort and too much time. Developing the new systems can come with their own pitfalls. There’s always the thing that the grass is greener on the other side. If you develop a new system, it’s going to be better than the old system. Sure, that might be true, you’ll learn the lessons from the old system and apply them to the new system. The new system is going to come with problems though. It’s the same as if you rewrite an application.

I think they’re resistant to change because it’s a high-risk scenario. It involves them having to cut over from the old system to the new system, and they don’t want to invest the time in that because the current system is working okay. They are pushing out books, but they’re not pushing out books as quick as they can, and they’re not making the process as painless as they can. That is mainly what I have the issue with: the tool chain gets in the way, makes the authors unhappy, makes them not want to write books. Steve Klabnik, my co-author, actually got burnt out on Manning’s tool chain, and that’s why he didn’t finish Rails 4 in Action. Rebecca Skinner and I had to finish it because Steve couldn’t, because of the tool chain.

Len: That’s a much less cynical explanation than some people give. One of the more cynical explanations is there’s somebody who sees this new tool chain and sees that it doesn’t include the type of work that they’ve been doing maybe for their entire career. In addition to the obvious motivation to block a new technology because it might take your job away, which is something to be very sympathetic to, there’s the aspect of seeing the activity you’ve based your career on is now no longer necessary. There’s something kind of heartbreaking about that.

Ryan: There’s all this typesetting work that Manning does as well. Rails 4 in Action, in my opinion, should have been published already. The issue with the printed book is it’s going to run out very quickly. Printed technology books are dead. There should be no need for them anymore. Manning disagrees.

Len: My next question was going to be, how do you see the computer book market evolving in the next 10 years? Do you see authors making a decision like you did to essentially go independent?

Ryan: Yeah, I do, definitely. The big publishers take too much of a cut for the work that they do, in my opinion. I am holding back my cynicism on Manning and I feel it leaking through at the moment. I’m not sure how much I can say on public record, but I was not pleased with them the last time we talked with them.

The market more generally, I think people are not going to go to the big publishers if they have a sense. I think Leanpub is amazing for publishing independently. The cut you get is much more reflective of the work you put in. An author puts 90% of the work in and the publisher does 10% of the work, and that’s what the cut should be financially, 90% and 10% plus 50 cents or whatever.

Len: Yeah, the author royalty is 90% minus 50 cents. We do feel it at least reflects the amount of work that an author puts in, especially if they’re self-publishing and managing all the other processes as well. I was talking to someone the other day, an academic in the sciences, who said he went away from academic publishing partly because his academic publisher wouldn’t even do the formatting anymore. He was being asked to do the formatting for his own book.

I remember I was at Book Expo America a couple of years ago, the big publishing industry jamboree in New York City, and Guy Kawasaki was giving a talk on a panel about self-publishing. He said, “look, the last time I spoke with a publisher about publishing my book, they said, so how are you going to leverage your Twitter following to maximize sales?” And he’s like, “well, how are you going to market my book should be the question, not how am I going to market my book.” And then he went off and wrote a book called APE about self-publishing. I’m starting to hear that signal more from people who aren’t even technical authors, people in conventional trade publication, fiction and biography. People are getting more and more frustrated because publishers are reacting to the changes that have been happening in the world in not necessarily the most productive ways. Even though I know it’s coming, I’m still surprised every time that a publisher would damage its authors like the process you’re describing, and even lose them, because they just won’t change their system.

Ryan: It felt like Manning didn’t want to keep me around even when I was writing Rails 3 in Action. They just wanted the book published and that was it. But then the contract beholds me, if I want to write future books following a similar topic, like a new introduction to Rails book, for three years after Rails 4 in Action is finally published. So let’s say it’s published next month, I can’t publish a new Rails introduction book until July 2018. In a way they want me to write the book and publish a book, but then they don’t want me to write another book. They’re not doing anything to keep me there. It’s in their business’s best interest to keep me on board and publishing books through their platform, just like it’s in Leanpub’s best interest to not piss off their authors. Every publishing platform’s business is to make sure their authors keep producing books and bringing in the dosh. If you’re doing things to make the authors unhappy and push them away from your platform, doesn’t that counteract the whole point of the business existing in the first place?

Len: We hear this time and time again. People don’t go into it vain, they go into it feeling honored or flattered that a publishing company is going to take them on. But by the end of it, they often feel like a used product, or a tool themselves, rather than something that’s respected. There’s something special about a book. It’s a long thing about something you care about, probably something you feel you’re very good at, and something that’s going to fit into your life in a certain way. To the author it’s such an extremely important activity, and then to be treated negatively in that context, I just think people are surprised.

Ryan: It’s like, “I’m trying to help you and you’re not listening to my advice.” My advice is to build a better publishing tool and you’re not doing it.

But it is a huge honor. I was so excited. I remember going over to the supermarket immediately after seeing the Manning email and almost skipping there out of excitement. I was just so happy and radiant. And then it went downhill from there. Now I really don’t like traditional publishers.

Len: So, hopefully moving on to happier things, how did you find out about Leanpub and why did you choose it as your publishing platform?

Ryan: I can’t remember exactly how I found out about it. This always happens, I find out about things and I’m like, this is a really good tool, and then I don’t remember the origin story. I was raging about Rails 3 in Action at the time and somebody recommended Leanpub: “why don’t you publish a new book on Rails through Leanpub?” And I was like, “no, I can’t do that because I’m beholden to Manning because of this contract.” Then I came up with the idea of Multitenancy with Rails, and I was like, wait, I remember Leanpub, I’ll go to them and see what I can do. You guys write Markdown. I love Markdown. Markdown is fantastic for books. It’s not the best format, but it’s good enough for what it does.

The royalty split was nice. The site was great, much better than Manning’s site. If you compare Leanpub’s checkout process and Manning’s checkout process, oh my goodness, there’s like 15 years of software development difference between the two. I’m not kidding. That’s quite a long time in web dev land.

It’s like driving an old 1986 car and then getting this brand new Lamborghini off the lot. I’ve never driven a Lamborghini, I don’t hope to, because I reckon I’d wreck it, but it’s so nice. It’s like being freed from prison.

Len: So I assume you use the Dropbox workflow, where you write in your own favorite text editor and then sync to Dropbox and click preview and publish on Leanpub.

Ryan: That’s right. I write all my things in Sublime, which I love as an editor. It’s brilliant, enough Vim bindings that I can use. And then Dropbox and publish on Leanpub. If I want to publish today, I can publish today. With Manning, I can’t do that. I have to go, “look, I’ve got these updates, they’re in SVN.” And they’ll go, “okay, we’ll typeset them and we’ll publish them.” Like I said, Rails 4 in Action has been content complete since April, so it could have been published in April. It’s now June, and it hasn’t been published, because they’ve been typesetting and indexing and all the other stuff that no one really cares about in a tech book.

Len: You wanted to talk about Markdown, indicating it’s not necessarily the best way in your opinion to write a book.

Ryan: My wife’s a lawyer and she has a great saying, three lawyers, four opinions, and Markdown processing is exactly the same way. You’ve got a double pound sign and a heading and the rest of the content, and it can be presented one way if you use this Markdown parser, or another way with this other Markdown parser, or in a completely alien way with this other one. There’s no syntax reference guide, and I know that Jeff Atwood and his crew were trying to work on one. I have no idea how far that’s gotten.

But there is a much better format out there that I found called AsciiDoc. It’s like if Markdown was designed not by one guy. Markdown was designed using the PHP design technique of, one guy released this library and now everyone used it. AsciiDoc was built with this guy going, “okay, I’m going to take the good bits from Markdown and I’m going to put my own stuff on there, and we’re going to work collaboratively.” It presents tables well, does images, and makes beautiful looking previews with this library called Asciidoctor, which is what I’ve been using for my Deep Dive Rails book, which I’m also publishing through Leanpub. It’s a trade-off against Markdown, but overall, it’s fantastic to work with.

Len: Peter is actually working on a new syntax called Markua, which is meant to solve some of the limitations of Markdown when it comes to writing books, basically a superset of Markdown specifically for books. So hopefully we’ll get your opinion about that at some point. We’re very respectful of the fact that people have different preferences, because writing is such a personal, time-consuming thing. It’s like when a carpenter is hammering away, he shouldn’t be thinking about the hammer, the hammer should just be an extension of what he’s trying to do. Same thing with writing tools and tool chains.

On that note, I noticed that in Multitenancy with Rails you include your personal email address at the beginning for feedback, and you invite people into Twist if they want to be a part of it. Is that something you would like Leanpub to actually facilitate?

Ryan: Yeah, I’d love Leanpub to have a review system. That’d be great. PragProg has this, I think it was designed back in 2007. They have an errata page. It looks very old school, it’s not the prettiest thing to look at. What I’d like to see is, this thing is wrong with the book, and you click in and see the section that it’s commented in, a paragraph or a code block, and underneath it are all the comments related to it. Say the author has written a very complex piece of code, and other people underneath it have commented and said, “no, no, you don’t need to write it like that, you can write it like this.” Then the author can see, okay, this is the good way to write it, and you can have a discussion around how to improve that one little section. That’s why I built Twist.

Len: So it’s discussions rather than logging errors, or both?

Ryan: It can be both. I have these run-on sentences all the time in the book where I have too many commas, and people are like, “well, wouldn’t it sound better if it was written like this?” And I come back and say, “well, this is how I say it out loud, I put in the commas where I pause.” And they’re like, “no, no, no, that’s not good.” And we talk back and forth and come out with a proper way of saying whatever it was we were trying to say in the book. It’s nice that way.

Len: What would you think if we added reviews, both stars and written reviews, Amazon style, where users could go onto Leanpub and write reviews of books? If we made it opt-in, is that something you might opt into?

Ryan: Yeah, I’d definitely use that, because I think that’s a good marketing technique. We’ve been talking about having product reviews at Marketplacer, and according to my sources, that is how to get people to buy your products. If a product has good reviews from other people, say four and a half stars from 30, 50 people, people are like, “wow, this must be good.” Like our microphones, because they had awesome reviews. If it was just like, buy this Yeti microphone, it’s $200, who would buy that? And then they’re like, wow, it’s five stars, it’s got all these great features and we love it, it’s crystal clear quality. Reviews on Leanpub would be a good feature and I would definitely use it.

Len: Is there anything else about Leanpub that you think we could improve? This is what we’re here for.

Ryan: Not at this point in time. I’m very happy with it and I love the new design too.

Len: Thanks very much, that was a long time coming. My last question is that I see Debugging Ruby, your next book, is 40% complete. Do you have a timeline for when it’s going to be finished, or does that matter to you?

Ryan: Debugging Ruby is a book that I’m writing whenever I come across an interesting debugging thing in Ruby. I had a debugging session probably a year and a half ago now with a friend of mine where he was entering a valid username and a valid password into his login form and Devise was saying it was invalid. He would go into the console and load up the user, user find, user authenticate, password’s good. So what was going wrong? Well, you’ll find out if you read Debugging Ruby, that last little chapter of the Devise bug. It walks you through exactly what was going wrong. Any kind of little interesting debugging stuff and debugging tips. When I think of something to put in the book, I just put it in the book.

Len: We actually had a really funny thing happen yesterday. I was doing a little bit of internationalization, and we got a Norwegian translation so that an author can have a Norwegian landing page if they’re writing their book in Norwegian. When you localize in YAML, the two-letter code for Norwegian is “no” colon, and so everything was blowing up, because it was reading it as a boolean value rather than a string. My first instinct when it was breaking was that that’s probably the problem, and I’m not a developer, I just do little things here and there, and one of my colleagues was like, “no, it can’t be that, it can’t be that dumb.”

Ryan: No and yes are reserved things in YAML and they mean true and false. Nobody knows that, except people who’ve been bitten by the bug. Maybe I can chuck that in the book.

Len: If you want to. Thank you very much for participating in the Lean Publishing Podcast, and thanks for being a Leanpub author.

Ryan: Thanks, Len.