Civis R&D Bookshelf: Learning A New Language
The Bookshelf series usually focuses on a few fairly quick reads around a theme. But this week, I want to use my post to make a pitch to you, dear reader.
I think you should learn a new programming language. Something off the beaten path. How does Erlang sound? Haskell? Prolog?
Why do this? It might sound useless at first. But as data scientists, we have to spend a lot of time interacting with code, from relying on others’ software to automating our own workflows, and maybe even writing dashboards, apps, and packages. If you’re already comfortable with R or Python, there’s a lot you can learn by exploring another language. Different languages have different perspectives on programming, and having a passing familiarity with several will give you a lot of different ways you can look at a problem. For example, R likes to focus on functions. It’s easy to pass functions around in R, or create temporary functions and ``apply`` them across different chunks of your data. Python prefers to think about objects and classes with methods and attributes. And a lower-level language like C forces you to think about memory. I’ve worked with all three of these languages, and each of them has taught me new ways to think about programming.
My big recommendation for this week is the book Seven Languages in Seven Weeks, by Bruce Tate. This book walks through seven programming languages, many of them unusual or lesser-known, and each of them introducing unique ways to look at programming. You don’t have to try them all, but even spending a weekend on one will help broaden your horizons and make you a better programmer. Plus, it’s fun! I recommend the chapter on Prolog, an esoteric language that shares some DNA with SQL.
If you’re learning a new language, you’ll need something to code. There are two coding exercises I go to give myself basic language fluency: Conway’s Game of Life (Life for short) and the Project Euler. Life isn’t the board game, it’s a cellular automaton; basically, a grid of cells that can take different states over time according to a set of rules. Based on Life’s simple rules and a starting position, the simulation can display some really complex behavior, but more importantly for language learning, it’s a satisfying toy problem. Project Euler is a set of mathematical/computational problems that get more challenging as you go. One ambitious programmer has even tried a couple in LaTeX. Choose a language, and give them a try yourself!
This post is part of our Bookshelf series organized by the Data Science R&D department at Civis Analytics. In this series, Civis data scientists share links to interesting software tools, blog posts, scientific articles, and other things that they have read about recently, along with a little commentary about why these things are worth checking out. Are you reading anything interesting? We’d love to hear from you on Twitter.