Visit our site to listen to past episodes, learn more about us, and support the show.
Summary
We got the opportunity to speak with Al Sweigart about his work on books like ‘Automate The Boring Stuff With Python’ and ‘Invent With Python’. We discussed how Python can be useful to people who don’t work as software engineers, why coding literacy is important for the general populace and how that will affect the ways in which we interact with software.
Brief Introduction
- Hello and welcome to Podcast.__init__, the podcast about Python and the people who make it great.
- Subscribe on iTunes, Stitcher, TuneIn or RSS
- Follow us on Twitter or Google+
- Give us feedback! Leave a review on iTunes, Tweet to us, send us an email or leave us a message on Google+
- I would like to thank everyone who has donated to the show. Your contributions help us make the show sustainable. For details on how to support the show you can visit our site at
- We are recording today on July 27th, 2015 and your hosts as usual are Tobias Macey and Chris Patti
- Today we are interviewing Al Sweigart about Python for non-programmers
Interview with Al Sweigert
- Introductions
- How did you get introduced to Python?
- Started in PHP/Perl, introduced to Python in 2006
- Lack of curly braces took some getting used to
- Clarity of standard library was refreshing
- What inspired you to start writing books for non-programmers?
- Friend who took care of 10 year old interested in programming
- Lack of coherent introductory material
- Started writing a tutorial which grew to book length
- All books published under Creative Commons license
- You have written a few books about teaching Python to people who have never programmed, can you share your thoughts on the best order in which to introduce the various aspects of programming?
- Blog post driven development – http://blog.estimote.com/post/119525082855/user-stories-on-steroids-how-estimote-uses-blog?utm_source=rss&utm_medium=rss
- Where does software testing come in when teaching new coders how to program?
- Use the logger, debugger, and assertions effectively
- In invent with Python you use games as the vehicle to discuss the principles involved with writing code. What is it about computer games that makes them so popular as a means to introduce programming to newcomers?
- Something everyone is familiar with
- Easy to make a simple game to get started
- Good way to get creative with programming
- For automate the boring stuff with Python you focused on explaining how programming can be useful even if it is not someone’s occupation. How did you determine which kinds of activities to focus on for the book?
- Got the idea at a meetup talking to someone who works in an office doing repetitive tasks
- A lot of office jobs that involve tedious computer work which could be automated
- What are your thoughts on the need for software literacy among the general population?
- How much programming knowledge do you think is sufficient for a member of our modern society?
- You also wrote about using Python to decrypt simple ciphers as a means to learn about code. What was the inspiration for this approach to software education?
- One of the projects in invent with Python was a simple cypher, inspired further interest in the subject
- In episode 7 with Jacob Kaplan-Moss we talked about how we define what a programmer is. Can you share your opinions on what separates someone who can understand code from someone who is a programmer?
- Barriers to entry have been significantly lowered, making the distinction very fuzzy
- Definition of programmer is becoming much wider
- Books available at:
Picks
- Tobias
- Chris
- Al
Keep In Touch
Hello, and welcome to podcast.init, the podcast about Python and the people who make it great. You can subscribe to our show on iTunes, Stitcher, or TuneIn Radio, or you can add our RSS feed to your podcatcher of choice. You can also follow us on Twitter or Google plus with links in the show notes. Please give us feedback. You can leave a review on iTunes. You can send us a tweet, send us an email, or leave us a message on Google plus I would like to thank everyone who has donated to the show. Your contributions help us make the show sustainable. For details on how to support the show, you can visit our site at pythonpodcast.com.
We are recording today on July 27, 2015, and your hosts, as usual, are Tobias Macy and Chris Patti. Today, we are interviewing Al Swigert about Python for non programmers. Al, could you please introduce yourself?
[00:01:04] Unknown:
Hi. I'm Al. I've written 4 programming books, all covering Python, the latest, which just came out a couple months ago called Automate the Boring Stuff with Python.
[00:01:15] Unknown:
That's great. So how did you get introduced to Python?
[00:01:18] Unknown:
I think this was about probably around 2,005, 2,006. At the time, I had mostly programmed in either PHP or Perl, and so somebody recommended, like, hey. You should check out this language, Python. And I took a look at it. And the I remember the significant white space was just the most bizarre thing, like a language that didn't have curly braces. I thought, like, oh, I'm never gonna get used to this. But now I really wish that every language, use that instead of braces. But, yeah, I think my first software development job after that, was using Java and then a little bit of c plus plus as well, but I always use Python just as my go to scripting language. Whenever I just need to write some throwaway code to just automatically do something real quick, I found that Python was just really easy to use, and it was it was a language where I could keep all the standard module stuff in my head. You know, In Java, whenever I have to open up a file, I always have to consult the documentation to figure out, oh, do I need file buffer input or input file object or whatever that is? But, I mean, Python was just really easy to use and much more readable than Perl and PHP were.
[00:02:29] Unknown:
Yeah. That's definitely something I struggled with tremendously as well when I did my time working in PHP is I definitely having started out largely scripting in Ruby, I definitely felt the fact that Python had these nonobject oriented APIs because the language started out as a nonobject oriented language. So you're sitting there typing out like file dash get dash contents, and it's like, this just so wants to be file dot open or something like that. So so I definitely definitely sympathize there. So it's interesting that you said you started out in around 2,005.
[00:03:06] Unknown:
Well, I had learned to program early on as a as a kid in QBasic, but I never really done all that much with it until about high school or college area or started just playing around with with other languages. But, I was sort of, I think Python and probably towards the end of college was when I started actually feeling pretty secure in writing code and writing software.
[00:03:32] Unknown:
Yeah. Going back to your statement about the standard library and it being able to fit into your head better, I've had much the same experience where all of the included batteries just make much more syntactic and semantic sense than some of the other standard libraries and other languages that I've used. Java is definitely 1 of the worst offenders because of its incredible verbosity.
[00:03:53] Unknown:
It's horrible for a beginner just to be faced with public static void main args. No string args bracket brackets. Right. And it's just, like, oh, just memorize this. You'll figure out what all this means later.
[00:04:06] Unknown:
So what inspired you to start writing books for nonprogrammers?
[00:04:09] Unknown:
It was a complete accident, actually. I had a friend who was a nanny for this pretty precocious 10 year old, and he wanted to learn how to program. So I started checking online and looked at some resources. And, you know, there's a lot of information on the web, but it's not really tied together very coherently. It's it's not like you can just say, oh, read this part of this website, and then go through this tutorial. And a lot of it is made for professional software engineers, or a lot of it just sort of talks about programming. And so I thought back to when I had first learned how to program. I think this was about the 3rd or 4th grade, and it was this 1 book more than anything else that had introduced me to programming. And it just, it had all these small little games programmed in BASIC. And I don't even think I really read through much of the book. I just sort of copied the source code out and then just started fiddling around with it. And so I just remember that book. I thought, well, that's great. You know, there should be something like that where you can actually see the code rather than just read about all these abstract programming concepts, and then you're left on your own to put something, together. So I started writing this tutorial, which sort of ballooned up into book length.
And, eventually, I I somebody recommended, like, yeah, why don't you just self publish this? And so I had thrown it up online for free and then started selling print copies of of the book. And people seemed to really like that, so I wrote a second book. And people seemed to like that, so I wrote a third book. And that was all just sort of in my own spare time. And for the 4th book, automate the boring stuff with Python, I I contacted No Starch Press, and we arranged for them to publish it, which has really worked out great. And about a year ago, I left my job as a software developer to write the book full time.
[00:05:54] Unknown:
That's definitely really nice being able to have that level of support and freedom to dedicate your time specifically to a project like that and have confidence that it's actually going to be able to support you enough that you can take a hiatus or even leave a full time position like that. So do you have you regretted that move at all? And are you planning to write more books along this vein?
[00:06:17] Unknown:
Not not really at all. So I'd been working at this company for about 5 years, and and I liked it. But it was sort of reaching a sort of plateau Mhmm. Moment. And I had a lot in savings, and I thought, well, you know, I'd been working, you know, 9 to 5 programmer jobs for a while, so I had a lot saved up. And I thought, well, now's about the time I should start taking risks on things because I had enough experience, but I also still have a lot of energy and and a lot of ambition to to pursue this. So I thought, you know, this could be something, and, unfortunately, you know, getting a a new software developer job, if this all completely collapsed, It wouldn't be that difficult, here in San Francisco. But the book seems to be doing pretty well, and I'm currently making an online course that will follow along with the book itself.
And then after that, I'm currently considering 2 other books, which may or may not happen.
[00:07:09] Unknown:
Having the online material definitely seems like it would be a really good accompaniment to the book itself, particularly given the target audience and material that the book covers, having something where people can just read the book and at the same time jump online and have something already live and partially set up for them that they can tinker with. It really removes the initial, inertia associated with trying to set up their environment or trying to get their computer configured in such a way that they can actually try out some of the projects in the book. And then once they overcome that initial inertia, they're more inspired and more driven to actually put in the time to get their computer to a state where they can easily write new projects or experiment with new
[00:07:53] Unknown:
things? Oh, most definitely. So all of my books, including Automate, have been published under Creative Commons licenses. So you can download all of them online in full. And so I thought, well, it'd be great if I had videos alongside with the book to accompany it. And most of the time, the videos are just me sitting at the the interactive shell in idle, which is another great reason why Python is so approachable for beginners. It comes with its own IDE with a nice graphical interface and so it's a lot easier to set up and really all the videos are just sort of me typing out these commands and showing that, you know, it's really just a matter of playing around with things inside the interactive shell and learning what different functions do and what different statements do.
[00:08:35] Unknown:
So after having written all these books about teaching Python to people who've never programmed before, can you share your thoughts on the best order in which to introduce the various aspects of programming and which things should get introduced first to have the most effectiveness and best support the student?
[00:08:51] Unknown:
I actually I did draw up a list of things that I really wouldn't want to start off any beginner with when they're when they're introducing programming concept. I noticed that a lot of geek friends of mine who are software developers were really great at their jobs and at programming, but really terrible at explaining to complete beginners. So, you know, they would immediately wanna launch into things like object oriented programming or recursion or just all these abstract ideas. And so I always say, you know, if you if there's some concept that you're explaining that sounds like it would be in a job interview question for Google, then it's probably not something that people really need to know about. Just really starting off with basic concepts of these are variables and these are values and you have loops, and if else, and then you can call these functions, and then just sort of light dabbling of the standard library for for whatever language you're you're talking about is really a great start. And then trying to actually create as much sample code for them to see, you know, programs that are at most 30 or 50 lines long. And just so that they can see, you know, we've taken all these concepts, and now we're actually applying it. This is what it looks like in an actual program. I think that part is self, just allowing people to actually see what code does inside of a program and how all these concepts come together is much more helpful than sort of giving a, computer science freshman course, I guess.
[00:10:16] Unknown:
Yeah. Having been in the situation of trying to explain different aspects of programming and software engineering to various nontechnical people or even people who are somewhat technical but still very new to programming. I can definitely appreciate the difficulties of trying to pick the best approach for introducing the various concepts and just discussing them because having been working in programming for a number of years now, it can be very hard to bring yourself back to the level of a newcomer and thinking, okay, what did I not know at this point? What do I need to introduce them to? Right. Yeah. You you really you forget how hard it is and what you didn't know when you first started off. I was taking an online Coursera course, or maybe it was 1 of the other online course sites for cryptography,
[00:11:01] Unknown:
and it was a very sort of math heavy course, but I kept taking it because I was really interested in the topic. And I noticed, you know, it would take I would I would watch a 20 minute video and sort of have to spend an hour and a half just rewinding and rewatching it and then going through. And I found really it was the notation, all the math notation that completely threw me and and made it seem so mysterious. And once I actually understood the concepts, I kept thinking like, well, you know, if you just didn't use the math notation or you at least you explained what every little part of of the notation meant, it would have been a lot easier to to pick up on things. So when beginners start programming and if you start throwing all this jargon and all these technical terms at them, they'll sort of instantly just get swamped and confused, and it's a lot more frustrating than it has to be.
[00:11:50] Unknown:
Yeah. Definitely. And during our conversation with, Alan Downey, he brought up a very good point about learning statistics and how all the mathematical notation can get in the way of that and how he has found that by approaching it from more of a code and programming perspective, it becomes much easier to grasp the concepts that underlie all the different mathematics. And then from there, it gives you a better launching off point to comprehend what the various symbols actually are once you understand what they're trying to represent.
[00:12:22] Unknown:
Oh, yeah. Because the the notation and all those symbols are just sort of a shortcut for for all these concepts that are really abstract and heavy. But if you're already a mathematician or you're already a programmer, you already know what they represent, so you don't wanna have to be very verbose about it. But if you're a complete beginner, then then these shortcuts are just sort of, like, I have no idea what they mean by that.
[00:12:45] Unknown:
Yeah. I think that your approach in automate the boring stuff of relating the different projects to real world needs and pains that people experience. It gives a good tie in and a good connection to people to understand why they should actually care about programming at all.
[00:13:03] Unknown:
I also think with regards to the idea of trying to go back, figure out what you don't know, I mean, I think that's a useful skill for anybody in our field to to try to bone up on. Because even when you're writing things like documentation and things of that nature, we all have to do that. Right? We all have to put ourselves in the place of someone who knows nothing and is coming at this trying to make use of what we've built.
[00:13:27] Unknown:
Yeah. Yeah. Documentation is is often just sort of reserved for that last thing that you do after you've written the software, but, just sort of like how test driven development puts writing unit tests at the front. Really writing documentation is a great way to actually figure out what is this software going to do, and how are people going to use it. And also just writing documentation, keeping in mind that people are going to be using this as the sole resource, and they don't know anything that isn't written down, just sort of like that saying that doctors have that, you know, it's not written down. It didn't happen. Just being a lot more adamant about documenting and keeping that new mind in your own mind and just having that perspective really helps.
[00:14:10] Unknown:
Yeah. There's an interesting article I read a little while ago, by the folks at Estimate called blog post driven development, and I'll put the link in the show notes. But they were talking about how because their team they work in sort of a service oriented approach and each team has their own service they work on. Before they implement a new feature, what they do is they will figure out the blog post that is announcing the new feature so that they can use that as a way to figure out, okay. What are the various components that are involved in this new feature, and how can we, as a team, comprehend and get a really solid common understanding of what it is that we need to do. And I thought that was a really novel approach to the idea of requirements gathering.
[00:14:52] Unknown:
That's that's actually a really great idea. I mean, I've been a software developer for several years. And while I still think programming is cool and, you know, fun and everything, at this point, I'm a lot more concerned with I really wanna create software that people use as opposed to just sitting down and writing code and and having that idea of just, oh, what would the blog post announcement for this look like, and why is this product really great, or who would use this software is? I think, that's a really brilliant way to go about
[00:15:19] Unknown:
it. Absolutely. And I think that kind of mind hack, right, where you sort of force yourself to change your perspective which is not an easy thing for human brains to do because we are giant context machines when push comes to shove, especially in our line of work. So that's definitely a great idea. So leading from your last mention of unit tests and test driven development, I I was wondering, where does software testing come in when teaching new coders how to program?
[00:15:48] Unknown:
For the most part, I I sort of leave it out. I don't really in the automate book, I don't really cover the unit test module at all, but I do have an entire chapter devoted to debugging and also using Python's assertions and its logging module and also just sort of having that warning of, you know, don't use print function calls for debugging instead use the actual logging and just because of all the hassles of, you know, once you're done debugging, then you have to start removing all these print function calls. And it's a lot harder to find all of them and you might miss some and it's really a lot of tedious work the same thing goes for just learning how to use the debug the debugger it's sort of a slight intimidation for for some new people because it seems like this really complicated programmers tool. But really, using the debugger is is a lot better than just, you know, making minor changes to the code and rerunning it and then making another tiny change and rerunning it. But just stepping through once, line by line and figuring out what's going on with your code.
I think a lot of programmers find that that soon pays off.
[00:16:53] Unknown:
And I really actually am glad you mentioned your coverage of logging because as I was reading the book, it that is 1 thing that definitely occurred to me is when I first encountered the logging module and I started to use it, and I said to myself, wow, this is actually really simple and this ability even just to have different log levels. So you can log dot debug to your heart's content and, you know, then when it comes time to actually ship just at the log level to info and away you go, that is that is a hugely powerful abstraction that buys you a lot with very little outlay in terms of
[00:17:29] Unknown:
effort. Oh, yeah. It's definitely, 1 reason yet another reason that Python is so great for beginners is that, you know, the logging module is just 2 lines of code to get it set up, just import logging and then calling basic config. And then you don't even have to learn about all the different logging levels or or anything like that. You can just know, oh, okay. Call logging dot debug and pass it a string, and you're completely set up from there. And then later on, you can add a logging dot disable call just to cut out all the logging when you're when you're finally done debugging your code. And, you know, just, having something that, you know, you can have it set up in 2 lines of code is is really great for beginners.
I'm not really sure if it was much more complicated than that, if I would even want to include it in a book for beginners, but Python just really makes that possible.
[00:18:15] Unknown:
Yeah. And also the variety of additional handlers that they provide and also some of the other third party logging libraries that are available really increases the amount of power that is available, such as, you know, right in the standard library, there's the ability to have a logger that will send you emails. So that, for instance, you can say, I'm gonna register this handler with a level of exception so that whenever an exception gets fired, it'll send me an email. But everything else, it will just log to standard out. So just having having that ability to multiplex the messages to the various points where they're needed depending on what's actually happening in the program is pretty powerful as well.
[00:18:53] Unknown:
Talking about the sort of ease of adoption, I think that's definitely an example of a really beautifully, you know, designed very Pythonic API. Right? You compare and contrast that against something like Log 4J or 1 of the other more popular Java loggers and, you know, which involve a tremendous amount of configuration just to get going. It's definitely it definitely showcases the not only Python, the technology, but the kind of the gestalt in terms of how it was built and and and designed.
[00:19:23] Unknown:
So shifting the direction a little bit, in Invent with Python, you used games as the vehicle to discuss the principles involved with writing code. What is it about computer games that makes them so popular as a means to introduce programming to newcomers?
[00:19:36] Unknown:
Oh, I think it's it's the perfect, gateway drug into programming, just because, in this day and age, everybody plays video games. You know, a couple decades ago is sort of a nerdy thing to do, but now it's really caught on where you can just get on a city bus and you'll find people playing Candy Crush on their phone or or something like that. So games are something that everybody has familiarity with, and, also, a lot of games are are pretty simple. You know, even something like Tetris might be a mid level game, but you could really make a simple game just like Hangman or Tic Tac Toe or something in less than a like 50 or a 100 lines of code so that's the approach that I took with invent your own computer games with Python book was I just came up with a whole bunch of different tiny little games I think the largest 1 is is 200 lines of code And just try to keep it as the code as simple as possible, but show that it really is possible to create something that's, you know, not going to be, you know, a triple a title that you'll sell for $50 or anything, but it will be something. And you can sit down and create this in an afternoon and then figure out how it works, and then maybe just go on with additional projects later. Other than games, I really don't have any idea how I would go about introducing people to to software if it was just like a hobby that they had. I mean, games are just instantly fun, and it's it's also a great way to flex your creative muscles with programming and and give you an an idea of why you should sit down and learn all these abstract programming concepts and seeing how they can go into a final product that you have, even if it's just something as simple as as, you know, creating Hangman.
[00:21:16] Unknown:
As in everything with engineering, you can either go very simple and straightforward, or you can go the clever route and try and see, okay. Well, how can I maybe do this in a different way that uses fewer lines of code but is more efficient, for instance, or just use a completely different programming paradigm as a way to get the same results? And it's a good way to experiment and see how doing different things can either get you the same results or get you different or possibly better results.
[00:21:43] Unknown:
Oh, yeah. Definitely. And and also, you know, anybody could just, start off with, you know, calculating Fibonacci numbers or or something like that. But, I feel like using these game projects afterwards, you have something that's really simple, but you really take a certain pride in it because it's something that you created.
[00:22:00] Unknown:
Yeah. And I think too with games, particularly graphical games, it gives you something to show somebody else where you can say, hey. Look at this thing that I built. Whereas if you're just doing something that only you're only interacting with the shell prompt, you show it to somebody else and they're like, yeah. I don't get it. But with a game, they have something they could say, oh, wow. I could actually use this.
[00:22:21] Unknown:
Yeah. Yeah. Definitely.
[00:22:23] Unknown:
In your automate the boring stuff book, you focused on explaining how programming can be useful even if it's not someone's occupation. How did you determine which kinds of activities to focus on for the book?
[00:22:33] Unknown:
Well, originally, I got the idea for for the concept. I think it was at some Python meetup, and I was talking to somebody who said that they weren't a software developer. They just worked in an office, and part of their job was to go to the Yahoo Finance web page, and then copy and paste some numbers and then paste that into an into an Excel spreadsheet. And this would take up about 2 hours of their morning, they would have to do this every day. And eventually, they just, fit taught themselves enough Python and all these different modules to just write a script to do that, And now I I don't think they actually told anybody else that they had this script now doing their job for them. They just started taking an extra long lunch every day. But, it so that started making me think, you know, there's a lot of office jobs where using a PC or a laptop or or whatever is the central tool that you have, and a lot of the times this involves just checking emails or going through a lot of PDFs or updating spreadsheets or visiting websites.
And there's a lot of tasks that I would hear from my friends who would say, yeah, you know, today at the office, I spent, you know, 5 hours going through these 2,000 PDFs, and I'm still not done. And this is this really irritating task that I have to do, and I'm thinking, well, actually, you know, if you know a little bit of programming, you can write some small script that will just automate this task for you. And and these are tasks that, you know, you won't find any professional software made for because they're so particular to some workflow for your organization or your department. But, really, I mean, what you just need is, like, a small shell script or or something like that. And so I thought, well, Python's a really great language for beginners.
And so I started looking into all these different modules that were available and just started thinking about what what would non programmers need from programming. And so at the top of that list was just sort of, web scraping was 1, Excel spreadsheets was another, being able to go through and pick out text from a PDF or a Word doc was another. And so I thought, like, okay. So the the basic structure of automate the boring stuff with Python is that part 1 is just a very quick basic programming tutorial to sort of teach you, you know, variables and loops and things like that. And then the part 2 of the book, each chapter just goes into a usually, it just covers a different module, say, OpenPyXL for modifying Excel spreadsheets or, Selenium and Requests and Beautiful Soup for web scraping and just basically looking at all these modules that have already been written. And you don't need to know how they work, you just need to know their APIs and how to use them, and you can get a lot of really productive work done, by writing small scripts. So Automate the Boring Stuff with Python is is sort of a programming book for people who don't really wanna become software engineers or computer scientists.
Although if you're a complete beginner and you might wanna go down that path, it's, you know, pretty good first step for for that as well. Just I know as a programmer myself, I'm often writing small scripts that just move a bunch of files around on my hard drive or or just tiny scripts that automate tiny little tasks like this. But I really I thought, you know, as everybody is getting more and more connected and using a having a computer is is something that is an everyday occurrence for a lot of people, unlike 20 or 30 years ago when PCs were first coming out.
So I thought, oh, okay. Now is is a pretty good time for people to start learning programming.
[00:26:07] Unknown:
Yeah. So that leads me into my next question of that which is, what are your thoughts on the need for software literacy among the general population? And how much programming knowledge do you think is sufficient for a member of our modern society?
[00:26:19] Unknown:
I mean, it's it's still entirely possible that you can go through life just sort of checking email and looking up stuff on Google and, talking with people on Facebook. But I really think that being able to learn how to code and even at a at a small basic part, not even knowing how to be a software engineer or all the skills that go along with that, But just being able to write tiny scripts really opens the door for a lot of other tasks that you didn't really think were possible before. I know a lot of friends who who's just sort of go to a website, and they're constantly clicking refresh just over and over checking for some change, or having some other, task where they're sorting through tons of vacation photos for some particular, criteria, and they're just sorting it based on something else. And I thought, like, well, you know, it's you know, they don't have to become startup entrepreneurs and, like, ninja rock star hackers or anything like that, but having a little bit of coding knowledge would actually really help. And programming isn't as complicated and as tough as as a lot of people think it is. So having a slight amount of programming knowledge is I think it'd be, you know, something that's useful sort of on the same level as, like, driving a car is useful or or any other small skill. That's that's the the first idea I have. And then I have a second much more ambitious idea where I really would like everybody to learn how to code and sort of become software developers so that we could sort of just get rid of the concept of apps altogether. Since a lot of times, you know, like, for something like Facebook, Facebook is really just a nice interface for Facebook's database and all these services.
And while we wouldn't completely replace apps with APIs and, you know, you wouldn't wanna reinvent the Facebook app, There's a lot of times when you would have some idea of, like, oh, it'd be great if I could grab this information from Facebook and then grab this information from other services, and create these new tools, and new ways of communicating with other people. So being able to go from this sort of walled off garden where a lot of sites just never open up their APIs to the public, if we had enough people with programming skill where it seems completely like the obvious thing to do once you start launching your new website or your new web app and just having an API so that not only can humans with web browsers interact with them, but also humans with Python interactive shell, or or just small programs can also interact with them. I think that'd be a wonderful idea. That might be a little too ambitious, but, you know, it's it's a it's a happy thought that I have.
[00:28:56] Unknown:
Yeah. And, also, even just having an understanding of the different elements that are involved in programming can be very useful. Even if somebody doesn't actually know how to write a program, just understanding some of the concepts behind the programs that they use every day can really give them a greater appreciation for how it functions and why it functions in a given way and what the limitations might be. Because I know that a lot of times people will think, oh, you know, you could do all these magical things with software. So, well, why can't it do this 1 little thing that I want it to do? And having a better understanding of, you know, the data structures and just some of the processes involved will give them a greater understanding and appreciation for the amount of work that actually is involved in creating these things that they use every day and why this little feature that they want might not be as little as they think it is.
[00:29:49] Unknown:
Oh, yeah. Definitely. There's an x kcd comic about this, just like there's an x kcd comic about everything. But, there's an x kcd comic where, like, project manager is talking with a software developer and saying, like, okay. We want this phone app to determine if they're in a state park, and the software developer says, like, okay. Yeah. That's fine. We'll just take GPS coordinates, and then, we'll have a map. And we just do some geometry, and that's really easy. I can have that done in an afternoon. And then the project manager says, oh, we'd also like them to be able to take a picture of a bird and have the app identify what species of bird that is. And the software developer says, I'll need $20,000,000 and a team of 5 scientists for 8 years to do that.
So just just having an idea of what's possible with programming and what's still sort of in the realm of science fiction or or just super sophistication is would be a a good thing to have an awareness of in general.
[00:30:44] Unknown:
I just wanted to say 1 thing real quick about your dream of people being able to write little programs that do what they need and even ideally expose them as web APIs. I feel like the tools are making that easier and easier. Things like Eve and, you know, all these really great client side tools for testing rest APIs. I feel like the infrastructure like, there was this kind of revolution a few years ago where everybody just kinda all up at once said, you know, XML XML RPC and SOAP are okay, but REST is really what we wanna use. And I feel like the infrastructure has been building ever since, and it's getting easier and easier all the time to both create and consume rest APIs.
So I think we may be actually closer and closer to achieving that dream every day.
[00:31:34] Unknown:
Oh, certainly. And and, also, if you just go back 200 years, the idea of regular literacy, you know, just being able to read and write for everybody, seems like a pretty far fetched concept. But today Yeah. In developed nations, you know, you have 99 or a percent, literacy rates. So, you know, the idea of everybody learning to code, might not be that far fetched, although I probably shouldn't try to predict the future. I remember in, like, 1999 or something like that, I heard that everybody in Japan had a cell phone that also had a camera on it, and I thought, why would you want a camera on your cell phone?
[00:32:09] Unknown:
Why would you want your cell phone to do anything other than make calls, and now people don't even use it for that? Right.
[00:32:15] Unknown:
Exactly. Although, it seems like your skepticism might have been a little bit prescient because now people are saying, gee. Was it really such a good idea that my cell phone now has a camera on it?
[00:32:25] Unknown:
Right. Because now how do I know when it's on when I don't want it to be?
[00:32:29] Unknown:
Oh, yes. And I've done this for a while now, but I actually have a little piece of black electrical tape over the webcam on that's built into my laptop. And I I thought I was being a bit paranoid and well, and then snow didn't happen. So now I kind of feel like, maybe I'm not being that paranoid about that.
[00:32:45] Unknown:
Not at all. Especially since nowadays, honest to God, aside you know, NSA aside, there are documented cases of malware authors activating the webcams of the their targets.
[00:32:56] Unknown:
So it's definitely a thing. I mean, it is not in the realm of tinfoil hat paranoia anymore. It's been proven. There is also a story not too long ago about a school district who provided laptops to their students. And 1 of the administrators for those laptops was remotely activating the cameras so that they could spy on students in their homes.
[00:33:15] Unknown:
There there was a student who was called in because, it looked like they were taking drugs, and that then came up with the obvious question of, well, how did you know this? And it's like, well, we saw them taking pills on their webcam, at home, which then leads to all sorts of questions, but certainly just privacy issues and and the fact that we're putting so much of our life online. You know, our our phones can effectively be GPS tracking devices that we dutifully carry around with us. And whenever their battery gets low, we just recharge it for whoever, would have malware running on them. So so it's, something to to definitely be aware of.
[00:33:53] Unknown:
So along the same vein of security and privacy, you also wrote a book about using Python to decrypt and crack simple ciphers as a means to learn about code. What was the inspiration for that approach to software education?
[00:34:06] Unknown:
So in the, invent with invent your own computer games with Python book, I had 1 program that was this really simple Caesar cipher program, and I thought, like, wow, there's actually a a lot more you could do with that in just writing code that could break those ciphers. So, eventually, I just piled all of that, content into a separate book. And I noticed that there were a lot of a lot of books on cryptography and a lot of books on cryptography for kids, but not necessarily a lot of books about breaking crypto. And and when I say that, I mean, these are all classical ciphers from before World War 2, where most of the time it didn't even matter if you encrypted your your message because a lot of people weren't literate anyway. But for things like Caesar cipher or the Vigenere cipher from the, I think, 16th century up to the 19th century, these are things now that anybody with a laptop could actually crack because the numbers, the amount of number crunching you have to do isn't really that astronomical anymore for anybody with a computer.
So I thought it'd be great if there was a book about not just cryptography and not just about code breaking, but also a book that showed you how to write programs to do the code breaking for you. And it turned out to be an enough content to fill about, I think, 400 pages of of book and just going through all these various ciphers, throughout history and then having a follow-up chapter of, like, and here's how to write a program that can go through and do a bunch of number crunching and break these ciphers. So I thought that would be a lot of fun. So that's where hacking secret ciphers with Python came about.
[00:35:43] Unknown:
So switching gears again a little bit, in episode 7 of our podcast, we talked with Jacob Kaplan Moss of the Django project about how we define what a programmer is. Can you share your opinions on what separates someone who can understand code from someone who is a programmer?
[00:35:59] Unknown:
Oh, I I don't actually think I I really know what the defining line for that is, especially because a lot of the barriers to entry for programming have just been significantly lowered. I mean, it's really easy, and there's lots of of resources out there for people to just start up and, start playing around with code. Certainly, if you get a job as a software developer, you can say, I am a programmer. But at the same time, there's a lot of people who aren't getting jobs as software engineers. Maybe they're research scientists or statisticians or people who are writing code and writing programs, but they don't necessarily think of of themselves as programmers.
Actually, I think Jacob himself talked about a story, where he was, talking with somebody who had written this elaborate, software system to do a bunch of work in her lab, and but she still didn't really consider herself a programmer. So, I mean, along with just lowering the barriers to entry to programming, I think the the definition for programmer is getting a lot wider. I think I feel like certainly if you write any sort of software configuration that can make some sort of intelligent decision, like some sort of if else decision making process and just knowing how to take the behavior you want and transcribing that into code or instructions that the computer understand, I'd go ahead and say that, yeah, at that point, you're definitely a programmer.
[00:37:24] Unknown:
Is there anything that we didn't ask you about that you think we should have or anything that you want to add before we move on to the picks? Oh, yeah. So earlier, I I mentioned that, all my books are available under Creative Commons licenses for free to download. So
[00:37:39] Unknown:
the automate the boring stuff with Python book is available at automate the boring stuff dot com, and my other books are available at inventwithpython.com.
[00:37:49] Unknown:
That's great. That's a really good movement that I've seen lately of people having a print book that you can purchase and then also making an online version available for free just as a way to make knowledge more accessible for people who are interested in it. And Alan Downey, who we spoke with a few episodes ago, had a very had the same approach and talked about how he was very surprised and taken aback at some of the different ways that people made use of the content that he produced and translated it into different languages, both computer and spoken. So having those books available through Creative Commons just is is a really great thing to do.
[00:38:29] Unknown:
So releasing these books, under Creative Commons has has also made financial sense as as well as just sort of being a nice, you know, making them freely available gesture. Because I really feel like if I had self published my first few books and just only had them available as for pay print books, they would have just sat on Amazon's website completely unused, and nobody would have really heard of them. So, actually, having people be able to read them online, I'm still surprised that a lot of people were buying the print books just because they still want a print book to have in their hands. And really, for the most part, I'm not really concerned with pirating these books or, you know, people just copying these books without sort of any financial, service to me because it's really great word-of-mouth. And, really, it's I feel like these days when you can get a a web host with, you know, several gigabytes of bandwidth every month, just more than you could possibly use, And, you know, you can get that for about $9 a month or something like that, I I think, is what I pay for my web host, and just make this resource available to thousands and thousands of people. That's such a powerful tool for for education and making information available that I really didn't wanna have a sort of paywall closing people off from that.
[00:39:47] Unknown:
Absolutely. And I also feel like there's another advantage to that in the sense that it also means that because you're making those books freely available, they're gonna be around on the web essentially forever. You know, when you think of people making cash copies and then being in other sort of, like, collections of free books and things. I think it means that you sort of kill the whole implicit black market in pirated versions of books, is a great example of that. There are some books that I think are absolutely fantastic like, I think it might be The Little Schemer or The Little Whisper or 1 of those guys. And you can't get an ebook version of it. Maybe I'm picking the wrong 1, but I know it's a Sussman book. And these are like computer science classics that everybody should read. And when I contacted the publisher and said, hey, guys, would you consider making this available because I think these are are classics and I'd be delighted to pay for them, like, please consider this. And the publisher is basically sitting on it because they they don't feel like it would sell enough copies to warrant it.
And that's just that's just a really sad thing to me to see great works of literature, of technical literature like that just be moldering away in some publishers' archives when pirated, you know, PDF scans of the paper book are floating around the Internet. It's just a shame and this totally cuts that off, nips that in the bud right away.
[00:41:10] Unknown:
Oh, yes. Definitely.
[00:41:12] Unknown:
I think with that, we will move on to the picks. So my first pick for today is a Python library called Logbook by Armin Roanekar, the author of Flask. And it's just a really great third party logging module that has a lot of extra niceties and makes it really easy to maintain context throughout an application. So for instance, I'm using it in a Flask application, and I have a before request hook that will populate the context of the log with the with a unique request ID and the browser and browser version and remote address of the person who is visiting the website as a way to tie together all the subsequent log messages happen throughout the various other modules within the app, and it just makes it really easy to get that up and running.
My next pick is the Emax psychotherapist. If you type medex doctor into Emax, it's just a really humorous and entertaining interactive prompt where it will just keep asking you psychoanalyst questions no matter what your responses are. And so you can just kind of play with it for a while and you know, take an amusing break from whatever you happen to be doing at the time. So definitely worth taking a look at and playing around with. My next pick is the movie Ex Machina. So along the same lines of Chappie, which I picked in the last episode, Ex Machina is another movie addressing the concept of artificial intelligence and what happens when we actually achieve a fully self aware and functional artificial intelligence in a robotic body.
And this takes a very different approach than Chappie does, more of the idea of how do we evaluate true consciousness and true self awareness through the guise of a Turing test. And it's just very well done movie, very cerebral, and very thought provoking, so definitely worth a watch. And my last pick is somewhat along the veins of what you were saying, Al, earlier about everything having an API and being accessible and people writing their own programs to get the information they want out of the various systems that we use. There's a book called Mining the Social Web, and it's exactly what you what it sounds like. It's just a book about how to interact with the various APIs for places like Twitter, Google plus LinkedIn, and extract meaning and useful information from them and perform different analyses to get to the answers that you're looking for. So definitely another book that's worth a read. And with that, I will let you take it away, Chris.
[00:44:03] Unknown:
Cool beans. So my first first pick is a screencast. Screencast have to be really good in order for me to invest the time in them. Not because there's anything wrong with screencast, they're great. But because for me, podcasts I can listen to while I'm working out or commuting or doing any number of things. But screencasts have to have my undivided attention. But I found 1 that makes that bar for me. It's called Emax Rocks. And it is a bunch of little like, you know, 3 minute screencasts, each showcasing a particular feature of eMax or a third party library that I just really enjoy. I really love the the format. The content is really good. He really like shows you something you didn't know, going in. And I hope he says that the series is on hiatus. I hope it's not dead. I may even, if I can get my act together, contribute an episode myself because I really love the screen cast. I think it's worth watching.
My next pick is another iOS app. This one's really exciting because, a ways back, I switched my blog from a WordPress instance with the really nice sort of canned clients that you can submit to your post from anywhere, including iOS, I switched to a static site generator, Pelican. And 1 of the things that I was really, you scratching my head over is I actually do blog from my iPad in a fairly, you know, not regularly basis, but from time to time. And I really like that capability. If I'm on vacation or something, I can still write a blog post if I want. But now there's a way.
My statically, generated Pelican blog is fed from GitHub, so I have everything set up automatically so that I just check the markdown into GitHub and the blog post happens on happens for me. And finally, there is a GitHub Git client or I should say a GitHub ready Git client for iOS. It's called working copy and it's really quite good. I mean, it has still has a couple of rough edges, but it's very very workable. You can do all the the usual, you know, GitHub things, check-in, check out merge, etcetera, etcetera, generate pull requests. And the interface is pretty reasonable and it also allows you to open files from GitHub in your editor of choice.
And so effectively, you know, you can go through your usual sort of like iterative release process of checking things into GitHub and seeing how they fly. It's it's really for a first effort and for something that to me was a huge gap in the iOS ecosystem, I think the folks who built this app deserve some kudos because it's really very, very well done. My next pick is something that a lot of people may have already used and already know about, but I just I really enjoy it so much. I feel like it's worth mentioning. And that's Feedly. I use this all the time because I obviously running the podcast and just for my general technology, I like to keep track of a number of, you know, blogs and and things of that nature, websites.
And Feedly just makes it effortless that the interface is really nice. There's great, you know, desktop, version for your browser. And the iOS version for both iPad and iPhone is superb. And it's just it's a really well designed, well thought through experience from end to end. I started using it when the much bemoaned Google Reader went away. And honestly, as far as I'm concerned, I don't miss Reader a bit. Feedly is superb. My last pick is Tom Collins. This is 1 of those drinks that a lot of people order, but I find that a lot of bars get wrong. And, so I would encourage you to either make your own. I found a recipe that I like and that I which I linked to in the show notes and or go to a really good bar that really knows how to make 1 and uses Old Tom sweet gin as as opposed to the regular dry gin when you're making them.
So, yeah, I think I think it can be a really it's a citrusy sort of great summertime drink, not overly heavy, you know, it's it's it's a really good refreshing refreshing drink and I recommend it. And that's it for me. Al, what do you have for us for picks?
[00:48:10] Unknown:
So my first pick is PyCon which is the Python programming languages conference, that they have annually. Python has a really great and supportive community, and PyCon is is a great way just to meet new people in that community. But what really struck me about PyCon is that it wasn't just Python, software engineers, but software engineers who had more experience with other languages and were just sort of checking out this Python thing. And also people who are just new to programming and wanted to find out what was out there. And so I really encourage a lot of people, even if you don't have a lot of experience with Python, to go ahead and and take a look at PyCon. I believe next year, it's going to be in Portland, Oregon, I think sometime around April, sometime around then.
So my next pick is the Selenium module for Python. I looked at the since since the automate the boring stuff with Python book is online, I can also get the analytics and see which, chapters people are looking at. And the web scraping chapter seems to be 1 of the most popular ones, and so Selenium is a module that will actually launch a web browser that you can then programmatically control. So from a Python script, you can have it, have links clicked on or you can fill out text fields and forms and submit them. You can log in to websites.
And so this is a really great tool just for automating browser tasks. A lot of people use Selenium just for automated testing of their web apps, but it's it's really great if you have some website that you wanna be able to log in into a specific account and then, automatically do a lot of different tasks there. Selenium is really surprisingly simple to use. I think there's probably about, like, 6 or 7 different functions that you'd have to look at, but you could certainly sit down and and learn it in, yeah, probably an hour or so of just playing around and and getting a good feel for everything. And my last pick is, Neal Stephenson's latest novel, 7 Eaves.
Neal Stephenson's the author of science fiction and cyberpunk novels, most notably Snow Crash and Cryptonomicon and The Baroque Cycle. So 7 Eaves is his latest novel. It so at the very start of the novel, the moon, for purposes that aren't really understood or ever explained, blows up, and it's shattered into these 7 large fragments. And it doesn't take long for scientists to, project that eventually these fragments are gonna keep colliding with each other and breaking up even more and eventually fall to the Earth and sterilize the surface of the planet. So the human race has about 2 years to get a space program up and running and picking the several thousand people who will then go up into space to continue the human species.
And it's it's a great work of hard science fiction. You can tell that a lot of the the space you know, things that the issues that come about with long term space habitation have been well researched. And but at the same time, the characters are really nice. It's the plot is is really gonna keep you on your edge. I basically read it all the way through. It's, you know, I think it's, like, 800 page novel or something like that, but I was really hooked with it, and I read it straight through in a weekend. So I really recommend it. It also has a character who is clearly based on Neil deGrasse Tyson, so that was a major selling point for me as well.
[00:51:40] Unknown:
Those are some pretty excellent picks, so I'm definitely gonna have to take a look at that 7 Eves book. It sounds very interesting. So for anybody who's interested in keeping in touch and following you and what you're up to, what would be the best way for them to do that?
[00:51:54] Unknown:
Probably the best way would be, to contact me on Twitter. It's at, Al Swigart. My last name is spelled s w e I g a r t, Or you can just email me at al@inventwithpython.com.
[00:52:08] Unknown:
Well, we really appreciate you taking the time out of your day to speak with us. It's been a really fun conversation, and I'm sure our audience is really gonna enjoy listening to it as well. So thank you very much, and I hope you enjoy the rest of your evening.
[00:52:21] Unknown:
Oh, thank you for having me.
Introduction and Host Details
Interview with Al Swigert
Writing Books for Non-Programmers
Teaching Programming Concepts
Debugging and Logging in Python
Using Games to Teach Programming
Automate the Boring Stuff with Python
Software Literacy and Programming Knowledge
Security and Privacy in Programming
Learning Cryptography Through Python
Defining a Programmer
Creative Commons and Free Knowledge
Picks and Recommendations