Episode 161 of The SitePoint Podcast is now available! This week our regular interview host Louis Simoneau (@rssaddict) interviews long-term podcast host, Kevin Yank (@sentience) who now works at Learnable and is releasing the fifth edition of his book on PHP and MySQL now called PHP and MySQL: Novice To Ninja (formerly Build Your Own Database Driven Website using PHP and MySQL).
Listen in Your Browser
Play this episode directly in your browser — just click the orange “play” button below:
Download this Episode
You can download this episode as a standalone MP3 file. Here’s the link:
- SitePoint Podcast #161: The Return of the Yank with Kevin Yank (MP3, 43:37, 41.9MB)
Subscribe to the Podcast
Louis and Kevin talk about how the changes in PHP over the 10 years since the launch of the book’s first version have driven the need for the different versions, and how the latests version differs to the previous editions. They also talk about how PHP still makes a great choice for getting beginners into server-side coding.
Browse the full list of links referenced in the show at http://delicious.com/sitepointpodcast/161.
TLouis: Hello and welcome to another episode of the SitePoint Podcast. We are kicking it old school today on the podcast, we have an alum from the SitePoint Podcast joining us, and also the author of a new book from SitePoint, if you haven’t guessed yet it’s Kevin Yank; hi, Kevin.
Kevin: Hello! Hi, I’m here, I’m back!
Louis: Welcome back, it’s good to have you back.
Kevin: Thank you. Yeah, it feels weird to be introduced still on this show.
Louis: I was toying with the idea of letting you do the introduction and playing it all backwards and surreal.
Kevin: It’s the lost episode.
Louis: So, yeah, lately you’ve been hard at work cranking out the latest edition of SitePoint’s most venerable title.
Louis: It used to be not only SitePoint’s most venerable title, but also SitePoint’s longest title in terms of the title.
Kevin: Oh, yeah, it was really long! I think we’ve had others, it used to be called Build Your Own Database Driven Website Using PHP and MySQL, and I’ve gotten really used to saying it that way over the years, and now I can’t even call it that, that’s not the title of my book anymore; it’s now PHP & MySQL: Novice to Ninja, but even though it’s a different title it’s still the fifth edition. It blows your mind.
Louis: My mind is blown, I have no reaction.
Louis: So, yeah, this is sort of our, as the title now says, Novice to Ninja, so beginner title for PHP and MySQL.
Kevin: Yep. It was the first-ever book that SitePoint published way back in I want to say 2001, I think the book might have actually been published in 2002 for the first time. But, yeah, back when SitePoint wasn’t even a book publishing company someone said “You know these articles we have on PHP and MySQL are really popular, we should put them out as a book that we can sell.” And I said, “You’re crazy, these articles are available for free online, why would anyone pay for them?” And it turned out a lot of people wanted them in a book format, and it’s just a whole lot nicer to read that way. These days you can’t get the whole thing for free online, I’m afraid, sorry dear listener, you’ll have to buy a copy of the book (laughs). This is the fifth edition; it’s had five whole editions over the years.
Louis: Why don’t we just talk a little bit about what’s changed in the world of PHP since the good olden days.
Kevin: Well, since the first edition a lot has changed, and basically until this one every previous edition of the book was necessary because PHP had changed so much that the advice that was in the previous edition was no longer good advice, the world of PHP had moved on so, you know, by the time the second edition came out the first edition was really old because it was all about PHP3, and now PHP4 was out and there were new ways of doing things, the installation instructions were broken, so on and so forth. The third edition was that PHP got rid of registered globals, register globals was no longer a good thing. And the old-school PHP-ers in the audience are going, “oh, yeah, register global, that was ridiculous!”
Louis: That’s all well before my time.
Kevin: If you don’t know what register globals is, basically the old way PHP used to work is that anytime the web browser made a request if it submitted a form or had a query string in the URL then all of the variables from that, be they from the query string or from the form, would be created as PHP variables automatically for your script; when your script fired up to start processing the page request it already had all of these variables for whatever was submitted from the browser.
Louis: Wow, that’s a terrible idea (laughs).
Kevin: It’s super convenient, super convenient, but, yeah, it means that if you’re a scripted something like ‘if the user is logged in’ — or ‘if the user is an administrator allow them to see the administration pages’, and if you weren’t really careful the user could just submit a variable called the user is an administrator and they would be granted full access. So it meant on the one hand the language was really easy to learn, really easy to use, on the other hand really easy to make horrible security bugs with. So the PHP community as a whole thought better of that decision, ripped that feature out, it’s still in PHP to this day; I think with PHP 6 it’s finally going to be completely removed once and for all, at the moment it’s just turned off by default.
Anyway, we’re getting way off track.
Louis: That was a significant sidetrack for this entertaining trip down the history of web programming languages for the history buffs in the audience.
Kevin: I think we’ll come back to that because it’s choices like that that have made PHP the successful thing it is today, but at the same time there are things that have had to be thrown away. But, anyway, that’s what generated the third edition of the book. The fourth edition of the book was PHP 5, and again a refresh of installation instructions, but more importantly it was a reorganization of the code; it was rewriting the code in this model view controller approach that seems to have become the new standard, the new defacto way of writing web applications in a maintainable and manageable way. You keep the PHP logic that controls how a request will be handled separate from the HTML templates that control what your website looks like and what the menu structure is, and things like that.
So, yeah, that was the fourth edition of the book was really revamping the entire code base to be a lot more modern in that sense. And I had a brain fart coming into the fifth edition because I had forgotten that I had done those updates to the book.
Kevin: SitePoint came to me and said, look, it’s been a few years since we’ve done an edition of this book, can you think of things to make it better that would make it worth doing a fifth edition? I went, oh, absolutely! I’ve got all these ideas for reorganizing the code, it’s gonna be great! And they said great we’ll sign you up. And so then I sat down to start writing and I looked at the fourth edition and I went, oh no, I did all of that in the fourth edition; all of my ideas for making the fifth edition better were already in the fourth edition, I had forgotten that I did it.
And so I was faced with the fifth edition, I had signed the contract, I was ready to start writing, and I had to come up with new ways to make this book better.
So, on the one hand this fifth edition is the first version of this book that I think didn’t have to be written; PHP has not changed a whole lot in the last three years, certainly not from a beginner’s standpoint. There’s been plenty changing in the advanced areas of PHP, there have been new frameworks, new ways of working with advanced PHP, and that is where PHP continues to progress and continued to change quite rapidly. But as a beginner learning PHP as your first web programming language it hasn’t changed a lot in the last three years, so you could have just picked up the fourth edition and learned, but I thought you know what, I’ve made all this time to write a new edition, I might as well try and do something better. And I think it’s resulted in a book that I’m more proud of than I have been in the 10 years that it has existed, because I basically chapter-by-chapter went and had a really honest look at the book that is now 10 years old and gone, look, way back in 2001 when I wrote the first edition of this I said myself, look, I probably can’t expect a beginner to do X, and so I’m going to teach them something that’s simpler, something that’s easier to teach; I took a lot of shortcuts in order to get a beginner to a point with PHP that they feel confident. They feel confident but there are some interesting and useful parts of the language that I simply didn’t teach because I thought, you know what, this is a beginner’s book, I’ve only got a certain amount of time to write it and that thing would be really hard to explain. For this fifth edition I did challenge myself wherever possible to go, alright, I’m going to take the time to find a way to explain this the right way.
So there is a bunch of new stuff in this book that is quite advanced for a beginner book, if that makes sense. You’re not going to find, for example, coverage of object oriented programming and exception handling in most beginner PHP books. The way you interact with the database is no longer the simple old-fashioned way that most PHP tutorials out there will teach you, it’s modern what we call PDO, which is the PHP Data Objects API, and it’s object oriented, it’s significantly more complicated for a beginner to learn, but it is exactly what they expect you to do if you’re going to go out there and work as a professional PHP developer today.
So if you’re picking up this book telling yourself, a) you might want to become a freelancer who works for themselves building PHP projects for clients, your clients are going to be so much happier with the work you produce after reading this book. B) if you’re thinking of becoming a professional web developer and you want to go out there and interview for a PHP developer job, even if you’re going for an entry-level position, a junior web developer role, the people who interview you are going to be so impressed that you’ve only been working in PHP for a year or so and yet you’re doing things the right way, you’re doing things the way the advanced people choose to do it.
So I think that’s what I’ve achieved in this book, in this new edition, I hope that’s what I’ve achieved; I can’t wait for people to get a hold of the book and start telling me, hey, that worked for me, that didn’t work for me because hey there’s always a sixth edition around the corner.
Louis: Yeah, we’ll talk more about that in a little bit. One of the things that that kind of brings to mind, though, is this seemingly ongoing trend in web development in general that things are getting more advanced, I don’t know if that makes sense to you, but even on the front-end side whereas it used to be a front-end web developer is someone who could write HTML —
Kevin: Yeah. I spend a lot of time thinking about this, I’m glad you brought it up; I’m also a little depressed you brought it up (laughter). I had a blog post in my head that I’ve been trying to write about this stuff for about a year now, and I’ve never written it down because I’m afraid it would be too much of a bummer. I think a lot of us who’ve been working on the Web for say a decade on average at the moment, since it got really popular probably 10 years under the bridge, and a lot of us who got into the Web at the “beginning” got into it because it was this medium for expression that anyone could get into; you could sit almost anyone down, anyone who’s fairly confident using a computer could sit down on a weekend and learn to build websites, and by Monday they could have their first website up and running. And sure it probably wouldn’t — it wouldn’t look super refined, but it would stand up there with the websites of the big players, you know, my personal website and the Microsoft website; my personal website and the Apple website, there wouldn’t be a world of difference between how those felt to a user. And this ability to level the playing field so that me as a person I could express myself in pretty much the same way as giant corporations expressed themselves, on this level playing field, was really attractive to me as someone just getting out of university deciding what I wanted to do as a career. I wanted to work on this platform that allowed personal expression on a whole new — to a whole new scale.
And I start to wonder if we’re losing that on the Web, because if I tried to sit someone down and teach them how to build websites on a weekend I’m not sure I could do it anymore. Certainly they could get up a ramshackle looking webpage that said, “Hi, my name is Kevin and my cat’s name is Oreo,” you know, but this website that you put out would stick out like a sore thumb as an amateur hour effort these days.
And when you start talking about what’s the right way to build a website, oh my gosh, how much time have you got, we’ve got these sites like HTML5 Boilerplate, a great website, a project by Paul Irish and a bunch of other stars of the web development world, but the site is basically a gigantic code base that you download and it builds a blank website; it’s like here is the one thousand lines of code to create a blank canvas for your website if you want to do everything the right way.
Louis: Yeah, there are some interesting points to make about that. I’m not sure that I think a lot of those things are things that if you’re working professionally there are shortcuts and stuff that you wind up using in every project, but they’re not necessarily all, I think, best practice. I don’t know if you saw Rachel Andrew wrote a blog post I think last month sort of talking about —
Kevin: The keep it simple argument.
Louis: Yeah, and you know I really like that approach.
Kevin: But you see my point, though, a beginner getting into this, oh, my gosh, you’re barraged with advice and this is the right way to do it, not this way, okay, the first thing you need to learn is this list of 100 things to get started.
Louis: You know, writing all this markup and styles to make that work in the, um, I don’t want to talk about the browsers of that day without using any pejorative terms (laughter).
Kevin: Rounded corners, drop shadows, these are things you can just do now.
Louis: Yeah. So, I mean and moreover we have these thoughts of things are getting much more difficult and much more complicated, and it’s a higher bar to entry, but the kids are still doing it and they’re doing it really well.
Louis: And if you look at the kind of projects that are coming out, and even though back in the day building a website basically was something you did in a graphical editor and dragged filed around and FTP-ed them to things, nowadays a lot of people use command line tools and Git and post projects on GitHub, but it’s all still there and it’s still happening, and if anything there’s more innovation and more experimentation. So it might feel or appear like something that should be a bummer, but it doesn’t look like that’s actually what’s happening.
Kevin: Yeah. And this is — I’ve been thinking about this a lot, like I said, recently because I’ve been working on a book about PHP. And I suppose the elephant in the room here is where does PHP stand in the — the elephant; there’s an elephant on the front cover of my book (laughter), and PHP itself, the mascot of PHP is an elephant, I didn’t even think of that. But the elephant in the room here, so to speak —
Louis: You should’ve just made that sound like it was planned, it would’ve been so smooth, it was slick. I see what you did there, but you didn’t see what you did there.
Kevin: (Laughs) No, but the thought that occurs is where does PHP stand in relation to the other languages that let you do the same sort of stuff that PHP does these days. Ruby and Ruby on Rails, really popular, Python is also a great language, and you compare these and the other ones that are out there to PHP, and PHP has been around a lot longer, it’s got maybe a few more years on it and maybe even lacks some of the shiny new features, and certainly a lot of hype and enthusiasm that you’ll get from some of these other languages. So as I’m sitting there writing the 10 year anniversary of this book, if you will, I’m thinking who’s this book for and what is the place for PHP in the world of web development? And coming back to this point of I’m a beginner, want to learn to build my first website, what should I learn first; I still think PHP is a really strong choice.
Louis: Yeah, I still think that even though I personally don’t code in PHP, and if I was starting a new project I wouldn’t use PHP, I work in Ruby at my job and I would work in Ruby if I was starting a new project that I wanted to build, but if I wanted to teach someone server side web development I would probably still start with PHP because you can have — it’s that thing where you can have file that is requested, I point my browser at this file, the server executes the script and gives me the result directly, there’s not all this infrastructure around it; I can learn the idea of server side processing and then gradually add on bits and pieces like, oh, you can connect to a database by doing this, oh, and you can connect to an external service by doing this.
Kevin: Yep. And, look, just last week my boss came to me and said, alright, we’ve got this crazy idea, we want to build a website in a day to try this idea out, go. I had two minutes to think what am I gonna build this thing in, and I chose PHP because, well, a) I’ve been working in it for 10 years and I’m more confident in it than anything else, but, b) I didn’t have to think what server are we gonna host this on, what platform is this gonna have to run on, what are the other developers who are going to have to work on this project going forward gonna have to learn? All of those things are answers that you can come up with convincing arguments for other platforms for, but they’re things that you don’t even have to think about with PHP; every web host to a significant digit out there supports PHP and MySQL, both of which are covered in this book. Any developer who’s been working in any language can learn PHP in an afternoon, at least to the point where they can be dangerous with it (laughter). So I went, you know what, I’ve got a day to work on this thing, if it sees a lot of success we might rebuild it in something else if it makes more sense to, but as I throw something together in an afternoon, get it online, and be able to get other developers, be they junior or senior, productive with this code base, PHP was a great choice, and that’s the one that I made. So, I think when I made that choice I sat back and I went you know what I actually still do feel good about writing a beginner’s book about PHP today, because if you’re not a programmer, if you’re someone who you know HTML and CSS and learning “real programming” really scares you, PHP is the best place to start because it is a) a real programming language that you actually can get anything done in, but b) it isn’t full of tricky features that make advanced programmers lives easier. If I’m an advanced programmer, yeah, I love playing in Rails and I love playing in Python because those languages are full of convenience features and flexibility and means of expression that allow me to fly as an advanced developer, but those same things that make my life great as an advanced developer really bog down a beginner, and I think the fact that PHP doesn’t have those standing in your way makes it the best first language to learn still as a web developer.
Louis: Yeah and just coming back to what I was saying earlier, that a big thing when you’re starting to learn is to be able to get a result really quickly.
Kevin: Yeah, end of the first chapter, and you’ve got your first —
Louis: The thing is up there and it’s running and I can see a result and I can tweak my code a little bit, upload it, run it again and see that result change. I mean that’s that first moment when programming makes sense and then you’re off, right; if it takes five hours to get there instead of ten minutes you’re probably gonna lose a lot of people.
Louis: So, like I said, it’s still what I would choose to teach someone if I had to teach basic server side programming, and moreover, there’s so much — you know, if what you want to do with it is start to hack it at WordPress or Drupal there’s so many big projects out there get you a website with all the features and then you can go and tweak things that you need to tweak.
Kevin: WordPress as an example of a PHP project, it’s a big scary pile of code, and it’s not a super-beginner piece of code either; if you were to pick a random PHP file in WordPress and try to read it the first day that you’re learning PHP you’d be pretty lost. But, as someone who has just learned PHP, look, here’s what I think is a common path these days, I need a website, I download WordPress and I set it up using the installation instructions, and now I can publish my website; but now I want to tweak my website, I want to add some unique feature to it, or I want to customize it to make it look different than all the other WordPress sites out there, now I need to learn PHP. You pick up this book, you learn PHP and then working on WordPress, even though you might not understand all of it, you now have the confidence to work on a WordPress theme or just add something to the sidebar, and it’s great for that.
My point here, I think, if I have one, (laughter) —
Louis: I wasn’t sure there was one there.
Kevin: My point if I have one is the fact that things like WordPress are written in PHP is a deceptively great choice, because WordPress needs to do some quite advanced things as a web application, and it would be tempting for the developers at WordPress to go let’s throw away PHP and use something like Ruby on Rails that allows us to work more powerfully as advanced developers. But then those beginners who are actually creating their websites with WordPress and want to make little customizations, they would have to learn something quite difficult in order to make that possible; the fact that WordPress is written in PHP makes it great for someone who’s setting up their first website to be able to do some customization on it. And so the fact that it’s written in PHP is almost extra work that the developers at WordPress have done in order to keep it beginner friendly and beginner customizable, and that makes me happier about it.
Louis: I’m sure none of them have thought about it that way.
Kevin: No, no, it’s kind of something they’ve gotten by accident, because when WordPress was first written it was a blog engine called B2, and way back then PHP was the best, most powerful choice. But the fact that they’ve stuck with it has kept WordPress in the position that it is, this dominant position as a blog hack form.
Louis: Yeah, and as you were talking about earlier, the ease of deployment means that anyone can grab WordPress and chuck it on some cheap shared hosting, and a lot of these other shared platforms don’t really do shared hosting as well as PHP does. So, I mean I think that’s one of the big reasons we haven’t seen any Python or Ruby blogging engines that you can just download and chuck up on your system, because there’s just a little bit more server configuration required if you want to use one of those platforms.
Kevin: Coming back to the front-end stuff I think we see similar things going on with the ongoing efforts to add features to things like CSS, you know there’s this draft spec for CSS variables that is out there, and these days any developer who works enough in CSS that they would miss having CSS variables, they’ve chosen a tool, or at least if you haven’t you should, they’ve chosen a great tool for writing CSS and then — well, writing a more advanced version of CSS and compiling it down to CSS; we’re talking about LESS, we’re talking about SASS, we’re talking about the other players in this space here.
Louis: Yeah, that’s interesting.
Kevin: By the same token I think this was the downfall of the Java world, Java web development; if there are any people here who today were —
Louis: This was the downfall of Java, Java’s dead, you heard it here first people, Kevin Yank proclaims the death of Java.
Kevin: Java’s dead as something I would recommend to someone wanting to get into web development to learn as their first language, it’s not the right place to go. And at its peak the Java web development space was this onion of at the center you have the Java language, and then you have a very thin layer on top of that which is Java servlets, which is just you can write Java code that will generate a web page and a web server can send that to a browser. And then on top of that you have JSP, a templating language that compiles down to Java servlets that compiles down to Java that can build a website. And at its height the Java web development world was about ten layers deep of that, of the thing that you actually want to work in is on the surface of this onion, but you have to learn every one of those ten layers all the way down to the core of the onion in order to feel like you understand what’s going on. And if we let the Web get that complicated, if you have to learn not just CSS but SASS on top of CSS, not just SASS on top of CSS but something else on top of SASS, not just something else on top of SASS but something else on top of something else on top of SASS, it’s gonna get out of control and the Web is not gonna be approachable, maintainable, it’s not gonna be able to evolve at the speed that the world demands, and the Web will be replaced by something just like Java is in the process of being replaced by things.
So there is a balance to be struck here, I think it’s good to have advanced tools sitting on top of basic platforms, but as soon as you see things getting two or three layers deep it’s time for something to be added, something to evolve.
Yeah, and I don’t think this is a problem. Look, I think the Web is doing well on these fronts, I’m just kind of describing the patterns that I see, but I think it’s still good, I mean you’re still a web developer, right?
Louis: I am still a web developer (laughter), last time I checked, I don’t know, I haven’t opened up my editor this morning yet because I just got in to record the podcast, so maybe when I open it up I’ll find out that I’m no longer a web developer (laughter).
Kevin: Well, hopefully there’s still a few thousand people listening to this that are still web developers as well. And I’m still passionate about the Web, it’s still the main thing that I choose to work on day-to-day, and I think it’s because we’ve got this great balance that the community is taking care of. So, yeah, buy my PHP book (laughter).
Louis: Wow, that was probably the most philosophical sales pitch ever uttered.
Kevin: But to bring it back to something more tangible, look, if you get this book take a close look at the cover image because I didn’t even realize; I’m sitting in the SitePoint HQ office with Louis at the moment, and I’m visiting for the first time in a month since the cover of my book was designed, and I walked over to Alex Walker’s desk, Alex Walker’s the talented designer who designs all of the book covers for SitePoint books, and I saw on his desk the purple elephant that is on the cover of my book. When I saw the cover of my book I went, oh yeah, that’s pretty cool, they got a purple elephant because PHP’s about purple and about elephants, that’s really cute; I just assumed he found that purple elephant in some stock image library somewhere and I thought it was just a great coincidence and it’s a great image. Alex molded this elephant by hand out of platiscine, it is sitting on his desk at the moment and I kind of want to steal it.
Louis: (Laughs) it is. Yeah, Alex for the last several book covers has actually been trolling through curio shops and finding these objects like the kite for Rachel Andrew’s last book was something that he brought in. Yeah, so he’s recently really taken a shine to find these little things.
Kevin: And he’s building a little circus of these characters on his desk, like you go over to his desk; someone should post a photo of this, or if they haven’t already, and just like every time he does another book cover there’s a couple of new editions to the population of his desk, and it looks like a little village of crazy characters sitting there.
Louis: I’ll definitely take a picture and post it in the show notes for this episode (laughter). But I just want to do a couple more things, first of all, because you’re a returning host of the SitePoint podcast.
Kevin: Yeah, how’s it going?
Louis: It’s going great; we’re having a lot of fun.
Kevin: I heard you guys mention me the other day when you were talking about alcohol in web development.
Louis: Yes, well, like I said, you’re my reference point for alcohol-free web development.
Kevin: It’s hard being a non-drinker in Australia of all places, let me tell you.
Louis: So, yeah, did you have any — I was about to close off and go into some other stuff, but we got some time so do you have some thoughts that you wanted to contribute to that discussion? Did you read that blog post when it came out of the culture of exclusion?
Kevin: No, I didn’t, I’m not sure why I didn’t, but it was kind of like because it’s about me I kind of feel like, yeah, I know what that is. It’s definitely real. It sparked some debate around is this an artificial argument, is it just something this guy is making up or is it real, and I think it’s real to some extent. Look, I’ve only worked as a web developer in Australia, and Australia particularly has quite an alcohol-positive culture, like it’s part of what you do when you go out with friends on a weekend. And to some extent that was true of Canada where I’m from as well, where you’re from as well, but it’s even moreso here, and it’s also very true of the work culture. So as a non-drinker I did kind of stick out; on a Friday everyone got up from their computers and went out to a bar, and I’d certainly go along and chat and have a good time with everyone, but I think my ability to fit into that crowd was despite the fact that I wasn’t drinking. So the fact that I wasn’t drinking probably put me at a disadvantage, and I had to work a little harder to fit in and stay in that conversation. It’s not something insurmountable, but it’s something you feel for sure.
Louis: And how do you feel about like one of the things that Ryan in this original blog post was raising was sort of the organization of conferences where a big part of many conference schedules is the party after the talks, and on a Sunday morning let’s just say that everyone’s operating at about 25% of nominal capacity.
Kevin: Yeah, for sure, look, I think that’s a case where there are pros and cons, the con of course is, yes, everyone’s out partying and having a drink, and after the conference everyone has great stories about the crazy times that were had the night afterwards, and Kev was there too (laughter). But, as you say, like I’ve been to many a conference that are two days long and there are people who didn’t make it in to the second day. I don’t want to name any names, but there are people here at SitePoint that came along to conferences who had to bow out of the morning talk and go, you know what, it was a bad idea for me to get up, I’m going back to bed.
Louis: Although I’ve definitely had some moments, like when I went to Web Directions I did power through those morning talks, but me and Matt Evans were kind of, you know.
Kevin: So I would say it’s a different experience for someone like me going to a conference like that, but on the bright side typically the speakers, especially the speakers who are speaking the second day, they have to take it easy as well because they’ve got a talk to deliver. And so on that second day there are people like me who had a iced tea and then went home to a hotel and had a great night’s sleep, and there are the speakers who probably were feeling like they couldn’t participate in the party as well. And I don’t know about you, but when I go to a conference like that my ambition is to connect with as many of those big speakers as possible and have a good chat with them and go, look, your talk connected with me in this way and can we talk some more about that.
Kevin: The more of those kinds of conversations I can have the better I feel about my conference experience coming home, and I feel like I can have more of those chats at a conference because I’m one of the non-drinkers. And so it’s how you choose to spend your time, and I think it can hold back your career if you’re not good at fitting into a crowd.
Louis: But I think that’s true of any industry, and it’s not necessarily related to drinking like your ability to socialize and to put yourself in contact with people.
Kevin: Oh, absolutely. But, yeah, it’s how well can you go without that social lubricant, and that’s exactly what it is, is it’s a lubricant. And so, you know, if you’re going without that assist you’ve just got to take it upon yourself to go, look, okay, if I’m gonna be friends with these people, if I’m going to forge a relationship with these people it’s up to me to make that happen, it’s not gonna happen automatically.
Louis: (Laughs) or with the assistance of a ladle of Jameson’s.
Kevin: Yeah, yeah.
Louis: Fantastic. So what I was coming up to before this was that as an alum of the SitePoint podcast, ex-host, I thought we could for old times sake have you do a little bit of a spotlight.
Kevin: Oh, right!
Louis: Just to bring you back.
Kevin: Okay. Yes, I have prepared something.
Louis: (Laughs) I wanted to make it sound like I was springing this on you.
Kevin: Well, you did spring it on me. Just before we started recording Louis said, “Hey, and for old times’ sake you might as well do a spotlight,” and I went, “I completely forgot we did spotlights!” So I’ve gotten something together, this is something that, I don’t know if my boss is listening but, accidentally occupied my afternoon the other day (laughter). You know when you click the wrong link and suddenly it’s 5:00p.m.
Louis: Yeah, yeah.
Kevin: I had one of those. But it’s good because it’s a tool I discovered and it’s gonna really improve my working life going forward. Look, this is a nerdy one, but I’ve got to bring it up because —
Louis: That’s what we’re all about here at the SitePoint Podcast.
Kevin: If I feel like I’ve left anything in leaving the SitePoint Podcast is that I’ve allowed the nerdiness level to dip slightly, so I’m bringing it here with an alternative terminal shell called Z Shell or ZSH for short. If you’re a Mac user this is something that’s really easy to try out, but it’s really only gonna matter to you if you’re the kind of person who lives in the terminal. These days a lot of web developers are living in the terminal, maybe not living in the terminal but they have a terminal window open for doing things like Git commits, and stuff like that. And the out of the box program that runs inside that terminal is a shell called Bash, and it’s been around forever, and everyone who works on Linux systems knows how to use Bash; this is the thing that shows your prompt and then you can type a command and press enter, and then if you got the command slightly wrong you can press the up arrow and you get the previous command and you can edit it and press enter again. This is what your shell is doing for you; it’s a lot more besides that, but as a web developer that’s typically the kind of stuff that a shell is doing for you. Bash is good, Z Shell is better. And it’s built into Mac OS 10 as well, so you don’t even have to download anything to try out Z Shell.
On your Mac you just open system preferences, and then you go into your Users and Groups panel of system preferences. Now usually this panel is locked, there’s a little padlock down in the bottom-left of the window, you hit that and type in your account password, assuming you’re in an administrator account that’ll unlock it, then you can right-click on your username in the list of users and you get this secret popup menu called advanced options, and when you hit that you can edit some really low-level scary options about your user account on Mac OS 10, and you don’t want to touch any of those except for this one dropdown called login shell, and by default it’s set to /bin/bash, if you just go down and choose /bin/zsh instead, hit ok and close out all these windows, bam, you are now configured to use Z Shell. Now the next time you open up terminal it might look a little different, you’ll have a percent sign instead of an angle bracket for your shell, but it pretty much works the same way except when you start using it you’re going to notice some nice conveniences. A lot of the commands, for example, have built-in help, so if I type LS, which is like the command to get a directory listing, and I type dash, which is if you want to add options to LS you do LS-A to show all files, I can do LS- and then hit tab and I get a list, sort of help list of all of the options that LA supports with like descriptions next to each one of them. And it shows it below your current command prompt, so you can then keep typing the command and then when you hit enter that help is replaced by the results, so you’re not full of ugly help documentation in your shell history, it just shows while you need it and then disappears.
Similarly for directory completion you can type LS, for example, and then the fist letter of a filename, and if you hit tab in Bash it’ll kind of guess which file you meant, well, in ZSH it’ll show you below it a list of all of the files you could’ve meant, and then, again, you can keep typing and get more specific. This is just the surface of what ZSH can do for you, but right out of the box it’s a lot more convenient. The other big thing is that you can filter your history, so you know when you press up arrow you get to scroll through all of the previous commands you’ve typed at your shell, well if you know you want to change directories and you’ve typed it recently, you can just type CD and then start pressing up arrow, and it has filtered your history so you’re only looking at the previous CD commands that you typed. There are ways to do this sort of stuff in Bash with like control R and searching through, but I find ZSH’s way of doing it is way more convenient and it’s really worth learning, but even if you don’t spend time any time learning it just switching to it some of these features are gonna jump out at you and you’re gonna go, oh, that’s nice!
There’s this great project called oh-my-zsh, which is hosted on GitHub, we’ll put the link in the show notes, but it’s github.com/robbyrussell/oh-my-zsh. And it’s kind of this set of configuration files for ZSH, and you just kind of follow the instructions to install it and suddenly ZSH is really smart about things like Git, so if you go into a Git working copy it’ll show you what branch you’re on and whether it’s been committed or whether there are uncommitted changes; those kind of details show up in your command prompt.
So, oh-my-zsh has all these plugins that you can turn on and off, and it has a bunch of themes that you can play with to make your prompt look different ways, it’s a great way to get a head start. And there’s also a video podcast on railscast.com, it’s episode 308, it’s like a 10 minute introduction to oh-my-zsh and ZSH, so if you just want a little more detail, if you just want to kind of have a sneak preview of what all this looks like it’s worth checking out that episode of Rails Cast.
So there you go, I think I’ve spoken enough for all of the episodes that I’ve missed.
Louis: That really brought the thunder.
Kevin: I’m caught up on my spotlights.
Louis: Awesome. So the last thing I wanted to do, we do have a few digital copies of your new book to give away.
Kevin: Alright, we’ve got giveaways!
Louis: We’ve got giveaways.
Kevin: For those who stuck around and listened all the way to the end.
Louis: We have five copies to give away, so what you should do is email firstname.lastname@example.org with a PHP: Novice to Ninja in the subject line, and the first five people to email after the show goes live I will reply with a free discount code that entitles you to 100% off the price of a digital edition of Kevin’s new book.
Kevin: Great. So these are gonna go fast, I suppose if it’s past the second week of May it’s probably not worth writing in.
Louis: Uh, that’s probably true (laughter).
Kevin: May 2012.
Louis: Yeah, if anyone’s hearing about this in the future, I forget these things just stick around; I don’t want to keep getting these emails for the rest of my natural life. Yeah, so if you want a free digital copy, so that includes the pdf, the e-pub and the Moby versions, and I will be happy to send those along to you.
So, thanks so much, Kev, for taking the time to drop by the office and visit not only Alex’s menagerie, but also us here on the SitePoint Podcast.
Kevin: It was a privilege, thank you.
Louis: And thanks for listening to this week’s episode of the SitePoint Podcast. I’d love to hear what you thought about today’s show, so if you have any thoughts or suggestions just go to sitepoint.com/podcast and you can leave a comment on today’s episode, you can also get any of our previous episodes to download or subscribe to get the show automatically. You can follow SitePoint on Twitter @sitepointdotcom, that’s sitepoint d-o-t-c-o-m, and you can follow me on Twitter @rssaddict.
The show this week was produced by Karn Broad, and I’m Louis Simoneau, thanks for listening and bye for now.
Theme music by Mike Mella.
Thanks for listening! Feel free to let us know how we’re doing, or to continue the discussion, using the comments field below.