Like so much of this pedantic, ignorant, "declarative programming" stuff, in languages like JavaScript it falls apart miserably. Declarative is hardly “delightful”, and like every other article I've seen on the subject you've shown EXACTLY what's wrong with it, and why those advocating this approach have ZERO blasted business talking about "bloat".

This is evident in your code block under "write small functions and extract logic checks", where you took 729 bytes of poorly written code and turned it into 1168 bytes of even worse and many times slower code.

What's wrong with the initial version? Well, the const assignment of function with the painfully cryptic arrow trash for what would/should just be a simple function, redundant output, lack of short-circuit eval, "else" AFTER "return"... I would ballpark that as 20% larger than need be. If anything, it almost feels like you intentionally card-stacked it to be trash, to try and make your rewrite “better”.

And the rewrite is hardly any better, with the overhead of the derpy daisy-chaining and functions for nothing, variables for nothing, polluting the namespace with even more garbage arrow functions, and basically turning it into spaghetti code since the actual functionality for things unlikely to be used more than once is now spread out all over creation! That's not "clearer" or "more readable"!

There is little good reason for that to be more than:

575 bytes if you lose the comments, and at 661 bytes with the comments it’s STILL smaller than the original. All whilst being WAY clearer code than the train wreck of “declarative” nonsense you tried to claim is somehow magically “easier”, “more efficient”, “better”, “delightful” or any of the other fairy tales used to describe bloated, slower, harder to follow and less efficient SPAGHETTI code!

Your section after than with the “double” function is even WORSE from an efficiency standpoint; but that’s the garbage that is and the dumbass callbacks arrow functions are duping people into pissing on their codebases with. Did you know that .map() in a case like this thanks to the overhead of an extra function on each and every joe-blasted iteration can be anywhere from 9 to 12 times slower than a normal for loop with a “multiply in place”?


…will run CIRCLES around your! Without adding to the namespace. I should write an article about this, I’m sick of seeing this bloated, slow, cryptic “declarative” trash.

And your article just goes downhill from there because the entire premise of “declarative is better” isn’t just flawed, it’s outright ignorant.

I dunno, maybe it’s because I learned to hand assemble my own machine language 40 years ago; before I ever even learned high level languages. Maybe it’s because I spent a decade working in Ada. But I have radically different ideas of what clear efficient code is from the people who, from where I’m sitting, look to be spewing nonsense and pulling glittering generalities out of their backsides.

When you guys talk about this stuff being easier, better, or simpler, I genuinely have ZERO blasted clue what the **** you’re talking about! and I’m starting to suspect, neither do the people who started spreading this rubbish in the first place.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store