posted 9 years ago
Hi Divya,
There are some key reasons.
1. Declarative instead of imperative. We focus on what to do and let libraries figure out the details. This makes the code more expressive.
2. Favoring immutability. The more mutability (especially shared mutability) we have, the more bugs tend to creep in. We can reduce bugs by favoring immutability.
3. State transformation instead of state mutation. This leads to more of a function composition and state transformation. The code becomes more expressive and it tends to resemble more
closely to the problem statement.
4. Efficiency through lazy evaluation. Because we are passing higher order functions, we can postpone evaluation of certain parts to just in time of need. This can leads to greater efficiency in code.
The collective benefit is more expressive, more concise, less error prone, easier to understand (once we get a hang of the style), and easier to maintain code.
Also, when we combine composition, immutability, and laziness with things like parallel streams, we can create highly efficient code with much less effort and chances of error.
Hope this gives you a very high level view of the reasons.
Thanks
Venkat