Remote Ruby
host: Jason, Chris
Ruby programming, simplicity in programming, PostgreSQL functions, OpenBSD usage, personal CRM system
listen: (download)
watch: (download)
Transcript:
Jason
Derek, welcome to Remote Ruby
Derek Sivers
Thank you. I am thrilled. And I know that’s like a cliche thing people say, but I’m actually thrilled to talk Ruby stuff. I spend so much of my life in Ruby and Vim, but yet nobody sees it. People only see my books and they see my talks. And when they want to talk to me, they want to talk about business or the meaning of life. But nobody wants to know about my Ruby. And so I got your email to talk today was like, “Absolutely, yes. Let’s talk Ruby. I’d love to.” It’s such a huge part of my life and I never get to talk about it.
Chris
When Jason told me, I was like, “No way.” People can’t see it since we’re on a podcast, but I’ve got one of your like really early copies of “Anything You Want” with an autograph. I think it was like the first 25 people or something on Amazon that bought it, got like the signed copy. And you know, I found out about you way back in the day when I was learning rails in college, 2015, 2011, somewhere around there and stumbled on your programming posts and story about CD Baby and stuff. And just over the years I forgot all of that. I remember reading all your blog posts and listening to interviews and stuff, but over time forgot that you were Ruby developer. When Jason mentioned that, I was like,” Oh my gosh, I cannot wait for this.” We’re excited.
Jason
So I think a good place to start, if it’s all right, would be maybe just kind of how you got into programming first, but have a prefix question I want to ask before we get there. Do you ever get tired of talking about CD Baby? Is it like a thing that’s like, I wish people would stop asking me about that thing business wise.
Derek Sivers
Yeah. When somebody says like, “Hey, tell me how you started CD Baby.” It’s like, “Oh, you know, that’s that was 1997.” But talking tech never gets tired for me, as I said. So yeah, quick context and I’ll kind of do this rapid fire so we can get to the more interesting stuff. But I was not a programmer. I didn’t want to be a programmer. All I was trying to do was-- I was just a musician selling my CD. But this is in 1997 when there was literally not a single business anywhere on the internet that would sell independent music. They would only sell your music if you were like Madonna or Miles Davis and had a record deal distributor. So I thought okay, how hard could it be to just build a little web store? But in 1997, it was hard. There was no PayPal or anything, so I had to make these like CGI bin Perl scripts copied out of a book just to make a shopping cart. So it would kind of keep state and put items into a cart. And then when somebody typed in their credit card number and clicked place order, all it would do is send me an email with all of their credit card information in plain text, and I would highlight my mouse over the credit card number, click copy, alt tab paste into like a credit card merchant program and charge people’s cards by hand and place every order by hand. So that was my first time ever programming anything. And even then I just put it into a FileMaker Pro database, which nobody uses anymore.
Derek Sivers
But it’s like a native app, just that’s like a visual database to keep track of things, almost like a spreadsheet plus. But then it kept growing and so I had to go server side. It’s like the concept of a server side database was completely foreign to me, but somebody on a Usenet newsgroup explained that I’m going to have to do this thing. And they said, “Just make sure you stick with open source. Don’t let anybody sell you on some commercial program because they all go out of business. Only trust open source software.” And I’m so glad that dude in Croatia that day in 1998 steered me that direction because yeah, it just got me looking into learning SQL instead of just trusting some commercial app. And at the time Ruby wasn’t really out then. So it’s 1998. I learned PHP, which was the thing to do and just built my own thing from scratch, except it was just bare bones did nothing, but the whole point was just to sell my music and sell my friend’s music. I was learning for a specific purpose and that is such a damn good way to learn. Necessity is such a good teacher when it’s like something’s broken and you have to fix it, or your customers are begging for a feature and so you have to figure out how to implement it. That’s how I learned programming from scratch was just because people were asking me to, basically. So that was my beginning.
Jason
It’s a cool beginning and we won’t necessarily go into like the CD Baby story here. I think you covered that pretty well in books and blog posts, but you did build quite a successful business out of learning how to program. And so kind of maybe specific to this podcast, when did you learn Ruby or even hear about Ruby?
Derek Sivers
Okay. So then 2003, I’d been running my little web store for five years, in PHP, and I’d heard about object oriented programming, but I had no idea what it was. And it was like Christmas vacation. I was going to my girlfriend’s cabin in Sweden. My girlfriend at the time was from Sweden, so her mom had a cabin, as many people in Sweden do. And we were going to the cabin for two weeks. It was going to be completely offline. So I heard that there was a language that was completely object oriented called Ruby. It was totally obscure. Nobody was talking about it. There was only one book on Ruby the Pickax book. And so I bought and downloaded the PDF of the Pickax book, downloaded Ruby and its Man pages, and then went offline to a cabin in Sweden for two weeks. And there I learned Ruby and object oriented programming. Oh, and I think I bought like 1 or 2 books, just about object oriented programming, just trying to understand this whole idea of like classes and objects and calling it. So it was just a new way of thinking. And Ruby was the thing I learned it with and just instantly fell in love. It was just this breathtakingly beautiful little language. And after ugly PHP, I was like, “Oh God, this is great. Oh, I want to use this for everything.”
Derek Sivers
So but there was really nothing you could do in Ruby yet except just write some little shell scripts. So for 2003 and 2004, I was just writing shell scripts in Ruby, and I even went off to a-- I think the Ruby conf might have been a year later, but there was like talk on the Ruby Usenet group or a mailing list or something that there was some guy in Denmark that was writing a web framework for it. So I emailed him and said, “Hey, I heard you’re writing a web framework.” And he said, “Not ready yet, go away.” That later was Rails. But there was this cool sense of community that Ruby had before Rails was invented where it was just like language nerds in a way that you’d imagine going to like a common lisp or racket or Haskell conference might be now. But even those have been around a long time. It’s just like pick some obscure programming language that’s out now. Say like Lua. If you were to go to a Lua conference, it would just be some nerds because nobody’s making a ton of money with Lua, it’s just people who have self-selected to nerd out on a certain language. And so that’s what Ruby used to be before Rails came in. But it was really cool. It had a great sense of community and why the Lucky Stiff and his.
Jason
The Point guide.
Derek Sivers
The poignant guide to Ruby.
Jason
Yes, you had mentioned that. And I don’t know if you knew I wanted to show you. So there’s actually a hard copy of it. Andy Kroll, he puts on Bright and Ruby. Yes. He had these printed and so didn’t make it to Bright and Ruby, but he mailed me a copy, so I’m sure he still has some if you want to actually get a copy.
Derek Sivers
I had no idea. Andy and I used to work side by side in Singapore. We lived in Singapore at the same time before he moved back to England. So he and I spent many, many hours pair programming at the table in Singapore. But I didn’t know he’d printed that. That’s so cool. Well, all right. But yeah, so that’s my Ruby history. And then so now I’ll just quickly do my Rails history. So then when Rails came out, I was like, “Oh hell yeah, this is great.” I’ve got five years of ugly legacy code in CD Baby in PHP. I’m going to rewrite this thing in Rails. So as soon as Rails was announced, almost immediately I announced to the world in a blog post like, “All right, I’m rewriting CD Baby in Rails.” And I remember some people said that helped them take Rails more seriously, like, “Oh wow, this business that’s already making millions is going to rewrite in Rails. Cool.” So I started doing it and of course the first 80% was easy, quickly replaced my crud stuff with Rails. Hold on, I have to stop to give you the one bit of trivia too. Is that the guy that showed me Rails when I first heard of it, there was a guy that was already using it and he said he could show it to me better than just sorting through Man pages. So this guy named Toby, I paid him 100 bucks to sit on the phone with me for two hours and walk me through what Rails could do.
Derek Sivers
He did a great job. He showed me Rails so well, and a few months later he said, “Hey, I’m starting a new company, like an e-commerce company. I’m looking for investors.” And I said, “Oh, sorry, dude, I can’t help you there. Thanks for showing me Rails, but can’t help your little company idea. Good luck.” Anyway, Toby started Shopify and is now a billionaire. So that’s the Toby who taught me Rails. So then, I started using Rails to rewrite CD Baby. 80% of it was easy. But then I hit upon the really hard stuff like just CD Baby was doing things that Rails didn’t do. Maybe it does these days, but that’s kind of the framework problem that many people can talk about and have, is that frameworks are great if what you’re doing fits the framework, but if you want to do something that doesn’t fit in the framework, it’s really hard to try to make a framework do something it wasn’t meant to do. So I struggled with that for a long time and after two years I gave up and I used what I learned from Ruby to just rewrite my code from scratch in PHP, and it only took me like ten days to do it. It was more beautiful because of what I had learned from Rails. So still to date I have never actually used Rails. Everything I do is in Ruby, but nothing I do is in Rails.
Jason
When I first emailed you, I was about to give a talk literally like two days later, and the talk I gave was on the Rails renaissance. So in order to kind of cover Rails kind of picking up steam again, I had to cover the nice pun. I didn’t even mean it to cover that. I had to start at the beginning of Rails. And so I didn’t get into Ruby until like 2012. So I started the first blog post on the Rails blog and just went down. And one of them was CD Baby chooses Rails to replace PHP. And so I include that in my slide. And then when I emailed you, you’re like, “We actually never shipped Rails.” I was like, “I’m going to delete that slide now.” So that actually saved me from looking like a complete dumbass. So if I understand correctly too. So PHP has more object oriented features now it has like classes and things like that where those are round. In the early days of PHP, there’s kind of object oriented features or I don’t know.
Derek Sivers
And if they did, I didn’t use them. Yeah, it wasn’t the object oriented stuff that I got from Rails. It was more just like learning some best practices and just smarter ways of routing and viewing. And I think maybe like the whole like model view controller split I wasn’t doing right before.
Jason
Gotcha. So my next question, two years of work and then decide, I mean, obviously you were able to rewrite in ten days, but what’s it feel like to be like, you know what, this isn’t working and push that work aside.
Derek Sivers
If you’ve ever had a breakup with somebody that you’ve been with for a couple of years and it just wasn’t working out, and when you break up, it’s probably a big relief because you spent two years trying to make something work that just wasn’t working.
Jason
That’s the most apt analogy I’ve ever heard in my life. I feel that. So you rewrite in PHP, eventually CD Baby, you go a different direction. Where does Ruby fit into your life? Post CD Baby. What kind of things do you build with Ruby these days?
Derek Sivers
Everything. I keep thinking I should learn another language. So many times I’ve like read a book on, say, Elixir or Lisp Racket or even Perl Six was surprisingly sweet. Sometimes pick up these books and read them just to understand them. And in the end, just think, “God Ruby is gorgeous and it works. It does everything I need to do. I’m just sticking with it.” So everything I script, everything I do, all my programming is in Ruby.
Jason
You kind of mentioned the early Ruby community and what it was like, and of course, the three of us, our experience is different. By the time I started going to Rails in Rubyconf, there had been a decade of them and there’s a lot of corporate sponsors. So hearing that kind of Ruby community is different and was just kind of curious, what was your experience in that community like? Did you get involved in the Ruby community?
Derek Sivers
Not really. I mean, more like just ending a couple conferences each year, but it was really sweet. Like some of the early originators like Jim Weirich, who invented Rake and was just such an early pioneer, or Dave Thomas and Andy that run pragmatic programmers that wrote the first Pickax book and got to be friends with them and being around nerds that are pursuing something intrinsically instead of for extrinsic rewards. In that first Rubyconf I went to in San Diego before Rails, it was just like 200 nerds in a basement that just geeked out on this programming language and liked it enough that they flew to San Diego to talk to other Ruby programmers about it. They were just nerds. I really like things that haven’t been corrupted by commercial interests where you get all the extrinsically motivated people there that are using this to make money. For example, in 2012 I nerded out on Cryptocurrency for a little while. I was like, “Oh, Markov chain, this is interesting. Okay, let me figure out how to make my own Blockchain.” And thought that was just kind of nerdy and interesting. And then by like 2013 was over it. Then four years later, a lot of people look at it, they’re like, “Oh, I can get rich with this. Oh, rich, rich, rich.” It’s like a different set of motivations. And so I think there’s nothing wrong with getting rich. There’s nothing wrong with people that want to make money or that are motivated by that. But it just has a different feel. So I like nerdy little communities that have no hope of making money with their nerdy fascination.
Jason
I respect that. Chris and I and Andrew often talk about how different it is when we’re writing code, even for side projects, when the side project is geared towards making money versus a side project is like, I just want to build something. I have fun programming both. I have way less pressure in one and a lot more like nerd out.
Chris
Some people get started programming just for fun and then you think, okay, that’ll be fun. I’ll have a career in this, and then it switches from intrinsic to extrinsic there and you’re like, “Now it’s a job and it feels totally different.” When you were starting to learn to code, were you just doing it for fun or was it you mentioned you learn PHP for selling stuff, but were you dabbling in programming before that? Just for fun?
Derek Sivers
No, not at all. I had no other interest in it except that this thing I was doing to help musicians that I was spending literally 3 or 4 hours a day of manual labor copying and pasting things. I spent 3 or 4 hours a day doing highlight my mouse, Ctrl, C, alt tab, Ctrl v, alt tab, Ctrl c highlight my mouse alt tab, Ctrl v. I was doing that for like 3 or 4 hours a day before. I thought, gotta learn how to automate this. I need to learn this. Then I would automate one aspect of it and then my business doubled in size. So then I was spending hours a day doing manual labor, say printing orders. So maybe now they’re going into the database automatically, but I’m still having to print them manually. So like I need to figure out how to generate a PDF file from this data in the database. So then I’d work on that. It’s like, “There we go, Finally, that’s automated.” But then something else would come in, like say picking the CDs off the shelf was chaotic. It’s like I’ve got to figure out how to like sort it. So I know like I’ve got an alphabetized list of what to pick up.
Derek Sivers
It’s all going out today. And so it was just these constant daily challenges, trying to save myself hours of manual labor. I was doing it out of a necessity and need first. And then I guess once I got fluent in programming, then I just started getting fascinated, just learning that there’s a different way of thinking about this. You learn about functional programming and no state. What do you mean no state? What do you mean no variables? Then you learn about object oriented programming. You just go, “What? That doesn’t make any sense to me.” And then you understand. Oh, okay. This is a completely different way of thinking about it. And I think that’s the time maybe that I started to just get really intrinsically driven. But then I wanted to start to understand very different ways of doing things from now what I had already known. So at this point, I’m already using the model view controller methods of Rails, even though I rewrote my little thing in PHP, But that’s when I started exploring, wanting to learn even more different ways to think about the stuff that we’re all doing. So that’s when I got really into SQL.
Jason
Which baseball up? Let’s hit a grand Slam here.
Jason
One of the things you talk about that really clicks with me is you had a couple of blog posts for a while about ways you use the database. You could write this in Ruby, you could write this in a programming language, but the database is really good at it. You can just handle it. And so that was like, “Yes, let’s go.” I would love to hear kind of these days we can talk about a couple of things. We can talk about the e-commerce store that you use to sell your own books or if you want to. You have a people database, kind of like a personal CRM. And I would just love to hear how you approach building those.
Derek Sivers
So we have to talk about Rich Hickey and a talk that I know that you know, but I hope that every listener of this will immediately after finishing this podcast or pause right now and go to YouTube because you have to see the talk. It’s important to see the slides. It’s at the Railsconf 2012. Rich Hickey, the inventor of the closure programming language, gave a talk at Railsconf in 2012 that is the single most influential talk on my whole life. This one talk by Rich Hickey has changed my life more than any other single talk I’ve ever seen in any venue, in any field in life. Not only did it completely change the way I approach programming, but even apply it to life all the time. So I’m even telling my non-techie friends about this talk. So the essence of it is he starts out by pointing out the mistaken definition of simple versus easy. He said we often get those two confused, but he said simple is an objective definition. It means unbraided. It has only one. It’s not connected to other things. The opposite of simple is complex, but complex is based on the word complex, which means to braid things together. So when something is complex, it means it is complex and it is intertwined and braided together with many other things. Whereas simple means it is not. It’s not braided together with other things. It’s not complected so easy just means it’s near at hand.
Derek Sivers
It’s familiar to you, it’s easy to do. So the problem is we get those two things mixed up. So favorite punchline of the whole talk is he said it is dead easy to type gem install hairball. And he said there it was only three words you hit enter. But now you have just installed a massively complex thing with so many dependencies and everything is tied together and it’s fragile, it’s unreliable. There’s so many points of error in there where it is hard to build something simple. And I just love that distinction. I think about it in other aspects of life, but that changed the way I think about programming so much, because basically all of us have this massive of complexity, this complexion in our life where our Ruby code and our SQL data are two halves of a whole. That one won’t work without. The other people are using their database as like dumb data storage, and it won’t work without the Ruby code around it. But then the Ruby code won’t work without the database. Database won’t work without the Ruby code. You can’t just go to your database and say something like merge two accounts or refund this customer because all of your data logic is kept in Ruby in these Rails models. I saw that and I just felt this deep sense of this is wrong. These two things shouldn’t depend on each other. This is complicated.
Derek Sivers
This is complicated. I want to simplify this. So of course, there are a couple of different ways you could simplify it. You could just say, “I’m not using a database anymore. I’m just going to keep everything in Ruby.” And don’t even know what that would look like, like marshaling objects or something like that. And I guess that’s what some people try to do with like NoSQL databases. If they use nothing but JavaScript, like everything is just kept in JSON objects persisted somehow. But to me I don’t love SQL, I know SQL. I believe in the database. I think PostgreSQL is a marvel. And after the Rich Hickey talk, I looked at my situation and thought I really need to be keeping my data logic where the data is because we call it business logic, but usually it’s not. Usually it’s data logic that a date must be four numbers, two numbers, two numbers. An email address must have an at sign in it. This is data logic or a price of an item can’t be below zero. Things like that. We call it business logic, but really I think that should be kept where the data is kept. So looked deeper into the PostgreSQL manual and it was right there under our noses the whole time. You can program functions in SQL to do these things. You just create a function that can bundle up SQL commands into one and it can have variables in there.
Derek Sivers
It can do things like loops and conditionals that we usually don’t do in databases. We often treat our database like dumb storage, but once dove deeper into the PostgreSQL manual and realized how much it could do, I had this vision on the horizon that I was headed towards and now I’ve achieved, which is that the database becomes kind of like a black box, its own self-contained thing. So you could just call a single function to the database which says refund customer ID number and amount or order number. And the function in your database itself knows how to do that. Or you can say merge accounts or you can say mark order as paid. And ordinarily we would do a bunch of Ruby code with models that have this awareness of the database tables in order to know the types. And then these Ruby methods that we would use to keep all of that logic that’s being actually executed in the database. But we keep it in Ruby because people don’t like to program in SQL. And I just thought, well, if I could just get over that one kind of distaste that we have for SQL because it’s not a pretty language like Ruby, but God, the simplicity of having everything in the database is so beautiful, so that now my Ruby code is really just calling methods, calling functions in the database. And it is so beautifully simple. I love it.
Jason
It sounds amazing. I was fortunate enough in my first Ruby job, our CTO-- very, very, very, very and still understanding it. Knowledgeable in Postgres taught me a lot about stored procedures, having functions in Postgres and using views and really learned while the database has a lot of power built in and I love the phrase dumb storage because that is how I treat it. Like when I fire up a Rails app like Postgres is just a thing I need in order for models to work. And then all of my logic is written in Ruby and I gave a talk about what happens if you have two Rails apps talking to the database and they have different validations, different ideas of what’s considered valid data, well, your database ends up in a confused state. So the simplicity part I think is cool. So for example, like refunding an order, we can put the logic in the database for like actually setting the proper states and things like that. And so then really your only Ruby code is about firing that function and actually like telling a processor to do it right.
Derek Sivers
So now guys, I don’t even use Bundle. I actually, I searched just before this call. I searched my entire code base of all my active Ruby code. I only use two gems. I use the PostgreSQL connector and I use Sinatra. And that is it. I don’t use any other gems. I have no need for bundle, so I don’t use Rails. I use Sinatra to handle the HTTP web requests to route things so captures the URL and then just say, okay, well based on this URL and a couple conditionals if it matches this regex. So I know that there’s an integer after the invoice in the URL or something like that, then pass that to the database and then the database hands me back a JSON response that’s ready to parse. Either just hand back as is if it’s an API thing or just an JSON, decode it and pass it to an IRB template displayed to the user. And it is so damn simple. So I was thinking about the difference between a car and a bicycle. So Rails is really complicated. So is my car, but I happily drive my car and it’s very complicated and I never look under the hood. I have no idea what’s under there.
Derek Sivers
I don’t want to know. That would take years of work to understand. And I feel the same way about Rails, that it’s like, that’s some really complex shit going on there that yes, I could try to really understand Rails like every line that’s in there. And I admire the people that do. But damn, that’s not for me. For me, when I want to really understand something, I want it to be as simple as a bicycle. I can understand a bicycle. In under ten seconds, you can look at it and go, “Okay, there’s really just three moving parts here. There’s a pedal, there’s a two wheels and that’s it.” I can understand that. And so that’s how I feel about my web apps, is that they are as simple as a bicycle. It’s just Sinatra to grab the routes, pass the function to the database. Anything that touches the database, the functions for that are in the database. And then Sinatra is just the controller and it passes things to ERB for the view, and that’s it. So it’s just as simple as a bicycle and it makes me so happy.
Jason
I was going to ask, so pardon me if I’m being presumptuous. I assume when I order books from your website, that’s code you wrote to like kind of build the e-commerce flow. When I build something, I have fun building it, and then usually I kind of am like, “Oh, I hate maintaining it.” But you still sound excited about your code. Like, is it still fun when you have to go make updates or make changes.
Derek Sivers
Not only fun. I miss it when it’s done. I rewrote the code that you see at sivers.com is my store that’s run entirely in PostgreSQL functions with a Sinatra controller and it took me a couple months to kind of rewrite it from scratch recently because I had to do some things to allow for multiple warehouses and things like that. It was just worth to kind of do some rewriting of it. So it took me a couple months of writing. Again, it wasn’t easy, but it’s simple, but it was done. I launched it and then a couple of weeks later I was like, kind of miss programming. I was like, “Is there something I could code right now?” No, I really do love it. I find it very peaceful. I find people and all of their emotions and incentives to be exhausting and I find coding to be rejuvenating.
Jason
So I’m literally like just taking that in because I agree with that. Things are complicated. I’ve just never really sat down and thought about it. So I’ve mentioned it a couple of times, but again, in one of your books you mentioned, I don’t know if you still run it, but you had a database of just people you interact with just so you can remember and kind of similar setup. Sinatra and Postgres.
Derek Sivers
Yeah everything. That thing I just described about just putting all the functionality into PostgreSQL functions, I started that change over six years ago, and after seeing the Rich Hickey talk and now I’m 100% that way, everything I do is just anything you see at my website or when you send me an email, I’ve got to just open source this someday I’m going to do it soon. Who knows, maybe even by the time this is live. But I wrote this thing for CD Baby’s customer service so that when a customer would email us, it wouldn’t just go into a pop or IMAP email. I’d use pop to download the email off the server. Oh, actually, you know what? That’s one gem that I use. Maybe I use three gems because Mikel Michael wrote a gem just called Mail Gem install mail. So I used the mail gem to parse every incoming mail that’s downloaded with a POP3 server, parse the mail itself, get who it’s from, the subject, the body, the attachments, and stick them all into a database. And I use the email address to look up in my history, have one single database of every person I’ve ever met, basically, so it looks up for the known email addresses for each person. Is this from somebody I know already? If it’s not, it sits in a like a to do list of is this a new person I’ve never met before, or is this somebody I already know emailing from a new email address? So then I attach them into my database.
Derek Sivers
I insert the body of the message into the database and the attachments, and I only reply to the emails after it’s already in the database. And then even to reply is to insert a new email referencing the one with a status of outgoing and then a cron job every ten minutes in Ruby goes through those ones that are queued as the outgoing status and sends them. So yeah, I did this all myself initially for CD Baby’s customer service, but after I sold CD Baby, I got to keep that part of the code. They ditched the code and now I think CD Baby is written in Windows or some crap. Don’t want to know, but it’s like ASP or something. But yeah, kept that code for myself. And now even that is all just PostgreSQL functions when everybody that email or anytime you guys email me or any strangers listening to this, send me an email, say hello, introduce yourself. I love talking with fellow programmers so your emails will go into my database.
Jason
Now I’m just getting into the technical weeds here, so when you reply to an email, do you actually do it from like a web interface?
Derek Sivers
Yeah
Jason
That’s why I was saying like, how do you sync that up with your mail app and stuff? But yeah, that makes sense. That’s pretty amazing.
Derek Sivers
It’s actually the reason why I haven’t open sourced this yet is basically I have one big mono database just called Sivers. The most core table is people, but then everything’s tied to that. So if you leave a comment on my blog, it looks up your email address and people and it ties that comment to your record in my people database, you buy a book from me and it’s tied to your people database. Even the other things I’ve done have a web app called Music Thoughts with quotes about music that’s tied to the central people database, a translation app with translations for books by many different translators and all the different translators. Even when you guys saw the printed copy of my books, every sentence in that book has its own entry in a table called Sentences, which is tied to a table called Translations, where I’ve hired translators to translate each sentence in a one to many relationship between the original sentence I wrote and the many different languages and the translations. So all of this is in one single database. I have said in the past that I plan to open source it. I’d be happy to just hit publish and put this on a public repository, but it wouldn’t be usable to anybody because it’s just one big thing that’s like all tied together to my single people database with like nine different Sinatra apps to access it.
Chris
That is fascinating. When you’re explaining this, I feel like you think of programming as an extension of yourself. Do you see yourself like if somebody asks you, would you say you’re a developer? It’s interesting. A lot of people want to have that title, and I hear you speaking about it and it feels like this is just who I am. I have these tools in my tool belt and I use them and I don’t need to be titled as a programmer or anything like that. And it just came to mind and I was curious, what’s your philosophy on that? How do you see yourself?
Derek Sivers
You give a different answer based on who you’re talking with. So if you’re on an airplane and somebody sits down next to you and you’re like, “Hey, buddy, what are you doing over there? Hey, so what do you do?” And you just get the feeling like this isn’t a person you want to talk with. Then I say I’m a programmer. And they go, “Oh.” And they don’t know what to say to that. Like almost nobody has a follow up thing to say if you say you’re a programmer. But if I happen to sit down next to one of you guys on the plane without knowing it and I said, I’m a programmer. And you went, “Oh, really? What language do you program in?” I’d say Ruby and SQL. And you say,” No way. I’m off to a Ruby conference right now.” I’d say, “Holy shit, let’s talk.” So publicly to strangers, I love saying I’m a programmer because it shuts down the small talk I don’t want to have, but say if I’m meeting somebody that I can tell is going to be a good friend or I can tell like, “All right, this is the kind of person I want to know.” Then my more thorough answer is that these days I’m more of an author than anything, but it’s probably more like 50/50, like how I actually spend my time. It’s like author/programmer. Yeah, it’s a core part of what I do and how I approach life.
Derek Sivers
I’m always looking on how to automate things. For example, here’s just one quick little sample. I have articles that I post on my blog, and a couple of years ago I started recording audio for those articles. So recording myself, reading the article in podcast format, and now people want me to do videos for it. So yes, I can hit record on a video camera of myself speaking the audio into the camera, But right away I’m thinking, okay, well, how can I script this? Like, yes, I know I could hand it off to a video editor like a person that would do the labor to stick it into Adobe Premiere or Final Cut Pro or something like that. There must be a way to script this. So now I’m looking into like ffmpeg and ImageMagick that how can I use the sentences in my database and have ImageMagick generate a bunch of JPEGs from them, use something called forced alignment to match up the existing sentences with my audio and then have ffmpeg turn those JPEGs into a script that matches the timing of my words. Exactly and then merges them in under my image. I think in terms of scripting, like I want to figure out how to automate things so that I can do them at scale and save myself or others hours of manual labor.
Jason
This makes sense because you emailed readers and asked like, “Would you prefer like an audio or video version of the book first?” I can’t remember, like animated or non-animated. Yeah.
Derek Sivers
Yeah. one big video with lots of little videos.
Jason
That’s what it was. Yes. And then the next thing I know it was maybe not even a week later. It’s like, all right, here’s the videos. And I’m like, “How did you turn that around so fast?” And now all the puzzle pieces are coming together? Yeah.
Derek Sivers
Yeah it’s all scripted. My ebooks are generated with Ruby. That’s Ruby taking the sentences out of my database using ERB to merge them with a latex template. Latex being this like print layout language and then merging them together, outputting a final latex file which is then sent to the printer or converted into an epub. No sorry. The epub is generated from the HTML which is generated from Ruby pulling the sentences out of the database and like yeah, so I script everything, so it’s unavoidable. I am a programmer.
Jason
I love it. A question that came to mind too while you talking about this. Especially when we got to the simplicity part and we didn’t talk about this beforehand. But I’m also curious to well, first off, you have kind of one database for everything. Is that what I’m hearing?
Derek Sivers
Yeah. The main reason to do that was the people table that I never wanted somebody to have to reintroduce themselves to me. I wanted one central store of knowledge for a person. So a guy named Joseph emails me and then Joseph later buys a book and Joseph later leaves a comment on my site. And then Joseph later decides that he wants to be known as Joey. Well, then I just want to change it in one place. And now he’s Joey everywhere. Joey moves from Saint Louis to Vienna. I change it once. There’s one central table called people and everything. All the other tables reference people. I used to actually have it split into different schemas. In PostgreSQL, you can take one central database and split it into many schemas. And so I had that complexity for a few years and the rewrite I did earlier this year that I was referencing was me simplifying that and put everything back into one single schema.
Jason
Before I even ask my question. I also want to say there’s a thing maybe on your website or it’s in the end of your books where you’re like, “Email me. I love responding to people.” And I always think, “How does he do that?” Again, it’s like, oh, you have context when people email you. That’s amazing. Yeah. It’s not like, “Oh, I feel like I know this person.” It’s like, “Oh no, here’s everything we’ve talked about before.” I love that.
Derek Sivers
And that was out of necessity for running CD Baby, where a musician would email us out of the blue and say like one sentence email, just saying, “Yo, my tracks are all messed up.” And we’d have to find that email address to pull up the client, which would pull up their albums, which would pull up the most recently ones and try to figure out what they might be talking about. So that was out of necessity. But then I just kept the same system for myself. So yeah, I get emails, which seem to be out of the blue from names that I don’t recognize off the top of my head. But actually it’s somebody who emailed me eight years ago when he bought my Wood Egg Guide to doing business in Vietnam, and now he’s emailing me again. It’s like, oh, I’ve got some context. Like, “Hey, good to hear from you again. What’s up? Not doing business in Vietnam anymore, huh?” So it’s all with context like that a lot.
Jason
That’s awesome. So the question I wanted to ask was we talked like, simple and easy to name one of the other Rich Hickey talks. We talked about how you use just three gems. How do you host all this? Where do you host it and how do you get the code there?
Derek Sivers
Haha I stopped using git this year. Constantly looking to simplify. I was like, “You know what? I don’t branch, I don’t merge. I don’t need it, rsync baby.” So yeah, just have a single OpenBSD $10 a month server host with Vultr.com. I just chose them because they had a way to instantly create an OpenBSD server from the ISO image. And a lot of other hosting companies didn’t do that. They make Linux easy but wanted to use OpenBSD. It’s my favorite operating system because of the simplicity again, so just host a OpenBSD server with PostgreSQL and Ruby and a mail server. That’s it. So it receives incoming mail directly. Don’t use a external mail service. I just have like my MX record for my sivers.org domain just points directly to my server, so incoming mails go directly there. My Ruby script imports them into the database and yeah, just use rsync. I actually use OpenBSD as my main desktop computer too. So do all my programming in OpenBSD. I’ll just do everything in OpenBSD and then just use rsync to put it up on the server.
Jason
That was my next question because when you mentioned OpenBSD, I was like, “Okay, well what do we use like as a daily driver?” I’m getting into the weeds here. I know, but-- no, I love it. It’s fun.
Derek Sivers
No I love it. It’s fun. I wrote about it. The URL is sive.rs/openbsd. I wrote about why I use and love the OpenBSD operating system, but just in short, I just find it to be the simplest solution. Again, not to knock on Rails because I’m friends with the people that wrote it and am in awe of the people that know it inside out. But to me, I don’t want the complexity of Rails. I’d rather have my little two gems, Sinatra and pkg and same thing with my operating system. I know that Macs can be beautiful and I know that the hardware can be beautiful, but the operating system is so damn complex. And same with Windows. And when I use OpenBSD it’s just like, “There we go, nice and simple.” Feel the same thing about Alpine Linux, maybe even arch Linux. So I’m a big fan of bicycle simplicity.
Chris
Do you ever feel like the simplicity comes with a “Oh, I need to do something, but now I have to build up sort of those things in order to do this complex thing?”
Derek Sivers
Yes, and that’s my intrinsic motivation because I want to learn that instead of just passing it off, if something doesn’t matter to me, like my car doesn’t matter to me that much. I’m not a car aficionado. I just use it to get where I need to go. I don’t care that much. And I know a lot of people are like that with programming that this stuff we’re talking about functions, they would just look at that like, don’t need to do that. Why would I do that? I just need to get this web app built. I’m just trying to get where I want to go, just trying to get this damn thing built. But sometimes you get into something like, I could imagine if I got really into cars, then I’d probably want to find an old 1962 car that I could bring into my driveway and like, get in there with a wrench and understand the whole thing. And so I think that’s what happened along the way with my operating system. In theory, I would like to understand it a little deeper, but occasionally just read man pages for commands. I’ve just never really read the man page to just try to understand my operating system better.
Derek Sivers
So then when you do need to make something that matters to you, like my books, for example, I could have just written the text to my book, handed it to a graphic designer that would put it into a big, giant, bloated Adobe program and send it to a printer. And I could have said, and that’s fine, but I care too much. Like, this is the thing I care about. Unlike my car, I care about the code that generates my books. So I took the many, many hours to learn latex and then spent many more hours learning how to generate latex from my database from each of these sentences and merging it together with ERB and all that stuff said. So it’s like, yes, it’s extra work, but hey, going back to the Rich talk, that’s simple versus easy. It can be hard to make something simple, but then you have the joy of like custom tailored clothing. It was harder to make a suit that fits you exactly and only you. But it’s so beautifully simple when you’ve got code that you wrote for exactly your need.
Chris
Yeah, I love that look at things and I think at the end of the day, what you produce shows that as well. It’s not something you grabbed off the shelf and threw it in Adobe apps and whatever. Throughout the entire process, you’re putting in thought into every little decision along the way, which is like something you wouldn’t have had to think about maybe using an Adobe app. But it’s like those details matter to you that matter to the end user. It’s things like being able to have your people table and effectively like your brain can never have all that knowledge there. So we just store it in the database and that’s extra memory for you. And now you can have the scaling up of yourself as a person where you can respond to an email after eight years and that person feels like they remember you and you do remember them because you’ve made yourself a system to go do that, which I think is really smart. I really like that approach because I feel like that’s probably the tendency these days to jump to the complex thing because it seems like it can do everything you want really fast until you notice that all of those edges and all these little details maybe don’t line up with your philosophy and you can’t actually use that to accomplish what you wanted in the first place.
Derek Sivers
I assume most of us who are listening to this read Hacker News occasionally and you’ll see this story posted there a lot, which is why has programming become so complicated used to be so easy? A little PHP script or a little bit of JavaScript? And now, oh my God, with Kubernetes, whatever the cloud and react and every time I read that, I think, you know, you don’t have to do that, like CGI bin still works. You could just put a dead simple little Ruby script in your CGI bin directory and it’ll work. Or you could just make a static HTML page. You don’t even need to generate it with Jekyll. You could just open bracket, exclamation point doctype html close bracket and just start writing save as file name, dot html and use or whatever to just upload it to the web root on a linux server like it actually is still dead simple, but to do that you have to get kind of philosophical. So I haven’t written this yet, but someday soon I’m going to write a post about why programming is or can be philosophical. A guy in India just emailed me asking, “What does it mean to be philosophical?” And the best answer off the top of my head was it’s to think of everything from scratch to kind of question everything, to not just do what most people do, but to ask yourself, “Why am I doing this? What do I really want? Do I really want that? Or do people tell me that I want that? What’s actually made me happiest in the past? What would make me happiest now? What do I really want now?” And to just take a few hours to ask yourself these questions, to question your behaviour.
Derek Sivers
And when you get the answers, then make your daily actions align with your honest answers for you, not for others, but for you. So I know that some people just get married because it’s the thing to do and then you have kids because it’s the thing to do. But there are some people who just say, “You know what, I just don’t really want to. I like being alone. I like not having kids. I like having complete freedom to change my mind at any time.” And to me, that’s being philosophical is to ask what’s right for you. But then on the other hand, there are some people, like even if they live in a place like, let’s say, Portland, Oregon, where it’s not cool to get rich, that you’ll be chided by your friends for trying to get rich. There are some people who say, “You know what, I really want to have a Ferrari and I really want to have a mansion with a swimming pool. That’s what I really want.” And how cool that those people can get philosophical and dig into themselves and find out that’s what they really want to do and then therefore they should act accordingly, which may be quite different from how everybody around them is acting. So I get philosophical about programming, and that’s what I loved about Rich Hickey’s simplicity matters talk at Railsconf two as I felt that was him getting philosophical about programming. Later in that same talk, he says, “Like many of these data structures we have where you have a class and a model and an object. All of that could be replaced with a simple hash.”
Derek Sivers
That’s it. You really just needed a hash. You didn’t need all that complexity. And that’s so cool to question these norms and break it down and say, “What do I really need?” So when you asked earlier about me ditching two years of Rails code and just rewriting it from scratch in PHP, that’s what I was doing. It’s like, okay, sorry, framework. Let’s remember who’s the boss here in trying to learn Rails. I was making Rails the boss and I was trying to be its star student. I was trying to learn the Rails way. Teach me o rails. But after a while. Just wait a minute. Hold on. What does my little website actually need? I really only need these five things. It just needs to do it. That’s it. I don’t need all this other complexity and it’s the same thing I think with all web apps these days and all my programming is, I look at all the complexity in the world and think, “Okay, well, Facebook needs that. But thank God I’m not Facebook, I’m just me.” I don’t even have a team. It’s just me. And I just need it to do these seven things. And so I just have just the minimum code necessary to do those seven things I need. There’s such a deep joy in that for me. Other people may not like that. Other people might feel badass at conquering Rails, but just get a deeper joy out of stripping it down to its bare essence.
Chris
I love that a lot because I think, I don’t know. You see a lot of junior developers looking for what language or framework do I learn to get a job? And it’s like, well, there’s a lot of questions you’ve skipped and went straight to that. And I’d love for you to slow down and think about these things because, you know, little things make such a big difference. Earlier you were talking about having functions in Postgres, and I’m thinking like, okay, what about versioning these things? What if something changes and you need to update something like that or whatever? And it’s like with the very few dependencies, you’re relying on very little of other people’s code that can change at any time. And then you are now responsible to fix your things, to make it work with their changes and their decisions, and they may decide to take it in a direction that you can’t use or don’t want to use or whatever. And so like the less dependencies on other things, I think probably has made it easier for you to maintain all this stuff for yourself over time. Yeah, less things to break. Yeah, but it feels like there hasn’t been enough talk about the philosophy of programming for a while because React got popular and then it was like, how do we build everything to do it the Facebook way or Google way or whatever? And it’s like, what about the little individual programmer that is building stuff for themselves? Like you take on those burdens and now you are at Facebook’s will to change, react every week when they want, and now you have to keep up with that. And that’s a second job trying to build the thing you’re trying to do in the first place. Now you’re distracted. So it just got me thinking about a lot of the maybe it’s a cultural change or something over time now is the frameworks and languages get bigger and bigger and there’s more programmers or whatever, but I feel like things have changed.
Derek Sivers
So glad you brought that up. It’s important to remember historically that the reason that Rails caught on like wildfire in 2004 is because at the time the only existing web frameworks were Java based things that were huge and complex and just daunting, overwhelming. And people were like, “Oh my God, this is so complicated.” And then David comes out with Rails and it’s like, “Look how easy it can be. Simple as that.” And people went, “Oh my God, thank you so much, better.” And instantly everybody dumped the Java frameworks and switched over to Rails right away. I think we are at that point again where things have become so damn complex that it’s ripe for somebody to come along and make a much simpler. Back to basics solution.
Jason
I think we’re kind of close to time, but had one more question I’m selfishly curious of. So a lot of your history is as a musician as well, and I’m curious if you’ve ever had the opportunity to intersect programming and music.
Derek Sivers
Oh, not yet. God, I just barely last week was looking at some tool and like Common Lisp to like generate music and waveforms and such from Common Lisp and then like generate arrangements for things like having--. So this idea of like computers generating music is fascinating. I’m kind of scared to go down that rabbit hole I think I would need to like finish writing books first before I could open up that can of snakes. But in short, no. I got into programming just as I was getting out of making music.
Jason
I see my high school years, my college years, all in on music like that was going to be my thing. And then I found programming and it was like, all right music, you were fun. And so now, like, I’ve gotten back into music and I keep trying to find ways to cross the two over. And I haven’t found something interesting enough to do it. So I was just curious about that and I lied. I have one more question. We were talking a lot about simplicity, and this is such a nerd question. You don’t have to answer this, but what payment processor do you use? Because I can’t find them. It’s simple. They’re all complex.
Derek Sivers
Stripe in short, because Patrick Collison and I had lunch in Singapore and I think he’s a nice guy and when I have trouble I can email him directly. So rules for life.
Jason
I still think Stripe is the best. The payment industry as a whole has changed a lot.
Derek Sivers
Yeah. I understand that. It’s like kind of like we wonder why politicians act so stupid. And then you can imagine, okay, look, if you’re actually running a country, it’s way more complicated than it seems from the outside. From what I understand, payment processing is so much harder than it seems because of all the fraud that you would think it would just be dead easy. Just charge the damn card and pay me. But apparently all this complexity is because of the fraud. But still, one of you asked the question. But if I’m using a really simple operating system and then I need to do something it doesn’t do, where I thought you were going to go with that is I very often just say no to the things that my OpenBSD operating system can’t do. And I like that. I like that it doesn’t run any proprietary software. I like that I can’t watch Netflix on OpenBSD. I embrace those limitations. If OpenBSD can’t do it, then I’m not going to do it. I’m choosing to simplify my life that way. So I do wish that there were more businesses that would choose the voluntary simplicity of saying things like, “You know what? Use our simple API if you just want to charge transactional credit cards. No, we won’t do subscriptions, we won’t do memberships, we won’t do all these other things. And no, we’re not a bank. We’re not going to give you loans. But if you just want to charge a card, here’s a simple API to do it. And that’s all we do and we’re okay with that.” Guess these are more like lifestyle businesses that might exist somewhere, but we don’t hear of them.
Jason
I know that was like off the cuff and random, but like it’s just while I’ve got you here and we’re talking tech. I mean, you take money. We all work with money every day at work. So, Derek, is there anything technology wise, programming wise that we didn’t cover that you would love to chat about before we wrap up?
Derek Sivers
No, I think my little two takeaways are if it’s the end of this talk, please, everybody go watch Rich Hickey’s 2012 talk on YouTube called “Simplicity Matters” for the 2012 Railsconf and every programmer listening to this, please send me an email. I love talking tech. As you can tell, I’m like bursting to talk tech stuff. I get so happy when I get an email with the subject in my inbox that has anything to do with a programming language or an operating system or something like that. I’m like, “Oh good, I can talk tech for once.” So please, anybody listening to this, go to sive.rs my website and there’s a contact link with my email address there and just send me an email and say hello.
Jason
Well, this recording has been a blast and cannot thank you enough for coming on and talking Tech and Ruby with us and letting me ask absurd questions that no one should ask.
Chris
Thank you so much for being on. We like highly respect everything you’re doing and believe in your database. A while back and I sent you an email or I intended to send you an email. I’m pretty sure I did. But reading your blog post and everything was like an inspiration to see like, “Oh, you know what? You can go start your own business and sell things and you don’t have to do it the way that everybody else does or whatever”. Like you set your own path and stuff. And so you were just a huge inspiration for me. And I just want to say thanks.
Derek Sivers
Thank you. That means a lot.