Interview with Thomas Mailund (Advanced Object-Oriented Programming in R)

Hello, BPBers! Welcome back to Best Programming Books special weekly topic! Today’s a very special day because we were able to have an interview with an author who wrote a book about Programming in R.  Our featured author for today is Mr. Thoas Mailund. He wrote Advanced Object-Oriented Programming in R, one of the best sellers in Computer and Technology. His book was independently published last February 2017 and for just a few month, it is already in the best seller rank.

We’re excited to share with you our featured author’s interview so we won’t make this introduction long (as we always say) and please don’t forget to share this with your friends too! Enjoy reading everyone!


Name: Thomas Mailund
– Blog:
– Twitter: @ThomasMailund
Background: Computer Science and Mathematics, but for the last 15 years I’ve worked with Bioinformatics and Genetics
Favorite gadget: My new iPad Pro
Hobbies: I read a lot — usually a couple of hundred books a year — and recently I guess it has become a hobby to write books myself.




What is your book about, and why should our readers read it?

I’m working on a series of books on R as a programming language, as opposed to a domain specific language for statistical analysis — all my books with a subtitle containing *Statistical Programming* is part of this series — and in this particular book, I focus on the object-oriented programming aspects of R.

In books about R, there is usually very little focus on how it works as a programming language. Hadley Wickham’s *Advanced R* is the only one that comes to my mind that really does this. Usually, the core features of the language are introduced, but then the rest of a book focuses on statistics or machine learning or such. This is perfectly understandable since that is the primary use of R and what most people are interested in. It does mean, however, that if you are serious about software development in R yourself, you have to learn how to use the language from package documentation, example code, and bits and pieces in blog posts scattered around the web.

When looked at as a programming language, R is not particularly elegantly designed. It is a language that has grown over a very long time with new features being added from time to time, as far as I can see without much thought to how they fit with the rest of the language. So it can be a little hard to figure out exactly how it all function. However, because it is a mature language and because features have been added over decades, it is a powerful language as well, once you learn how to use it effectively. It is a very high-level language, and you can extend it in your own programming to improve it when you need to. The tidyverse, which has grown mature over the last decade or so, is an example of how a powerful analysis framework can be built on top of basic R. The framework makes it very easy to explore and analyse data, but it is based on some advanced features of the language. If you want to extend the framework, you need a very solid understanding of how R works as a programming language.

I wouldn’t claim to be an expert in R programming as such, but I have more than 15 years experience with using R for data analysis and writing packages for my own research, and with a background in computer science I probably look at the language in a different way than people with a statistics or data science background. So, when I started teaching data science at my university, I wanted to teach software development and programming as well, and since I used R in the class, it was natural to start thinking about R programming. I wrote a textbook for my class where about a third of it was on R programming, but that left a lot of material out that I couldn’t fit into my class. That became the start of my “statistical programming in R” series that I initially put online, but Apress now publish.

The *Advanced Object-Oriented Programming in R* book captures the object-oriented aspects of R, as should be obvious from the title. When it comes to object-orientation, it very quickly becomes clear that R wasn’t as much designed as grew by people adding features to it over time. It has several systems for object-oriented programming with different pros and cons and different ways of combining them. In this book I explore the three main systems for OOP in R in, I hope, sufficient detail that the reader will understand how to use them and have a feeling for when to choose one over another. I spend most of the book discussing the S3 system — this is the system underlying the tidyverse packages so the one I use the most myself — and show how you can use it to define classes and methods and how you can extend the R language in small ways by overloading operators and how you can implement new statistical models using it. I then show how you would do the same things with the S4 and R8 systems and discuss how these systems differ from S3.

If you are mostly interested in using R as a data analysis language, then this book is probably not for you. It is very much a programming book and a technical one at that. If you want to do serious software development in R, however, I think it will be useful.


What, in your opinion, is the current most exciting technological advancement and why?

Oh, technological advancements in general? There are so many!

In the biological/medical field I think that high-throughput sequencing technologies have dramatically changed which kinds of analyses we can do, and as these technologies improve and get cheaper, we can do larger and larger studies. And everywhere we look these days we find something new and exciting.

In anthropology/archaeology, having access to ancient DNA is amazing. We know so much more about the peopling of the world today than we did less than a decade ago because we can directly observe the genes of people living in the past. As a colleague of me said once: having access to aDNA feels a lot like cheating.

In computer science, I think artificial intelligence and machine learning is both the most fascinating and most scary. The tools we can build using AI and ML are amazing and quickly change our lives in ways we often don’t notice until it has already happened. If you don’t believe me, then think a bit about how fantastic a Google search is, and then how natural it feels to you. Twenty years ago, it didn’t exist. Ten years ago, you wouldn’t casually do a location aware search to find a restaurant. Five years ago, you wouldn’t be able to do it by speaking to your smart watch. This is a technology that affects us all, and usually without us noticing it. I find it a little scary. Not because I fear hard AI, although good arguments can be made to do this, but because it changes our society without us necessarily considering the consequences. If your news stream gets tailored to your own preferences, you build a bubble around yourself, an echo chamber, and if you are not aware of this, it could get problematic.


What inspired you to write your book/s?

As I mentioned above, I was working on a textbook for a class I teach and just had much more material than I could fit into the class. Then, when I started putting that material together for a separate book I figured that I would have material for several books if I kept each short and focused on a single programming aspect, and then it just grew from there.


If there’s one chapter in your book people should have read, which one should it be, and why?

I think the chapter on operator overloading is the most interesting one. You can read about the OOP systems many places, but I haven’t seen any treatment of operator overloading in any of the books I own, and if you want to write embedded domain specific languages in R — something I am planning to write about in a future book in the series — it can be really useful.


As an author, which book made the most impact on you?

If by “as an author” you mean in the context of my writing, then I have read a few interesting books on that. Stephen King’s *On Writing* is pretty good, for example. Anne Lamott’s *Bird by Bird* is as well. There is not really any particular book that inspires me to be an author, though. It is a just a hobby that has grown out of being a teacher and being interested in programming.


If there’s one subject you’d like to see a book about, what would it be?

There are too many subjects I am interested in to pick a single one. I am currently very much looking forward to reading a book on what we have learned about human demographics from recent aDNA studies, written by a colleague and friend of mine, but I will have read 10-20 other books before that is out…


What would you like to ask the next author being interviewed?

Is Deckard a replicant?


There we go! We hope you enjoyed reading this interview! To Mr. Thomas Mailund, thank you very much for the opportunity you gave us. Thank you for giving us some of your time to answer our interview. We are so happy to have you featured on our site! To our dear readers, thank you very much for the unending support. Thank you so much, everyone! Please subscribe to our newsletter, like us on Facebook and follow us on Twitter to get the latest and the best programming books brought to you by Best Programming Books.

You may also like...