You know if I leave you now, it doesn't mean that I love you any less; it's just the state I'm in, I can't be good to anyone else like this. -- Sarah McLachlan, Fear

A Programmer’s Problem Solver

Many years ago, a colleague and I likened programming in C to programming by shoving your hands into a big box of broken glass. All the pieces are there, and you have complete access to them, but they are sharp and pointy and you are on your own; good luck.

So here is a very general programmer’s problem solver:

 

You have a problem. You want to solve it. So…

In C: You solve the problem. Of course, first you’ll have to hand-craft all of your tools, from scratch.

In Assembly: You solve the problem. Of course, first you’ll have to hand-craft the abstract concept of problem-solving, from scratch.

In C++: You think you’ve solved the problem, but in the back of your mind, you’re never really sure if what you solved was the actual problem, or a copy of the problem, and you really just moved the original problem somewhere else.

In Perl: Now you have two problems.

In Java: Now you have a problem factory.

In PHP: Now your problem has a SQL injection vulnerability.

In Javascript: You solve the problem, but the solution only works in Firefox and Edge. Also, Google deprecated a key API so your solution is going to stop working in April 2023.

In Python (according to Python fans): You just “import solution”, it’s easy!

In Python (according to everyone else): You try to “import solution”, but it turns out that “solution” requires Python 3.9 but “problem” has dependencies that haven’t been updated since 2014. Someone tells you that you should really be using a docker container for this.

In Swift: Ha ha just kidding. You can’t solve problems in Swift.

One thought on “A Programmer’s Problem Solver”

  1. Eh, I like Perl. But in this spirit:

    In Rust: there’s a crate to do almost what you want, only it’s not quite close enough to be useful. So you write your own and you can feel your head expanding. Look at the colours, man.

    In Ruby: do Problem.having(3) end

    (I inherited a Discourse plugin with bugs and no tests, and I run a couple of Discourse sites, so I learned Ruby. It wasn’t hard and it feels a lot like “Perl, only more so”.)

    In PostScript: everyone you mad are thinks you all them show will but

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.