Search posts, tags, users, and pages
What do you mean by micro level?
Did you mean more Readable in the third point?
Mark Inherently functional code adds a layer (or several) of abstraction on your code. Depending on how commented code is, and well-named classes/methods are, it can be difficult to discern what's happening in code immediately.
Vishwa Bhat It can mean more readable, but I meant in terms of perspective. FP makes code easier to understand when you're looking at the pure functions (micro level, or looking at code up close), but it's harder to understand when you look at procedural methods that use often combine those pure functions (on a macro level, or looking at a codebase from farther away).
For example, add() adds values together, and calculate() uses add() -- but I don't know what add() does until I open up that class/method and inspect it. I assume it adds things together and return them, but it could add them and log them. It's a layer of abstraction. Not inherently bad, but it does make code more difficult to understand immediately and from afar.
The part where you mentioned about readability, I defer that. You can write readable code even in imperative style, infact more verbose. And, you cannot get rid of Macro level functions even in FP style. The point is- Readability completely depends on the way you write it regardless of the programming paradigm. The only plus point for FP is in the streams where the data flow can be represented bit more literally.
The concept of Pure functions is neither new nor coined under FP principles. It is the way of writing a function. The reason it became popular under FP is because of the ability to cache a Pure function.
I don't entirely agree...
I can't say about functional programming, but I would contest that on average, it takes longer to learn to read assembly than it does Python. You can write more and less readable code in either, and maybe that has a bigger effect than the language, but the language contributes. Consider Malbolge as an extreme example.
Pure functions are a FP principle under many definitions, it's #2 on Wikipedia. Which is not to say that it is unique to FP.
@Mark: Check this out whenever you've free time