Skip to content
Swizec Teller - a geek with a hatswizec.com

If the first page of The Martian was written in different type systems

Or: How Types Influence Readability.

Traditional static typed

Where the compiler knows nothing you don't tell the compiler.

KNOWLEDGEREPOSITORY LOG ELEMENT ENTRY: DATE SOL 6

Human I'm Opinion pretty much fucked.

Opinion That's my considered opinion.

Opinion Fucked.

Timespan Six days into Opinion what should be the Opinion greatest Timespan month of Timespan my life, and what should be the greatest month of my life TypeConversion turned into a Opinion nightmare.

I Opinion don't even know ManyHumans who'll Activity read LOG. I Activity guess ManyHumans someone will Activity find LOG Timespan eventually. Opinion Maybe a Timespan hundred years from now.

RhetoricDevice For the record… I Activity didn't die on Date Sol 6. Opinion Certainly ManyHumans the rest of the crew Opinion thought I did, and I can't Activity blame the rest of the crew. Maybe there'll be Timespan a day of Activity national mourning for Human me, and KnowledgeRepository my Wikipedia page will say, Quote "Mark Watney is the only human being to have died on Mars."

Untyped

Where the compiler knows nothing and you're pretty sure it's impossible to explain how your code works to a machine.

THING: SOL 6

Individual pretty much fucked.

That's something.

Fucked.

Six days into experience, and experience's turned into a thing.

Individual don't even know stuff. Individual guess someone will a discovery. Maybe in future.

For the record… person didn't something on Sol 6. Certainly other people thought person did, and individual can't blame people. Maybe there'll be future something for me, and my thing will say, "Mark Watney is the only human being to have died on Mars."

Local type inference

Where the compiler can often guess what you mean.

KNOWLEDGEREPOSITORY LOG ELEMENT ENTRY: DATE SOL 6

Human I'm Opinion pretty much fucked.

That's my considered opinion.

Fucked.

Timespan Six days into Opinion what should be the Opinion greatest Timespan month of my life, and it's turned into a Opinion nightmare.

I Opinion don't even know ManyHumans who'll Activity read LOG. I guess someone will Activity find it eventually. Opinion Maybe a hundred years from now.

RhetoricDevice For the record… I Activity didn't die on Sol 6. Opinion Certainly ManyHumans the rest of the crew Opinion thought I did, and I can't Activity blame them. Maybe there'll be a day of Activity national mourning for me, and KnowledgeRepository my Wikipedia page will say, Quote "Mark Watney is the only human being to have died on Mars."

Global type inference

Where the compiler knows everything – often more than you.

LOG ENTRY: SOL 6

I'm pretty much fucked.

That's my considered opinion.

Fucked.

Six days into what should be the greatest month of my life, and it's turned into a nightmare.

I don't even know who'll read this. I guess someone will find it eventually. Maybe a hundred years from now.

For the record… I didn't die on Sol 6. Certainly the rest of the crew thought I did, and I can't blame them. Maybe there'll be a day of national mourning for me, and my Wikipedia page will say, "Mark Watney is the only human being to have died on Mars."

My point?

People don't hate on old skool static typing because typing types is hard. They hate on it because it's annoying to read.

The pendulum swung too far with untyped languages, and our code is nice to read but hard to understand. We're getting back on track with sufficiently smart compilers and type inference.

The future is bright.

Did you enjoy this article?

Published on December 15th, 2016 in Opinions, Personal, Technical

Learned something new?
Want to become a high value JavaScript expert?

Here's how it works 👇

Leave your email and I'll send you an Interactive Modern JavaScript Cheatsheet 📖right away. After that you'll get thoughtfully written emails every week about React, JavaScript, and your career. Lessons learned over my 20 years in the industry working with companies ranging from tiny startups to Fortune5 behemoths.

Start with an interactive cheatsheet 📖

Then get thoughtful letters 💌 on mindsets, tactics, and technical skills for your career.

"Man, love your simple writing! Yours is the only email I open from marketers and only blog that I give a fuck to read & scroll till the end. And wow always take away lessons with me. Inspiring! And very relatable. 👌"

~ Ashish Kumar

Join over 10,000 engineers just like you already improving their JS careers with my letters, workshops, courses, and talks. ✌️

Have a burning question that you think I can answer? I don't have all of the answers, but I have some! Hit me up on twitter or book a 30min ama for in-depth help.

Ready to Stop copy pasting D3 examples and create data visualizations of your own?  Learn how to build scalable dataviz components your whole team can understand with React for Data Visualization

Curious about Serverless and the modern backend? Check out Serverless Handbook, modern backend for the frontend engineer.

Ready to learn how it all fits together and build a modern webapp from scratch? Learn how to launch a webapp and make your first 💰 on the side with ServerlessReact.Dev

Want to brush up on your modern JavaScript syntax? Check out my interactive cheatsheet: es6cheatsheet.com

By the way, just in case no one has told you it yet today: I love and appreciate you for who you are ❤️