I never was a fan of scripting, and unless it was a real edge case, I was always ending up refactoring my needs based on existing tools instead of scripting. Why?
Simply said, because as soon as I finish writing a Bash script, I quickly forget what the mess was about, and if I needed a refactor sometime later, I always end up with too many WTF/m.
Yes, I realize how cool it is, but in 2022 I prefer to use my mental capacity on making something valuable than deciphering my novice bash skills 🙂
I learned about Babashka, the scripting tool for Clojure developers, a while back. I found it interesting to have the full power of a programming language within your shell scripts. I gave it a try yesterday and found myself some reasons not to pick it up. The reasons are:
- Shell outs (using applications in your
PATH) are not as smooth as a regular Bash script.
- Things we like about shell scripts, like piping, are not as straightforward as they seem. There are thread macros, yet it is not easy to utilize it in every scenario (there are better ways, more Clojure friendly alternatives).
- Clojure itself is a bizarre tool for system administration. Not a bad thing, but I am not much of a Clojure developer “yet.”
- Available libraries for system management are not as vast as I know in Python.
Wait a minute, Python? Why not Python? At least it is the second-best citizen on any Unix system nowadays (unlike Babashka, which needs to be installed separately). I once switched to Xonsh some years ago (oh man, it has been six years). I used Python’s
sh from time to time, but never was encouraged to switch to it altogether.
Influenced by my questions, I tried to search and found Plumbum. I wouldn’t say I like to showcase by duplicating the excellent documentation. Still, unlike other alternatives, I want to say that it’s trying to solve the right problem in a novel way. There are still some shortcomings, like being an external dependency, meaning the scripts won’t be as plug and play as we like them to be, but I thought maybe those kinds of issues could be resolved with some package management.
So I mixed it with Poetry, and my script project was born 😀. I expect to write more about my experience in this area, as I find it interesting. The power of scripting is helpful, but I wonder if we can improve it to catch up with the good practices I like to follow in software development. At least those who contribute have less WTF/day.