TL;DR
Programmers often express a dislike for the 'reduce' function, finding it less readable and elegant compared to alternatives like 'map'. This sentiment appears to be consistent across languages such as JavaScript, Python, and Swift.
✦ Why It Matters
Consider your team's coding standards and preferences when choosing between 'reduce' and 'map' for better readability.
Key Takeaways
Full Summary
In programming, functions like map and filter are commonly used and generally well-received in code reviews, while reduce often faces criticism for being harder to read. The author shares personal experiences where code containing reduce prompted comments about readability, unlike code using map or filter.
The article suggests several reasons for this trend: reduce may be less familiar to programmers, can perform worse in certain scenarios, and appears less elegant in languages like JavaScript, Python, and Swift. Interestingly, the author notes that this feedback was less prevalent during their time working with Clojure.
Despite a preference for reduce, the author often opts to replace it with more accepted alternatives to avoid conflict. This observation highlights a social phenomenon in programming culture regarding function usage.
Related