Still, I like to try and see how close I can get a functional implementation to the performance of an optimal imperative one. It’s fun to see what we have to give up and what we can gain.
Reminds me about this video: https://www.youtube.com/watch?v=tD5NrevFtbU
Kinda misses the point that “clean code” is more about readability than performance, but it is worth noting that he manages a 15 times performance increase by making it “unclean”. As he says, that’s approximately 15 years of advances in computer hardware. But it’s also a very specific example.
But does resonate with something I heard in a Dave Farley video (can’t remember which one): that one of the bigger problems for projects these days is building for scale without considering the real need. As you build your todo list application to be able to handle a million concurrent users, you end up with an overly complex project, which slows development down. Realizing that it’s only you, your mom and a handful of people that’ll realistically ever use it, means that you could figure out that the file system might be a better data store than the cloud database you had in mind.
Whenever I look in the source of a CLI command and discovers that it needs a dependency injection container and a handful of classes in order to just parse it arguments, I wonder if there’s not a bit too much eagerness for overengineering and overabstracting in the business.
So I’m kinda trying to go the other way. In particular with a side-project I kinda got lost in, and now trying to do in Crystal instead. It had three micro services and an event driven architecture, and I ended up spending most time working with anything but the main business logic. So I’m trying to go with “the simplest thing that could possibly work” with each feature in the Crystal version.
And it’s actually hard. Crystals base speed helps, but 20 years in the business, and I keep catching myself thinking “hmm, I should make a background queue for processing these” before actually testing whether processing it synchronously is actually a problem. The first time I made the effort doing the simple thing and then see how that worked out, I discovered that the processing time wasn’t the bottleneck (at least in Crystal), it was decoding the JSON it got for input.
So I’m kinda doing the same thing, at a higher abstraction level.