Some backstory

In my post about OpenWRT on x86 hardware, I mentioned that I considered balenaEtcher’s size to be a negative trait. I also complained in Yarn versus NPM about the dependency management for Node.js projects.

Both complaints stem from a similar problem, Using a tool without respect for its constraints.

Constraints?

All tools have constraints. For physical tools like a hammer or saw, they have to do with how the tools materials, size, and shape affect whether it scratches a surface on impact or how smooth the cut is. Digital tools like software also have constraints. C, for example, treats nearly all data structures as merely a location in memory. This provides excellent flexibility at the ease of creating memory leaks and buffer overruns.

The creators of a programming language have both a problem domain and several other constraints to juggle when creating the language. The original problem domain especially restricts the general utility of the language.

What does that have to do with the examples in the backstory?

All of those programs use the JavaScript programming language. Netscape originally designed JavaScript to make small dynamic changes to a browser’s DOM. Combined with a choice for fast iteration, JavaScript ended up without a robust typing system and little attention to modularity.

You can see the attachment to a browser’s DOM in Electron. The programming environment that balenaEtcher uses. Two hundred and four megabytes, installed, for a program whose task is to order a dozen or so command-line tools around.

The failure to update transitive dependencies that I ran into using Yarn is a side effect of how Yarn deals with JavaScript’s lack of module separation. The original program I wanted to use didn’t help matters by choosing a broad semantic range for their dependencies.

Conclusion

Like physical tools, software, including programming languages, has constraints. Strive to be a polyglot so you can use the appropriate tool for the job.

Leave a Reply

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