Instantly share code, notes, and snippets.

@mbbx6spp /TYPES.md Secret
Last active Mar 27, 2018

Embed
What would you like to do?

Types

This is the (mostly) no nonesense guide to studies and research that measures and/or compares a variety of facets, characteristics, or manifestations of software development in dynamically vs statically typed programming languages.

Disclaimer: For larger, more complex codebases, I do advocate for statically typed languages that also support algebraic data types, generic types, type classes, and preferrably a form of typelevel expressiveness (e.g. dependent types, refinement types) for larger, more complex codebases.

This alone is not enough for me though. Other practices I advocate for include imposing referential transparency wherever possible, modeling with algebraic abstractions such that laws of the system can be encoded as property-based tests either in a runnable test suite or in the type system itself (as with, for example, Idris), using some form of example-based tests to capture edge conditions. However, I have been known to write a lot of Bash for simpler glue logic, so much so that I wrote a Bash styleguide here: https://github.com/mbbx6spp/styleguides/tree/master/bash. I also write much Nix for the infrastructures I deploy.

Previously in my career as a developer I wrote Ruby (relgiously TDD-style) to build Rails web applications and advocated in favor of code-level practices that I read in disgust now. Forgive me father, for I have sinned.

Observations of results

  • Measuring things like proness to creating bugs, developer productivity, or otherwise effectiveness of type systems is a hairy tasks (to say the least) to design valid experiments for.
  • The scope of the experiment is inversely proportional to how precise the result can be (i.e. the larger the scope, the smaller probability the result holds in all operating environments).
  • The results I am presently aware of in this space are not conclusive towards one side or another. In fact, there are some results that offer mixed findings.
  • Many experiments or research studies in the area that compare dynamically and statically typed languages tend to target the lowest common denominator kind of statically typed languages which are mainstream such as Java and C.#

Studies

Related (Statically Typed Background)

This is where my current bias will likely show up the most since I am more likely to be exposed to pro static types or at least pro static analysis papers:

These are just pointers. If you have a relevant paper, experiment, or study please link to it in the comments and I will add to this list.

So...

"To Type or not to Type, that is the question."

Make your own mind up. My suggestion is above in the disclaimer.

@giampaolotrapasso

This comment has been minimized.

giampaolotrapasso commented Jun 9, 2016

I always cite the first study.. now I will use directly your gist, thanks :) +1

@pozorvlak

This comment has been minimized.

pozorvlak commented Jun 10, 2016

Dan Luu has written a literature review on the benefits of different type systems - as you say, most of the research is of questionable validity and shows small effects if any.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment