The lodash way is definitely a good way to implement this simple function. Combining object oriented programming and functions gives you however an even more concise and imo more readable way (Kotlin):

val applePrice = fruits.firstOrNull { == "Apple" }?.price

Instead of using an external library (needs to be imported) and applying two _ functions to objects (fruits and fruit), above code works directly on the list of fruits (oop). My point here is that the art of computer programming is about picking the right tool for the problem and if it’s combining two paradigms then I’ll do that. IMO the original article (and a lot of the references) focus too much on language specific shortcomings. The real problem is not oop or functional programming, it’s the languages and developers that don’t use them properly.

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