← Back to context

Comment by busterarm

2 days ago

My career is practically built on the fact that other people 99% of the miss the simplest representation of the data/problem.

Just look at myriad ways that people implement something like checking win conditions in Rock, Paper, Scissors. Switch statements, conditional hell, etc.

...you can just do something as simple as stick Rock, Scissors, Paper into a circular list and compare to the next element. It's practically readable as plain English. No programming skill required.

If you need to code golf you can use modulo arithmetic, for a different kind of "simple", but then you lose readability.

You could have a big pattern-match statement for Rock, Scissors, Paper and it would still be readable (in a language that supports these things like eg Rust).

The circular list seems a bit too cute for me. Sure, it's possible, but seems like overkill.

  • If you have to do a bunch of list manipulation yourself sure but most scripting languages make these things trivial.

    Heck, you could easily write it using Terraform built-in functions.

    • What do you mean by 'list' in this case? Python, for example, has a list data structure, but it's different from what C folks would naturally think of when you say 'list'.