070 JSJ Book Club: JavaScript Allongé with Reginald Braithwaite

Download MP3



02:08 - Reg Braithwaite Introduction


Special Offer!

JSJABBERROCKS will give $5 off JavaScript Allongé by Reginald Braithwaite on Friday, August 9th through Sunday, August 11th 2013 ONLY!

Next Week

JavaScript Strategies at Microsoft with Scott Hanselman


MERRICK:  Turns out my habit is Joe coming over to my desk and saying, [singing] “Da-na-na-na, jabber time!” [Laughter] AJ:  Nice. REG:   That behavior is always acceptable if you are dressed for the part. [Laughter] CHUCK:  Since this is pure audio, you don’t even have to be dressed. JOE:   I have a pair of parachute pants. MERRICK:  I actually record most of this show while I'm in the bathtub.[Hosting and bandwidth provided by the Blue Box Group. Check them out at BlueBox.net.]  [This episode is sponsored by Component One, makers of Wijmo. If you need stunning UI elements or awesome graphs and charts, then go to Wijmo.com and check them out.]  [This podcast is sponsored by JetBrains, makers of WebStorm. Whether you’re working with Node.js or building the front end of your web application, WebStorm is the tool for you. It has great code quality and code exploration tools and works with HTML5, Node, TypeScript, CoffeeScript, Harmony, LESS, Sass, Jade, JSLint, JSHint, and the Google Closure compiler. Check it out at JetBrains.com/WebStorm.] CHUCK**Hey everybody and welcome to Episode 70 the JavaScript Jabber show. This week on our panel we have Jamison Dance. JAMISON:  Hello friends. CHUCK:  Joe Eames. JOE:  Hey there. CHUCK:  AJ O’Neal. AJ:  Still coming at you almost live from San Francisco. CHUCK:  Merrick Christensen. MERRICK:  What’s up guys? CHUCK:  There we go. I’m Charles Max Wood from DevChat.TV. And we have a special guest, and that is Reg Braithwaite. REG:  Pleased to be here with you. MERRICK:  That was a real voice if I’ve ever heard one. JOE:  Yeah. Awesome. CHUCK:  No kidding. We should have you do some voice overs for us. MERRICK:  We should. CHUCK: **You’re listening to JavaScript Jabber. [Chuckles]**AJ: **Say, “In a world…” [Chuckles]**REG:  In a world… CHUCK: **Anyway… [Laughter]**AJ:  Derailed, derailed. CHUCK:  Yeah, totally. Reg, since you’re new to the show, do you want to introduce your self briefly? REG:  Certainly. I’m a 51-year-old programmer. I got started the old-fashioned way, by stealing computer time from the university. I’ve been in love with writing software ever since I first laid hands on punch cards and saw that you could put them in a machine and then have this massive fanfold paper come out with stuff printed on it. What can I say? I think it’s the most thrilling occupation to have and I consider myself very lucky to do what I love and love what I do. I like hanging around and talking to other people who feel the same way which is why I’m here. JAMISON: **So we should also say that you just recently got hired on by GitHub. You’ve moved on to the programmer Valhalla or at least it’s like the glorious afterlife. [Chuckles]**REG: **I don’t know what to tell you about that. I’m beginning to suspect that they hired me because they saw that one of my hobbies is rock climbing and they figured I could handle the steep learning curve. [Laughter]**JOE:  Nice. REG: **It’s a pretty special place, but this is my second week, so if someone would ask me a question, “What’s it like at GitHub?” The honest truth is I don’t know yet. I’m still just with my face stuck in the fire hose. [Chuckles]CHUCK:  Nice. I’ve talked to several people over there and it really does sound like a terrific company to work for. Anyway, so you wrote this ‘avaScript is it Allonge? REG:  That’s my understanding of the pronunciation, yeah. CHUCK:  I have to say, when I picked up the book, I was breezing through it. It’s so funny because I start reading a book and I get excited when I can just easy read, blow through it. Then I hit some of the code examples and some of the combinators and I actually had to stop and puzzle my way through some of them. It was both a pleasure and a challenge to read. REG:  Well, what I was aiming for, I realize that some of the programming style in the book is unfamiliar compared to the way most books are written. But when I thought about it, of all the things I could write about, I really, really wanted to try to bring something new to the table. Not necessarily more advanced or better than what other books are doing. I didn’t set out to write a book that’s better than any book you could buy. But it did seem to me that if one is to write a book, that one should at least give a new perspective so that other people when reading it could say, “Oh okay, that’s a different way to think of this. I already knew that, but oh I see a new perspective or a new angle,” or maybe introduce them to something new that was in the previous book but didn’t get highlighted or didn’t stick when they were reading it. I take full responsibility for that unfamiliarity. I wasn’t trying to be too gratuitous, but I did try to approach some of the bedrock material of JavaScript programming from a relatively new place. MERRICK:  That’s a really awesome perspective to go writing a book. AJ:  Yeah. REG:  Well, compare and contrast, if we were to pick up some language that is just picking up steam now rust or go, there’s a lot of value in just playing it straight and saying, “This is the language and these are the standard idioms,” and so on, because people are hungry for that. But given that ‘JavaScript: The Good Parts’ has been around for so long, given that there are so many already existing excellent books out on the subject, what is the value of a new one other than calling it headfirst something or for dummies or for idiots and just sticking a funny picture on the cover? I didn’t want to do that. JAMISON:  This definitely isn’t teach yourself JavaScript in 25 hours or something like that. I counted and you went 110 pages into the book before what you defined what this is in JavaScript, even though you use it before then. It’s a really interesting style. You said in the beginning, this is written for people that probably already know some stuff about JavaScript. But still, it was like this tension that you kept showing this stuff. I don’t know. It made for an interesting reading experience, I thought. CHUCK:  By the same token, that was part of what caused me to level up when I was dealing with some of the stop-and-understand stuff, which was really cool. JAMISON:  You talk about the Y Combinator on page 90-something. It’s really interesting because if you search the internet you’ll find hundreds of Y Combinator blog posts and tutorials and stuff. It’s like the monad blog post of JavaScript. But you deliberately don’t do that. You just throw people in the deep end and you say here is the code, you should figure out what this does and how this works. Can you talk through your reasons for doing it like that? REG:  That’s a really great question, I’ll say right away. I had been trying to introduce and really emphasize the idea of functions as first-class entities. Most people bring that idea forward when talking about JavaScript and say a function can return a function or take a function as a parameter. Then you typically toss out a few really obvious, simple examples. Then you move on to writing a bunch of object-oriented programming that would be completely familiar to a Java programmer or a C programmer. I really wanted, in this book, to really run with that idea. That’s why there are a lot of combinators in there, functions that take other functions as parameters and return modified versions of those functions. After having done a fair bit of that, I did want to introduce the Y Combinator. I really felt, speaking before, that this has been discussed. It is, as you say, I’m not quite sure how to put it, almost an idol that one mounts in one’s house, “Look, the Y Combinator,” and prays to it. It does have a very few practical applications. But the most valuable part of it is usually working out how it works. Given that people had written about that and that you can easily Google and find lots of explanations of how it works, because it’s a celebrated pattern, I felt like I was not able to bring something really enlightened and new to it without writing practically  a whole book about it. I had already written a Ruby book, well a collection of blog posts. There was a series of blog posts that I later crafted into a book, which was all about combinators, and I introduced a bunch of recursive combinators that had nothing to do with the Y Combinator. There, for my own personal reasons, I didn’t want this time to repeat myself and start talking about a lot of recursive combinators. Here I am, I don’t want to repeat what other people have written and I don’t really want to repeat in JavaScript what I’ve already said in Ruby. It occurred to me, “Hey, maybe this is something I can put there and pick a place in the book where people have been introduced to it enough that they can work it out for themselves and just try things.” That’s what I did and so far I would say I’d maybe give myself a C- or D+ for that decision. JAMISON: [Laughter] What do you mean? Have you gotten complaints about it or something?**REG:  No, but people have definitely mentioned, “Okay, so when would I use this?” or, “Okay. It was hard for me to figure out how it worked.” I don’t think anyone’s ever come to me and say, “Thank you for tossing it in there. It was a huge enlightening moment when I figured out how it worked.” JAMISON:  I think it’s pretty brilliant, because people learn best by doing. I can read all these blog posts and convince myself I understand without having any clue what it actually means. So it was helpful for me. REG:  I’m very glad to hear that. AJ:  I just want to chime in that I like it as well. I think it’s a really good approach. Immediately, as I started reading through it, I thought to myself, “There’s probably a lot of people that won’t find this approach as useful. It’s not what they’re familiar with.” But for me, I just have more of a pattern mindset and I think that’s what you’ve got going on here, is you’re showing here’s a pattern, here’s a pattern, here’s a pattern. Now use your own brain to do the algebra that takes the common elements and puts them together. To me, it’s more that style of learning. It feels algebraic to me. REG:  Well, thank you. I take that as a compliment. I really try to avoid being didactic, lecturing people. I know when creating products and so on, that it’s a mistake to only write for yourself, and I don’t do that. I don’t imagine myself as being the reader. But I do imagine that the person I am writing for is at least as intelligent as I am. They may have a different amount of, they’re a different kind of experience, but I shouldn’t assume that they have less experience than I have, just maybe in different areas. It’s true that most programmers reading my book probably aren’t 51, but I essentially try to respect the people who read my blog posts or my books, or for that matter, respect my colleagues. I try to give them at least as much respect as I have for myself. That means that sometimes I’m not going to be too pedantic, or if I am it’s for a reason. A lot of people skimmed over the first bit because I really started with ultra-basics, but I was trying to start with basics the way one might write a proof in mathematics, in a respectful way. Given this, given this, given this, this follows. As opposed to, listen you dummy, this is how this works, this is how this works. I don’t know if it felt what way for you, but that’s what I was trying for. AJ:  No, I totally got that. That is exactly how it felt to me. It actually is very reminiscent of an article that I wrote and the way that I approached it. This resonated with me because it matches my learning style. CHUCK: The other thing is that most of the guys on this show do Ruby or do JavaScript most of the time and I spend most of my time [exploring] RubyJOE:  Wrong show, Chuck. MERRICK:  Wrong show, Chuck. CHUCK:  No, I got my brain backward. Anyway, it’s interesting, coming at it from somebody who isn’t in the thick of JavaScript every day and dealing with these things on this level. That approach, it helped cement a lot of those basics, because I don’t deal with them every day, but it was another approach to seeing it. Especially, one thing that stuck out to me was the way that you showed the nested environments, which is something that you pick up in closures. That really, really helped just showing it as an object or a hash or a dictionary, or whatever you want to call it, and saying, “Look. It looks in here and then it goes up to the next level’s environment and looks there.” It gave me this visual context for it that helped me understand a little bit better. REG:  Oh, that’s really great feedback. I have heard a few people say similar things, that this area, closures, environments and so on, is an area that people muddle along and figure out how it works, but for whatever reason that hasn’t always been very well explained perhaps or hasn’t always been a focus of people’s writing. MERRICK:  I want to take a little bit of a step back. Could you give us summaries for our listeners of what the book is about? REG:  Absolutely. The book is an attempt to introduce JavaScript the language from the perspective of programming with functions. I don’t mean functional programming. Not only is that term a little vague, but I’m not attempting to preach a particular style of programming. But the perspective of the book is that the core thing in JavaScript is the function. It’s at the center of everything. Every language has something that’s the center of everything. Objects are the center of Java. A friend of mine who’s an extremely experienced programmer once said his aha moment in C came when he realized that pointers, rather than integers, were the core thing in C. My perspective is that functions are the core thing in JavaScript. Everything is about functions, whether it’s creating objects with what is a class-like thing in JavaScript with this prototype chain and so on, or whether it’s combinators, or whether it’s simply calling functions. Methods, everything’s a function. I thought I wanted to write a book where the function is the thing we spend the most time talking about. When we’re not talking about the function, it’s there in the room casting a shadow on what we’re talking about, so that when coming away from the book you’ll have a really strong feel for working with functions in JavaScript and all of the things, all of the possibilities that arise from the functional nature of JavaScript the language. JOE:  I really love this approach because I came from another language. I didn’t start programming through JavaScript. The language that I came from was a very object-oriented language. Really, I have this innate fear of functions and that still lingers to some degree, because this wasn’t my formative language. Having the topic of JavaScript being that the central object in JavaScript is a function really does help set up your mind for what JavaScript is. I totally agree with you, this approach that functions are central to JavaScript is absolutely right. This book really helped me to cement a lot of the things that I’ve slowly been migrating my brain around JavaScript is not C#, is not Java, it’s something else. I really like that. I definitely feel like it helped me take the next step up, or like Chuck said, level up. REG:  Oh, I’m very flattered. There’s a book I respect enormously. May I mention it? JOE:  Of course. CHUCK:  Yeah, sure. REG:  Feynman’s QED, which is Quantum Electrodynamics. I believe the book is called ‘QED: The Strange Theory of Light and Matter’. This was taken from four lectures he did in the late 50’s or early 60’s, I apologize for not having done more research on the subject. But the book has four chapters, one for each lecture. The entire topic of the book is to explain how light reflects off a mirror. That’s all the book explains. What Feynman did in these lectures which became a book was he sat down to explain how light reflects off a mirror without any hand waving or abstractions. To do that, as he goes along, he attempts to explain how the various abstractions and so on are wrong. For example, everyone is taught, I shouldn’t say everyone, I was certainly taught and this seems to be the prevalent idea, that the angle of incidence equals the angle of reflection, or that if you fire a beam of light at the center of a mirror it strikes the mirror in a little dot and then reflects off the dot. Feynman in his book explains that in actual fact, light hitting a mirror bounces off at all angles and that light hitting a mirror, what we think is a little spot, in fact touches the entire mirror and on and on and on. He says, “Okay, forget all of these various rules of thumb and so on that are very useful in our practical world. Let’s talk about what’s actually happening,” then he dives under the hood and explains it. The only thing he really hand-waves over is the complicated math that would turn that one book into 20 volumes. But in terms of the mechanism, he explains what is actually going on. I don’t think that this book is nearly as good as QED, but QED definitely influenced me when I wrote this book in that I wanted to try to explain what’s actually going on and not wave my hand, and not say, “This is a class,” when it isn’t but to say, “This is a class-like thing.” I think perhaps the JavaScript engine doesn’t necessarily use hashes and lookup tables exactly the way I explained it, but I really did try to take this approach of saying, “Let’s just start with the basics,” and just explain what I believe to be the absolute truth of what’s going on and not take any shortcuts that could be very useful rules of thumb for practical programming. But for the purpose of understanding, let’s try to talk about the real thing so that we really understand what’s going on and that later when we think about abstractions and when we use words like superclass and so on, that in the back of our mind we know that we’re using convenient shorthand but that we still understand what our shorthand stands for if we need to. JOE:  I love that description and that story. For one thing, I definitely idolize Feynman because he’s very well recognized as one of the few people that were able to explain really complex subjects to people, just an amazing teacher. So your goal of approaching the subject matter the way he is and following his ideas for teaching things to people, I really agree with. Lots of times, and I find myself doing this all the time, I try to digest something down into something simple and relatable and we probably do a disservice most often to our audience when we do that because they are capable of understanding something complex if we are capable of explaining it correctly. In fact, your chapter, I don’t know if it’s a chapter or subsection, titled ‘Prototypes are not difficult to understand but the descriptions of them are’, something to that effect, right? REG: **Absolutely. That was what I was aiming for. But I’m not nearly as amusing as Feynman was. [Chuckles]JAMISON:  I don’t think there are many people that could come close in lots of ways. I want to talk about one other part, which are the footnotes and just the kind of asides that you make in the book. Lots of them are in footnotes. Some of them are just in the course of the writing. But there’s just such a depth of general knowledge about computation interspersed in here that was really, it was a great read partially because I was going to look up stuff that I’d heard of and never really understood or things I’d never even heard of. When you explained about the fluent combinatory, I had seen that idea of chaining. It’s the idea of operations return the object that they operate on. In jQuery, you can chain operations because they all return this. You show a little way to wrap getters and setters in a combinatory that will do that for you. But you just casually link to this outside resource that explained it in detail and where it came from and the history of it and stuff. I feel like I learned a lot about JavaScript, but also a lot about just general computation from the book. Was that an explicit goal or was that just because you’ve been programming for a long time so this stuff flows out of your brain? REG:  Whoa. Okay, you got me on that one. JAMISON: [Laughter]**REG:  I think the truth of the matter is that I do write for readers but I also write for myself. In writing, I’ll start talking about something and then I’ll pause and realize I don’t know it near as well as I think I should and I’ll look it up and read it and go back and revise it and so on. Along the way, when writing, I’m learning things. I make notes of things like links to articles I’ve read and so on. That’s part of it. Part of it is that a book in some ways is a very, a pdf book or a printed book, is in some ways a fantastic medium for learning but it does have this limitation that it isn’t hypertext. You can’t just click on something. The footnote is the closest we’ve come to being able to provide more depth of information. I embrace footnotes. I try not to be academic and just footnote something because it’s intellectual, no, intellectual dishonesty is not the correct expression, but it’s plagiaristic to quote something or an idea without giving credit. That’s not really where I’m coming from. I’m trying to provide more information for people who are interested. If I may mention another book, actually a whole series, an incredibly long series, there’s an author called George MacDonald Fraser. He wrote a book called ‘Flashman’ and it became a semi-fictional book. I’ll explain. It became a hit and he ended up writing a whole series of books. There’s a book called ‘Tom Brown’s School Days’ which was a big hit and George MacDonald Fraser took a minor character named Harry Flashman out of this very famous old book and then proceeded to write from the minor character’s point of view. But George MacDonald Fraser had a background as a historian and as you read the book Flashman or any of the various sequels, there’s lots and lots of endnotes that appear. I can’t remember if they appear at the end of the book or the end of each chapter. They’re not on the page itself usually, but they’re usually at the end, which have incredibly detailed things. For example, the Flashman, he’s allegedly writing his memoirs will say, “Well it was a nice sunny day in April and we went downtown and there’s a parade being held for the Duke of Rochester or something,” then there’ll be a footnote and George MacDonald will say, “Mr. Flashman appears to be in error. The Duke of Rochester did in fact get married and there was a parade in his honor, but it was March of that year,” and so on. There are just tons and tons of these little asides that added tremendous amount of verisimilitude to reading a fictional book about a character. I really enjoyed having two brains, one that’s reading the narrative and the other that’s looking up these footnotes either after the fact or as I go along. I tried to borrow that style for my technical books to have, whether it be a link, could be as simple as a link and you’ll follow it or as much as, I think there are a couple of places where I use a couple of paragraphs to describe an idea. JOE:  Wow. That’s really interesting. That’s crazy. I also noticed that that guy wrote the screenplay to a James Bond film. REG:  Octopussy, I think. JOE:  Yeah. That’s a cool style. It was a very enjoyable style to have those footnotes. I found a lot of very interesting things, especially the greenspun link. REG:  Oh, yes. JOE:  I really enjoyed reading about that one. REG: **Greenspunning is a theme that comes up over and over again. As a matter of fact, I wrote a blog post this morning discussing greenspunning. [Laughter]**MERRICK:  Oh, cool. REG:  It’s something I return to regularly. CHUCK:  Where can people get to your blog? Now that you mention it. REG:  RaganWald.com CHUCK:  Speaking of online presence, one of the things that I really enjoyed about the book was the website, the allong.es or whatever it is. It’s allong.es. There were a couple of things that really struck me with this. You don’t see this with a lot of books, even with programming books, which is something I find interesting. But you could actually go and install the allong.es through npm. You could go look at them on GitHub. You could actually try them in the browser, which I thought was really awesome. I’m just wondering. Does this fit into your overall goal with the book as far as helping people understand these topics and principles related to JavaScript? REG: **I was hoping so. I don’t know whether it works or not. So there is an allong.es library which contains the various combinators and tools described in the book. I definitely was not trying to create a library that competes with Underscore or Lo-Dash or any of these other existing deservedly popular JavaScript libraries. But I did want to relieve readers of the trouble of copying and pasting from the book into their own code if the wanted to experiment with these ideas. As such, it seems sensible to put them up where you could install them with npm or as you say, play with them in the browser. Playing with them in the browser, I definitely stole that idea from, I shouldn’t say definitely because my mind is highly imperfect, I believe that I stole the idea from Michael Fogus who has a great book out on functional programming in JavaScript with Underscore. I think his site has, not necessarily a site for the book, but he has a library and I think he has some executable code samples. I liked that idea and I just took the code for the ace editor in JavaScript and it seemed to work. People gave me some nice feedback about being able to play with things, so it seemed like a good idea. People of Spain don’t mind my having libraries that end in .es, so allong.es it was. [Chuckles]**REG:  I find that programming, we create value out bits. As a result, the bad news is it’s very hard to enforce scarcity. That’s why there are all these lawyers running around with patents and so on because it’s very easy to copy things, as you know. But the good news is that because scarcity can’t be enforced, it’s very easy to create a positive-sum game as opposed to a tragedy of the commons where by sharing information other people do things that you then use. A rising tide lifts all boats. Without getting overly philosophical, what do I know about economics? But there are an awful lot of poor people in the world. If a bunch of them have the capability to become programmers and they do, it’s really easy to say, “Oh, they’ll take our jobs.” But the other possibility is they’ll make money and become our customers. Everybody’s standard of living will rise the more people there are being productive. I believe that’s true at almost every scale, whether we’re talking about bringing another billion people online with things like Firefox OS and cheap phones, being able to have really inexpensive smartphones, or whether we’re simply talking about there’s a new junior colleague in your work, or joining your monthly meet-up and people take time to coach them and make them a better programmer. I believe it’s not even the long view but the medium-term view is that that creates more value for all of us. If I could afford to give everything away, I would. I do, basically. ‘JavaScript Allongé’, I haven’t put online for free yet. I did with the previous book, ‘CoffeeScript Ristretto’ and another previous book, ‘Kestrels, Quirky Birds, and Hopeless Egocentricity’, my Ruby book. One day, ‘JavaScript Allongé’ will be free online as well. I believe in the long-term that everybody, including myself, win when we have more information and more knowledge and more learning to share with each other. JOE:  That’s a fantastic statement and belief. I love hearing that and hearing more people tout that same thing. REG:  I think history proves it to be true. Although the top 1% seems to be trying to reverse it, history in North America has shown that the greatest prosperity came with the growth of a functioning middle class who accumulated some modest, compared to rich people’s, wealth for themselves and security and in turn created a vast consumer class that propelled our shared economies. I don’t think that there’s anything different with knowledge economies based and programming and so on and based on having 3D printers at home than there was when people were taking steel and turning them into automobiles. I think that it seems obvious to me, simple and obvious to me, that the more intellectual wealth is distributed, the better everyone will be. JS Jabber obviously buys into that. CHUCK:  Yeah, we love sharing. REG: **Yeah. That’s why you’re here. That’s why I’m here. I don’t know. I really can’t see one day laying on my deathbed croaking my ancient finger at my grandchildren to come closer so they can hear me rasp, “Don’t make my mistake. Don’t share what you know.” [Laughter]**REG:  It’s just not going to happen. CHUCK:  I wanted to ask about the coffee metaphors that you use, or at least the theme that you have with your different, ‘CoffeeScript Ristretto’ and ‘JavaScript Allongé’. Was that just something that you did for fun or was there a reason behind it? REG:  It’s not an overarching theme, or should the word be overarching? I’m not quite sure how that word is pronounced. What happened was I wanted to write ‘JavaScript Allongé’. I didn’t have a title for it, but I wanted to write this book about JavaScript and I felt like I wanted to do a good job. One way to do a good job is to practice it, to take a practice run. In fact, ‘CoffeeScript Ristretto’ was written as a way of learning how to write ‘JavaScript Allongé’. That’s exactly how it happened. It’s a little bit lower risk, smaller market. If everyone decided I was a complete idiot, well I’ve turned off a couple thousand CoffeeScript programmers but nobody need tell the hundreds of thousands of JavaScript programmers. That was a trial run. I chose the word ristretto, I hadn’t figured out allongé, but I chose the word, ristretto is how I normally order. I usually say short. I don’t usually say ristretto. But that is the more compact and dense version of espresso. I felt that that really suited CoffeeScript, because it is more compact syntactically and because I was trying in that book to be brief. I had in mind, I was a little bit inspired by ‘The Little Schemer’, ‘The Little LISPer’, which has gone on to Realm of Racket. If I could have, I would have written it as briefly as the authors of ‘the little schemer’ have written about Scheme. I’m not as talented as they are but I was definitely trying to keep it short and really crisp. That book went reasonably well. I actually would have given that away if I could have but I did, to be perfectly candid, I did feel like I wanted to validate that it was worth somebody’s time. If something doesn’t cost money, you can’t really count downloads. Everyone will download it and maybe read it, maybe not. But if people have to pay for it, then A they’ll call you up and yell at you if you did a lousy job, and B they’ll think twice if it doesn’t appear attractive to them, and C they’ll probably read it if they paid for it, or at least it’s a higher possibility. I did want to have some nontrivial monetary cost associated with it that would validate for me that I was writing it while getting the right feedback. It was, I think by most book standards, unsuccessful, but I was very happy with the result which is okay for me. I’m really a niche author. Then when I sat down to write the JavaScript book, for some reason, allongé popped into my head because it’s the opposite. It’s more watery and to me it doesn’t taste nearly as nice but it’s still great. JavaScript syntactically is longer and wordier than CoffeeScript and in some ways a little bit annoying, but fundamentally the semantics, the thing that make it really good are still there. That name came to me for the JavaScript book. MERRICK:  That makes sense. AJ:  Yeah. CHUCK:  I also want to point out that I was a missionary in Italy for two years, so all the pictures of all the coffee shops and stuff. I don’t drink coffee, but we would go in there and get hot chocolates or sodas or whatever and just the smell and the visual, it brought back some memories for me. REG: **Well you know how people often make canonical jokes about the difference between the demo of a product and the actual shipping product? Coffee is really the most iconic. I’m not going to say the best drink for programmers, but the most iconic drink for programmers because I recall reading an essay about coffee by a food columnist and he said the entire history of mankind’s relationship with coffee is a futile attempt to make it taste as good as it smells. [Laughter]**CHUCK:  That’s funny. AJ: **I [hear] that.**REG:  I’ve got to say, that reminds me of an awful lot of software and software marketing. CHUCK: **Yes. [Laughter]**JOE:  That’s fantastic. I would like to ask a question about what are some of your favorite parts of the book? Some of the things that you were really pleased with or you thought, “Oh this is something that other people are really going to like,” or anything like that. REG:  Well, I’ll give you two. There’s one that I hoped I think maybe would be the most valuable. I hoped this would be the case when I wrote it and the feedback so far seems to back it up. A lot of people have told me they really like the explanation I give about how prototypes work, about objects, about how you can do encapsulation with closures as well as how you can do inheritance with prototypes and so on. This has been explained over and over again but I don’t think my explanation on its own is any better than anybody else’s. But I think the way I wrote it and in the context of what you’ve read by the time you get there seem to resonate with people so that it sticks and people say, “Yes, okay. I’ve read this before but now it makes sense.” That’s something I hoped for. I hoped that holding off on all the object stuff until later would pay off in the sense that people would say, “Oh yeah, I totally get that because of the work with functions.” That’s one. The other, you mentioned, the combinators. I think my own personal favorite, the part that was the most fun to write, were some of the early combinators, things like the fluent, some of the stuff to do with partial application, mapWith, getWith, pluckWith, those sorts of things. It really felt fun. This is probably a massively egotistical and hideous thing to say, but when I see people who are really good at soccer they do this thing where they can bump the ball up, catch it on the back of their head, bounce it off their knees, catch it in the instep of their foot, and so on. When I was writing these things, it was like, “Wow. Look at all the things you can do with a soccer ball, or at least with these JavaScript ideas.” It felt like I was kicking a ball around and, “Wow, this is fun,” thinking about these things. That part was fun to write. I think there are a lot of practical things you can walk away and use and I have used. But I hope that people don’t just feel like, “Oh okay. That’s a good trick to use,” but that people say, “Wow. This is fun thinking about, working it out in my mind. It’s pleasant. It’s a good feeling.” I hope people have that, from that section. JOE:  Absolutely. That’s a great analogy too. I definitely felt that same kind of feeling reading the book. There was like, “Oh wow. I’m seeing things that JavaScript can do that wasn’t necessarily that I didn’t think it could do, but I just never thought to put them together and say, oh I’ll be throwing these things together like this. That’s very interesting. And stuff that I’d never seen anybody put together in those ways before.” REG:  Oh, thank you. I take that as a very high compliment. It’s hard because at the same time as it’s fun to do all these things with a soccer ball, the fact of the matter is in the game, you’re trying to put the ball in the net. As much as I love programming and so on, for its own sake it’s not just a recreational pastime. Being effective in a work environment, organizational environment, open source environment, it’s not just a question of make more money or further your career, but you’re actually creating things that make people’s lives better either directly or indirectly. I wanted to have, I don’t know if I succeeded, but I was trying for a balance where someone would come away from the book and say, “Wow, there is a bunch of stuff there that was fun to read. It was interesting. A couple of things made me work hard.” My hope is that people walk away from it and say, “I think I’m going to be more effective now, even if I’m not using every exact trick exactly the way he wrote it. But I will use some. I can think of a few places to use this one and this one and this one and this one. These other ones maybe not so much but having read them and thought them through makes me understand things better, so that’s a win.” If people are walking away with that feeling, I’d be very satisfied. CHUCK:  What was the part that you agonized over the most while you were writing it? REG: **I think the beginning. I wrote and rewrote the beginning many times. It felt to me like there was this, Gordian knot isn’t the right expression, but it felt to me like there was a [scene] or a braid of all these ideas that are interconnected and they form a big loop so that if you grab one and pull on it and follow it, you end up going to another thing and another thing and another thing and you’re back where you started. I actually found it hard to start anywhere, because every single thing I thought about starting with and I’d start talking about this, it’d be like, “Oh, but we need to talk about this first. That really is built on this.” I didn’t have a really strong sense of, “Everything follows from this, so that’s the best place to start. And then after you’ve done this thing A, B naturally follows and then C.” It didn’t really feel that way to me. I went over and over it. In the end I just thought to myself, “Okay, let’s pick someplace where not talking about the things that impact that will be the least detrimental. Then we’ll talk about them as soon as possible.” But I still to this day feel like I see it more as being all connected rather than some pyramid with these brilliant ideas at the top and these mundane ideas at the bottom. It’s going to sound like I burn incense and do yoga all day. [Laughter]**REG: **But I really do feel that way. I really do feel like there’s not so much that there are these advanced ideas and these basic building blocks, but that there’s an interconnection between the various pieces that make up JavaScript and that they’re really more equal ideas that are put together in different ways. It’s all quirks or something along that line. It’s a little mystical. [Laughter]**REG:  But those are my sincere feelings. That being said, I don’t preach. I’m perfectly content if somebody picks up the book and says, “Dude, I just want to write a cool game because I’m about games.” All the better. I like games too. You don’t need to have the same feelings I do about the language. If you’re writing a great game, do it. Let me help you write a great game so I can play it. JOE:  Yeah, absolutely. CHUCK:  One other question I have for you. On Ruby Rogues, Josh Susser keeps pointing out how old he is and how long he’s, I guess more in person he kept mentioning it at the retreat, but he’s been programming, he’s almost as old as you are, within a year or two. He talks about the Wayback machine, what it was like programming in the 70’s and 80’s and stuff. I’m curious what your background is, how you got into programming and what you came up through to get to the point where you were writing books about JavaScript. REG: **Well, at one point I was in an enriched program. There was something in Toronto called the Saturday school, which is organized like a university. You went at the beginning and you sat in this big room and all these various teachers got up and tried to sell you on taking their course. There is a morning and an afternoon session and you were supposed to pick two courses. You got to pick for yourself. The teachers were all competing for students. I remember I picked something called whodunit, I think it was called whodunit and chess. The whodunit they said was going to be all about puzzles and so on. That interested me because I was very interested in recreational math and puzzles. I had read a book called ‘One Two Three … Infinity’. It’s the very first book I can remember reading about mathematics of any kind. It covered everything from Cantor’s mathematics of multiple infinities, aleph-null, aleph-one and so one, to relativity and curvature space and all sorts of other ideas that went with it. That had really fascinated me. This whodunit really fascinated me so I joined it. There were these two guys Ed and Steve and they were graduate students at U of T and we did all sorts of weird things like played three and four dimensional tic-tac-toe. There’s something that’s called, I understand, Gomoku, which is where you try to get five stones in a line of your color. We tried playing things like that in multiple dimensions. We played with spirograph. One day, they took us all to the University of Toronto on a fieldtrip. By this time, I was no longer going to the chess and just staying in their session all day, by the way, on Saturdays. And we wrote programs in Fortran on punch cards and fed them through and got results and I was completely, completely taken with it. My mom had been a programmer but I wasn’t exposed to programming before this. But I just fell in love with it. I noticed that you didn’t need any kind of identification or anything to run a job. They had this high-speed job stream. It was in a big room. You just put your punch cards in one thing, in this hopper feeder thing at one end and it read them very quickly and it queued your job to be run. Then you collected your punch cards and then you walked around to the other end where there was this big 132-column IBM line printer and it made a huge racket and would print off your job. I screwed up my courage and I just walked in one day expecting to be thrown out and nobody threw me out. I started hanging around there writing programs. After a while, the students there told me that I was wasting too much of the time and I did a little social engineering and in return for going down the hall and getting them pops or pizzas from the cafeteria or whatever, people would help me with my programs. That’s how I fell in love with programming, on punch cards. Now flash forward a bunch of years. I carry on programming into, that would have been 1971, ’72, something like that, and I took a little bit of a detour. I got interested in the business side of business. I went into sales, got into marketing and actually went away from programming in my career. In the late 80’s I think it was, I was selling a bunch of Macintoshes to a group of investment bankers who were using them as this competitive advantage. They asked me to recommend someone to them that could help them build some complex financial models in Excel. I got a couple of people but they kept shaking their head because they couldn’t talk to the programmers that I was recommending to them. It was really important that they communicate. I said, “Well maybe try to explain it to me. I used to do some programming. Maybe I can help you out, manage these people or whatever.” They explained it to me and it didn’t seem that hard so I wrote the spreadsheets. The next thing I knew, I was earning way more money nights and weekends writing spreadsheets for investment bankers than selling computers in the daytime. That rekindled my love of programming. Then I started doing some database work with a product called 4th Dimension on the Mac. Then I built something and I had to write some light-speed C, I remember. Before I knew it, I was right back in the thick of it, just totally in love with it. Started fooling around with Smalltalk. I stayed in consulting. I was going to say, “And here I am,” but there is one more piece. I stayed in consulting and at a certain point I decided I really had enough of consulting and I started looking around to see if there was something else to do. I was very lucky. I was referred by a headhunter to one of the best jobs in the world. I went to work for a company called [Kale] group in Toronto and they made widgets for UNIX X systems. But they were really interested in this new programming language called Java. They wanted to make tools for Java programmers. That was a great fit for me because I was really interested in this programming language called Java. To teach myself the language, I’d written a Scheme interpreter in Java. I went in for this job interview and I had all this stuff in my briefcase. The guy’s name was Steve Rosenberg. He’s a fantastic manager. He asked me, “So how’s your Java programming?” and I said, “Oh, I brought some Java source with me.” I pulled it out, actual printed source, and he said, “What’s this?” I said, “Oh, it’s a Scheme interpreter. Scheme’s a Lisp,” he says, “I know what Scheme is. This is an interpreter?” I said, “Well it’s not the whole thing. I just brought with me the inner loop here, but you can see some of the things l do to optimize tail calls.” He just said, “If you’ve written a Scheme interpreter in Java, that’s good enough for me.” [Laughter]**REG: **We went on to talk about other things and I ended up working on tools for Java. That was really good. I bring that up because it helped shape the fact that I really liked writing for other programmers. I find it tremendously gratifying but it’s ridiculously demanding in that programmers as a whole are very nitpicky. We write the buggiest code in the world and hoist it off on end users, but then when we get tools, you wouldn’t believe the bitching that goes on over this bug or that bug in a compiler or a revision of Linux or something. [Laughter]**REG:  Stop me if I’m wrong. But I find we’re really asymmetrical that way. JOE: **That’s the most correct statement I have heard all day long. [Laughter]CHUCK:  It’s so true. JOE:  And insightful too. MERRICK: [inaudible] that you fell out of, I don’t know if you’d say you fell out of love, but you did get into sales and marketing. I’m wondering, what was the catalyst for you to give up on programming and go do sales for a little bit?**REG: **I wish I had a really, “Man, somebody should do his life story as a movie,” thing to explain. I wish it was noble. But the bottom line is, at a certain point in my life, I was of the age where one is insecure. I was insecure. And I saw at that time that the direct road to affection from the gender that I was interested in seemed to involve the possession of material things one can decorate one’s [bower] and so on.**MERRICK: **Sure. [Chuckles]MERRICK:  I think the honesty in your answer is noble. Absolutely. REG: [Laughter] That’s the honest truth. I have social anxiety, so it seems like an odd thing to go into sales. But I later discovered it’s not that unusual in that people who are sometimes a little anxious find comfort in ritualized kind of interactions. Something like sales is a very ritualistic thing. There’s a path to follow, an algorithm. There’s a very defined goal, whereas a date, there’s no defined goal. You’re meeting someone, see how it goes. You’re not necessarily trying, “I wish to sleep with this person,” or, “I wish to marry them,” or whatever, especially when you’re young. You’re just like, “I’m not sure what to say,” whereas in sales, there is something to say. You can buy a book about what to say. You can watch videotapes about what to say. Also, being a little sensitive and afraid of rejection, as fatal as that is for a salesperson, it can also be helpful in that it can help you avoid being the kind of pushy person who just doesn’t listen because you’re always very sensitive to when someone is negatively responding and say, “Oh okay. I’m pushing too hard or whatever.” Sometimes people who are introverted and a little insecure end up becoming good salespeople. I don’t just mean in terms of the numbers, but also in terms of having satisfied and repeat customers and being able to be a little bit more win-win. You often see that in fields, it’s not such a useful thing if you’re selling stereos on the big main street, but you’ll often find people like this in fields like real estate where they have customers they’ve been dealing with for three, four, five homes in a row. They seem so shy and soft-spoken but somehow they’re one of the top producers in their office. To be perfectly candid, I found it, [inaudible] told me that I have the worst marketed JavaScript book in the world and I think he’s right about that. I don’t necessarily know that I’m using any of the things I allegedly learned in that career. But I have found it helpful when working less with programmers but more with either in a consultant situation or in a business situation with being able to appreciate things like requirements specifications, the process of negotiating estimates, and all the other things that have very little to do with JavaScript but are nevertheless incredibly important for writing software that ends up making a difference in a successful project. A little off-topic for this, but I don’t sit here and regret it.**CHUCK:  Well, the things is all of the stuff you’re talking about, yeah it’s not technically about the book but I think the career and the personal stuff, we all deal with that. It is still interesting and relevant to us as programmers. REG:  That’s great. Well there you have it in a nutshell, how I got here. Oh, there’s one more thing. Would you like to hear one more thing? CHUCK:  Sure. REG:  It’s a hacking thing. Say one thing that people wouldn’t guess about you, although I may have mentioned it at some point in the past. I actually spent a lot of influential time with my father on a commune in British Columbia, which to this day is still the more smoke-ridden part of Canada. BC Bud, I believe, is its greatest export. Although to be perfectly candid, I was young so I didn’t witness anything like that at the time. But I remember he definitely instilled certain types of things that we today would call socialist values. I think he was coming at it more from this old-school hippie Marxist-Leninist thing and I don’t buy into any of those slogans. But the underlying ideas that you find in things like small communities where everyone raises a barn together and the things I said earlier about knowledge being a positive-sum game where everyone wins, I think those are things that have carried with me from those early experiences. JOE:  Awesome. CHUCK:  Alright, well we’re getting close to the end of our time. I’m probably just going to wrap up the show. We’ve already been talking for an hour. I try and keep the show to about an hour. But thanks for coming on the show and thanks for writing the book. It really was a terrific read and we appreciate you taking your time. REG:  My pleasure indeed. Wonderful. Well thank you so much for having me on the show. I was a little anxious coming on, but I feel really relaxed and happy right now. So thank you so much. CHUCK:  Terrific. MERRICK: **I feel like we were talking to Yoda this whole time. You’re very [inaudible] wise words.**AJ: **Yeah. [Laughter]**REG: **I’m going to have to get my ears clipped. [Laughter]**CHUCK:  Alright, well let’s go ahead and do the picks and then we’ll wrap up the show. Joe, do you want to start us off with the picks? JOE:  Yeah. I only have one pick. I think I got the same pick that Merrick has. So are you doing any other picks than one pick, Merrick? MERRICK:  Yeah, I’ve got one other pick. JOE:  Alright. So I’ll do our joint pick. MERRICK:  Okay. JOE:  Merrick and I, together jointly, are going to pick the Angular conference, ng-conf. Merrick and I are assisting to organize this conference. It’s going to be the world’s first dedicated Angular conference. It’s going to be held in January of 2014 in Salt Lake City right during the Sundance Film Festival. So for extracurricular activities, there’ll be some really nice awesome cultural extracurricular activities available. It’ll be a two-day conference, single track. The Angular team itself is going to be here presenting. At least five members of the Angular team will be here presenting. It’s going to be a really, really awesome conference. Very excited for it. Very excited. If you go to ngconf.org MERRICK:  Nope, ng-conf JOE:  ng-conf, thanks, then you can sign up, put in your email address and get notified as tickets go on sale. MERRICK: **Yeah. Then the other pick that I wanted to add, I think Joe should go into sales. That was pretty good. [Laughter]**MERRICK:  But I got this thing that used to be a Kickstarter project and it’s called LUMOback. It’s like this thing that you strap around your waist and it monitors your posture and streams your posture information to your phone. Also, if you’re slouching for more than a certain number of seconds, it’ll vibrate on your back. So it’s been pretty neat so far and I’m hoping it’ll get rid of some of my lower back troubles. JOE:  So are you annoyed yet with it constantly buzzing at your slouching? MERRICK:  Yeah, I took it off during the show because I got pissed at it from buzzing at me. I’ve been slouching throughout the show, I suppose. CHUCK:  Nice. MERRICK:  But yeah, that’s the pick, is just the LUMOback. CHUCK:  Alright. AJ, what are your picks? AJ:  I’ve been working with Twilio lately. It’s been really fun and interesting, challenging, because you’re working with a phone. You’re used to working with client and server but all of a sudden you have at least two phones and this concept of a call, which is like a session, but not. Just the way you make the requests and you get the responses and you get several responses for different events that might happen. If they put in some keys, you’ll get a response and then you get to respond to the response with some other action. It’s just been interesting to wrap my mind around the way that it works. It’s very not RESTful. It’s very something else. It’s good that it’s not RESTful because REST doesn’t’ really apply to the use case of how the phoning works. But anyway, I’ve really been enjoying it. Twilio just makes telephony so simple. It’s so easy to use. There are obviously some bumps and hurdles, but it’s been really great. Also, I decided to throw up a project on Bountysource, which is like Kickstarter. It’s what Tim was using for JS Git for his second round. I’ll just mention that and throw it up and if people like it, they can contribute to it. But it’s an inbox for everything. Basically, your emails, text messages, voicemails, direct messages on Facebook, direct messages on Twitter, all in one place so you don’t have that problem of you start a conversation on email, it moves to text, it goes back to Facebook, then you can’t view the conversation as a whole or you can’t figure out where was it that they gave me the time. You have to search through your texts and your emails and your Facebook to find the time of the meeting or the place or stuff like that. CHUCK:  That sounds interesting. I’ll go ahead and give my picks next. I’ve got a couple of picks. One is I was trying to do some stuff for signing up for Ruby Rogues Parley and incidentally, I’m looking into doing something similar for JavaScript Jabber. I was trying to set things up with nginx which is an Apache alternative if you’re not familiar with it as a webserver. I had some problems. There’s this guy that was following me on Twitter so when I posted, he replied and was super helpful. His name is Brian Stevens. You can find him on Twitter as @bdstevens. You can find his company. He’s a freelance IT guy. I think it’s DataPorters.com. Anyway, go check him out. The other picks that I have, so Ruby Rogues are writing a book and we’re doing it through Pearson and Pearson owns InformIT.com, which is a place you can get eBooks. They’re also part of the family of publishers that put books on Safari Online. Those are two terrific places to get these books. Some of the books that Reg talked about, like the ‘Functional JavaScript’ that was written by Michael Fogus is available on Safari Online. Really, really like those services and I’ll put links to those in the show notes as well. Reg, what are your picks? REG:  Well, I mentioned QED, I mentioned ‘One Two Three … Infinity’ and I’ll toss one more in. Tom Stuart has written an amazing book, ‘Understanding Computation: From Simple Machines to Impossible Programs’. It is written in that incredibly complicated Ruby programming language. I love the language, but it’s not nearly as elegant as JavaScript is for the types of things he’s talking about. But for those listeners who do speak Ruby or even if you skip over some of the code examples, he does explain a lot of really cool, cool things from finite automata and cellular automata and combinators, my own interesting thing in chapter seven, all up to Turing machines and so on. He does it in a style I wish I was as good a writer as he is at being able to make it start with basics, which is something I was trying to do with ‘JavaScript Allongé’. He just starts with basics and then walks you up. It’s like having a graduate degree in computer science without all the exams, all the studying, and with it being an enjoyable read. That would be my third pick on top of QED and ‘One Two Three … Infinity’. CHUCK: **Awesome. We will be discussing Understanding Computation with Tom on the Ruby Rogues podcast in two weeks. [Laughter]**REG:  Well, do you want a different pick then? CHUCK:  No, that’s awesome. Really quick, where do people go to get your book? REG:  Okay. The URL is leanpub.com/javascript-allonge. My understanding is this broadcast will be coming out on a Friday, so I would be pleased to offer listeners to this podcast $5 off if they pick it up on the Friday, the Saturday or the Sunday. Weekend sale. CHUCK:  Awesome. REG:  All they have to do, there’s a coupon spot, is type the words, well one word. All is one word in capitals, JSJABBERROCKS. CHUCK:  Awesome. Really appreciate that. I’m sure our listeners do too. So just to clarify, that is only Friday, Saturday and Sunday when the show comes out. REG:  That’s right. CHUCK:  Okay. Alright, well thanks for coming on the show again, Reg. It’s been terrific to talk to you and I’m looking forward to talking to you again. REG: ** Thank you so much.

Sign up for the Newsletter

Join our newsletter and get updates in your inbox. We won’t spam you and we respect your privacy.