5 ms·
And then the programmer had to debug a hundred line shell script and they realized it should have all been written in Python or Rust instead. Master Foo is sho
by forrestthewoods 2y ago
And then the programmer had to debug a hundred line shell script and they realized it should have all been written in Python or Rust instead.
Master Foo is shorthand for Fool.
- binary132 2y agoShell is just one way. There’s nothing that says we can’t do better than shell, but what it’s good at is saving programmer time when the need isn’t there for more, and Rust is definitely not good at that.
- forrestthewoods 2y agoMy rule of thumb: Shell: <= 5 lines Python: <= 500 lines Rust: > 500 lines Although to be honest I'd be perfectly happy if Shell was restricted to single line commands only. I've wasted a lot of time and energy deciphering undebuggable shell scripts that were written to "save programmer time". Not a fan.
- therein 2y agoThis rule of thumb is clearly too simplified, even as far as the definition goes. Sometimes you just want to execute 50 lines with little logic. Sometimes you just have some simple logic that needs to be repeated. Sometimes that logic is complicated, sometimes it is not.
- forrestthewoods 2y agoSometimes someone writes 50 lines of simple logic. And then sometimes someone else needs to figure out why it’s not working. That person gets very cranky and wastes a lot of time when those “simple” 50 lines aren’t debuggable. If shell scripting didn’t exist I would be totally fine with that. There are far more scripts that I wish were written in a real language than the other way around.
- eichin 2y agoMy rule (and the code review policy I impose) emphasizes complexity instead - a 50 line shell script is great if it doesn't use if or case. (It's not so much of a strict rule as "once you're nesting conditionals, or using any shell construct that really needs a comment to explain the shell and not your code, you should probably already have switched to python." This is in parallel with "error handling in this case is critical, do you really think your bash is accurate enough?") I wasn't the strictest reviewer (most feared, sure, but not strictest) at least partly because my personal line for "oh that bit of shell is obvious" is way too high.
- binary132 2y agoNothing is as obvious as it could be when it’s 3am and you’re debugging a production outage. :)
- shric 2y agoMaster Foo long predates Python and Rust.
- forrestthewoods 2y agoMasters live to be surpassed by their students. Just because something was best in class in the 80s doesn't mean it should still be used.
- thesnide 2y agoVery true, but also student hubris is legendary. Which is perfectly fine, as we all know successful students. But let's not blind ourselves with the survivor bias. Not everything new and very bright will succeed the test of time. So let's take evrything with a grain of salt, and wait until the time has choosen its champions. Which might not be the best technology as we learned