Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Dazed and Confused  RSS feed

 
satya Priya Sundar
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Greetings and congratulations on your new book.


Could you compare and contrast  with both imperative style and object-orientated Style while making a case that FP  is better?
And how an FP approach can provide code that is more succinct and less difficult to maintain than an OO or imperative approach.

I am confused by the following definition

[wikipedia]In computer science, functional programming is a programming paradigm—a style of building the structure and elements of computer
Programs—that treats computations the evaluation of mathematical functions and avoids changing-state and mutable data. It is a declarative programming
Paradigm, which means programming is done with expressions[1] or declarations[2] instead of statements. In functional code[/wikipedia]


Thanks
Sathya


 
Pierre-Yves Saumont
Author
Ranch Hand
Posts: 103
17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is a bit difficult to answer because we need both for principles and examples. Although principles are simple to expose, it is often difficult to see how they apply without having a good experience. In other words, to really understand the benefits of FP, you have to know FP. And although giving an example that is simple enough and self contained is easy, it generally difficult to make it convincing. The benefits of FP are real on complex programs. FP is about writing programs by composing functions that depends only on their arguments and have not other effect than returning a value. But FP is also about pushing abstraction to the limit in order to free the programmer from repeating the same patterns again and again, which multiply the risk of errors. It is difficult to give a very short example, but this is the subject of the first chapter of my book, which you can download for free here: Functional Programming in Java
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!