PyDev of the Week: David Kopec

This week we welcome David Kopec (@davekopec) as our PyDev of the Week! David is the author of Classic Computer Science Problems in Python from Manning, as well as several other books. He was even interviewed about his book by Talk Python! If you would like to see what open source projects he is working on, then you should head on over to Github. Now let’s take some time to get to know David!

Can you tell us a little about yourself (hobbies, education, etc)?

Before I start, I want to thank Mike for including me in this series. It’s an honor.

I’m an assistant professor in the Computer Science & Innovation program at Champlain College in beautiful Burlington, Vermont, USA. Before becoming a full time professor, I worked professionally as a software developer, and I’m still open to taking projects on a consulting basis. I have a bachelors degree in economics (minor in English) from Dartmouth College and a masters degree in computer science, also from Dartmouth.

I’m the author of three programming books: Dart for Absolute Beginners (Apress, 2014), Classic Computer Science Problems in Swift (Manning, 2018), and Classic Computer Science Problems in Python (Manning, 2019). However, I no longer recommend the Dart book because it’s very outdated. I’m also an active contributor to open source.

When I’m not working, I enjoy learning about American history, entrepreneurship, and keeping up with the world of computing (although that’s kind of my job too). I also have all the same hobbies that just about everyone has—cooking, traveling, film, reading (classics, biography, history, business dramas), television (Frasier & The Curse of Oak Island!), music, video games (Zelda & AOE2!), podcasts, stock trading, etc.

Why did you start using Python?

When I started graduate school at Dartmouth about a decade ago, I realized that many of my classes were in Python, so I thought: “I better get good at this language!” I really liked the language from the beginning, because of its succinctness and rich standard library. I appreciate how Python often closely resembles the pseudo-code you find in a textbook or you write on the board, but it’s not pseudo-code, it’s real-code.

I’ve used Python on-and-off for web development projects, and we teach several of our computer science courses at Champlain in Python.

What other programming languages do you know and which is your favorite?

It’s a long list because I started programming when I was eight years old and basically never stopped. Here are the languages I’ve actually used on non-trivial projects in the approximate chronological order of when I learned them: BASIC, Visual Basic, Java, C, Objective-C, PHP, JavaScript, Python, Ruby, Dart, and Swift. I’ve also learned in school, or learned in order to teach them: Scheme, Haskell, Assembly, and Go. And I’ve dabbled in Perl, C++, and Clojure.

It’s a fairly long list—I know. I guess I’m a bit of a language optimist, because the one I like best is often the one I’m really deep into using on a project. Well, if you asked me five years ago about my favorite, I would probably say Objective-C. However, today I don’t really have a favorite. My go-to languages right now are Swift for building Mac & iOS apps, Python for web or scripting work, and C for some of my hobby projects.

I know what I don’t like, though. And that’s C++. I begrudgingly started to learn some of the recent changes in C++ 11, 14, and 17 last week. And while they generally make the language a bit better, they also make the thing I dislike most about C++ worse—its size. It’s just such a big language with so many features that it’s hard to wrap your head around it when you’re not using it every day. I’ve heard it said that even people who write C++ professionally usually only use a subset of the language. I hope to never have the misfortune of writing C++ professionally, so hopefully I will never have to find out. All kidding aside though, it’s not my favorite language. But based on my prior history, maybe I’d start to like it more if I just wrote more of it!

One recent worry I’ve had is that perhaps I’m context switching languages too much. In my work, it’s not unusual for me to be answering student questions in Go, Swift, and Python during the day and then coming home and doing some of my own projects in C. The worry is that I’m no longer spending enough time in a single language to be fully realizing the benefits of mastery. Instead I’m trying to remember how to do something differently in one language than in another.

What projects are you working on now?

In my professional work, I have at least two projects over the summer. One is to translate the Android Development course I’ve been teaching the last three years from Java to Kotlin. Another is to revamp bits of a course I teach called Intro to Mobile & Web Development so that it has unit tests for many of the assignments. So, I’ll be learning yet another language—Kotlin.

In my open source work, me and my collaborator, Ferran, recently updated our graph data structure library, SwiftGraph, to version 3.0 with new features and support for Swift 5.

In my writing work. I’m spending some time promoting Classic Computer Science Problems in Python, which came out just a couple months ago. I’m also considering whether/when to start writing the next book in the Classic Computer Science Problems series. We’re considering either Java or Go for the next language in the series. I started writing a scifi novel, but I’m only 15 pages into it.

In my hobby development work, I should really update my Mac app for teaching young people programming in a Logo/BASIC like language, SeaTurtle, with some more tutorials and bug fixes. I’d love to publish a game too. I build prototypes sometimes, but I haven’t had an idea that I feel is so strong (and that I’m capable of doing myself to the end) that I’ve pursued it.

Which Python libraries are your favorite (core or 3rd party)?

As I mentioned before, I like a lot of the standard library. functools, collections, and json are some I use particularly often. But, I also love just how much first-party miscellaneous useful stuff there is. Everything from command-line parsing (argparse), to database mangling (sqlite3), to email handling (email), and even compression (zlib) is in there. I find that super handy. As far as third-party packages go, I’m a fan of Requests, Beautiful Soup, and scikit-learn.

How did you become an author?

All three of my books came about because I wrote proposals and pitched them to publishers. The first one, Dart for Absolute Beginners, happened because I was excited about the Dart language in 2012 when it was still in beta, and I thought—“gee, maybe my niche could be to write the first beginners book in this language for when it takes off.” Unfortunately, the language never did take off. Perhaps it is now “taking off” as a result of Flutter, but now that book is woefully outdated. I really liked the language, and I think Dart for Absolute Beginners was a great book. However, while it was well received by readers and reviewers, it never had a large amount of sales due to the total Dart market being quite small.

What it did do for me is establish credibility and launch me into the computer science education space. It helped me get jobs (including my current one), and it gave me the track record to get a book deal for my next book, Classic Computer Science Problems in Swift. That book, again, was positioned to target a niche. There were plenty of Swift books in 2016/2017 when I wrote it, but they were all about iOS development. My book was going to get on the wave of this up-and-coming language but fill the hole of CS education in this language. And I think it did that pretty well.

But, frankly, what I’ve learned with the early success of Classic Computer Science Problems in Python, is that (for sales success at least) it’s better to write a good niche book in a popular language, where there might be competitors, than write a good niche book in a fairly niche language. You don’t want to be a niche within a niche. That’s why choosing the language of the next book in the series is so hard. We ran a poll of Manning readers to see what language they would like next. Go and Java practically tied. Java is the Jupiter-sized language community that in many ways makes sense in the same way that Python made sense, but it seems like it’s past its prime. Go is still growing rapidly. But if Go is still not really as popular as Swift (which by many metrics it doesn’t appear to be)—then maybe Java still makes more sense right now. Originally I wanted to do Go and the publisher wanted to do Java. But now, I’m leaning towards Java too. And there is new stuff in the Java world—Java 9, 10, 11, and 12 have a few interesting new features.

What were some of the hardest things about writing your book?

One of the hardest things to deal with as an author or professor is that you are not a celebrity but you are still a public figure in the sense that people publicly review your work. Whether that be course reviews or book reviews. And many of those reviews will be accurate, and some of those reviews will be inaccurate. It’s often the people that hate or love your work most that will take the time to write a review. One weird thing is that Classic Computer Science Problems in Python has many good reviews on Twitter, on Manning.com, amongst official reviewers, but so far no Amazon reviews (at the time I’m writing this) despite being the best selling of my three books. That might be because it just came out two months ago. And I don’t want to get fake reviews. So many niche technical books have positive fake reviews, usually put there by the publisher. So, here’s a call to action for people reading this blog. If you read CCSPiP from cover to cover (or nearly so), then please leave a review on Amazon. Especially if you liked it 🙂

Do you have any advice for others who would like to write about programming?

People don’t write technical books for the money. Even a good technical book doesn’t usually sell more than a couple thousand copies. Write a technical book because: you think you’re a good writer, you think you can communicate the subject well, and/or you want the career advancement that comes with being a published author. Career advancement and glory are usually the main rewards. One other piece of advice: keep it pithy. Way too many technical (and non-technical) books are needlessly long. Publishers pressure you into writing as many pages as possible because they think that means they can charge more. Push back on that. Short and sweet is better than long and boring.

Thanks for doing the interview, David!

Print Friendly, PDF & Email