clean-code-fundamentals

A short workshop series on coding heuristics, intended to help people of all coding skill levels write cleaner, more maintainable code. The content is primarily based on the book Clean Code: A Handbook of Agile Software Craftsmanship by Robert C. Martin. The primary audience for this series is data science and other professionals who might write code in their day-to-day work, but who are interested in making their code easier to maintain, read, and transfer to other people.

What this isn’t…

This is not a computer science course. This will not teach you the inner workings of a specific programming language, or how to take your code to millisecond response times. This will not make your code impervious to bugs, server outages, hackers, or PEBCAK errors. Luckily, if you want to learn those things there are many very smart people on the internet that can help teach you those skills.

What this is…

This is intended to share a series of coding heuristics, that have been impressed upon me by previous mentors, managers and coworkers, all who make frequent reference to writing software as a craft, as skills to be honed over time, shared with others, and to be deliberately revisited as new tools and techniques are introduced. I have found the Clean Code book one of many great resources for programmers to build a shared lexicon to identify, discuss and target technical debt and questionable programming decisions. That being said, I believe these skills are directly transferable to Data Science professionals and can help anyone write better code.

Sessions

The discussion(s) is structured as four one hour blocks, intended to cover the following topics.

  1. Introduction & Naming Things
  2. Functions
  3. Testing
  4. Exceptions, Boundaries, Polymorphism

Each discussion is accompanied by an associated reading and a few short coding exercises. In addition, prior to starting, each participant is encouraged to submit a block of code that they would like to refactor over the course of the discussions (50 - 100 lines). During the hour, some time will be allocated to review the code in pairs and discuss how it could be improved based on the discussion. Code examples will be in R but many of the principals are the same.

Preparation

To get the most out of each session, participants are encouraged to:

Sources

When preparing for these discussions, these are the resources I leaned on the most.

Other seemingly trivial things that bother programmers…

Contributors

Brandon Beidel (bbeidel@redventures.com)