Swizec Teller - a geek with a hatswizec.com

Senior Mindset Book

Get promoted, earn a bigger salary, work for top companies

Senior Engineer Mindset cover
Learn more

    Dynamic languages have jumped the shark

    Jumping the shark

    I still remember the heated arguments I'd have with my high school professors about dynamic languages. What do you mean python isn't a real language? What's wrong with you!? Dynamic languages are the coolest thing ever!

    Some kids fight about curfews and school rules, I fought about scripting languages being just as "real" as the likes of C and Pascal. That was ten years ago - dynamic languages were all the rage and I just started exploring the world of programming beyond what my mentors laid out in front of me.

    Nimble scripting languages sounded like a promised land compared to the musky static languages of yore. No longer would you be forced to think about data types all the time, no longer would your code be littered with the int and char and double of the world, no more stifling constraints on using a variable once it's been defined.

    Just a pure expression of thought. Programmer and problem at peace with one another, no angry compiler will get in your way.

    The promised land tumbles

    Yesterday I realised dynamic languages have jumped the shark. The evidence has been mounting for a while, but yesterday's mishap with Ruby on Rails sealed the deal.

    Did you know that Rails environment settings, the ENV hash, only accepts string settings? I wanted to make a boolean flag. The only solution was to make a string 'false', then do a string comparison when needed. There isn't even a native way to cast a string to a boolean.

    Programmer left completely to his own devices. Out in the rain. With no chance of escape.

    The closest Ruby will let you to casting a string to a boolean is using something like !!'blah', but all strings evaluate to true. Even empty strings.

    Useless.

    The situation is just as bad in other dynamic languages. JavaScript is particularly famous for its weird handling of data types.

    Try it. It works.

    Part of the code returns undefined, which is magically transformed into a string, then other parts of the code select particular characters from that string ... the mind reels in disbelief.

    I don't want to remember the atrocities I've committed in PHP just to convince it that yes, I do know what I'm doing, yes I do want that variable to behave like it's a particular type.

    Python's strong typing at least ensures we can't add a string to an integer, but there's still the odd 5/float(2) type of hack. Some people suggest going as far as littering your code with assert statements to ensure your team mates can't do stupid things with your functions.

    This is the exact opposite of what I was promised as an aspiring 15 year old coder.

    Why we wanted dynamic languages in the first place

    Dynamic languages promised an ease of development, a sense of thinking about solving the problem instead of worrying about talking to the computer. And the world fell in love.

    Instead, dynamic languages delivered a hodgepodge so wibbly-wobbly it always forces you to think about data types, even about the particular quirks of how this particular language handles certain conversions. Always at the worst possible moment. Nothing is true anymore, you can't rely on a single thing; without automated tests you're flying blind, relying on nothing but your raw coding prowess to stave off the always imminent failure.

    God forbid one of your team mates does something stupid.

    But we did get away from the whole int a nonsense. And we did get fancy REPL's. And we did get away from the write-compile-run cycle.

    But what have the Romans ever done for us!

    Static is better now

    Here's the thing, though, there is now a whole new class of even awesomer languages - the modern statically strong typed languages.

    Scala and Haskell have everything we've always wanted from a dynamic language. You never have to spell out a variable's name, the compiler often knows better than you do anyway, and there is a REPL you can use to prototype things.

    But unlike dynamic languages you can rely on everything. All the benefits of static type analysis, most of the benefits of dynamic languages. Hell, you can get rid of the write-compile-run cycle with a simple bash script that compiles your code before running it.

    Just remember, static languages are not just C and Java anymore. The world has moved on while we were stuck in the dynamic hell hole for the past ten years.

    Enhanced by Zemanta
    Published on May 31st, 2013 in Dynamic programming language, Java, JavaScript, Read–eval–print loop, Ruby, Scala, Type system, Uncategorized

    Did you enjoy this article?

    Continue reading about Dynamic languages have jumped the shark

    Semantically similar articles hand-picked by GPT-4

    Senior Mindset Book

    Get promoted, earn a bigger salary, work for top companies

    Learn more

    Have a burning question that you think I can answer? Hit me up on twitter and I'll do my best.

    Who am I and who do I help? I'm Swizec Teller and I turn coders into engineers with "Raw and honest from the heart!" writing. No bullshit. Real insights into the career and skills of a modern software engineer.

    Want to become a true senior engineer? Take ownership, have autonomy, and be a force multiplier on your team. The Senior Engineer Mindset ebook can help 👉 swizec.com/senior-mindset. These are the shifts in mindset that unlocked my career.

    Curious about Serverless and the modern backend? Check out Serverless Handbook, for frontend engineers 👉 ServerlessHandbook.dev

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

    Want to get my best emails on JavaScript, React, Serverless, Fullstack Web, or Indie Hacking? Check out swizec.com/collections

    Did someone amazing share this letter with you? Wonderful! You can sign up for my weekly letters for software engineers on their path to greatness, here: swizec.com/blog

    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 ❤️

    Created by Swizec with ❤️