Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

Dazed and Confused

Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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]


Posts: 161
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Tell me how it all turns out. Here is a tiny ad:
We need your help - Coderanch server fundraiser
    Bookmark Topic Watch Topic
  • New Topic