0
@marioggar
FUNCTIONAL PROGRAMMING
WITH
GROOVY
(Mario Garcia)
@marioggar
Who am I ?
● Software engineer at Kaleidos.net
● Groovy enthusiast
● Dublin GUG & Madrid GUG
desmontandojava.bl...
@marioggar
What's functional programming ?
@marioggar
What's functional programming ?
“In computer science, functional programming is a programming paradigm, a style...
@marioggar
What's functional programming ?
@marioggar
@marioggar
Groovy is amazing!!!
@marioggar
@marioggar
Why FP matters ?
Aren't you tired of the same things ?
COPY / PASTE
REFACTORING IS HARD
PATTERNS REQUIRE TMC
FO...
@marioggar
Why FP matters ?
Tacking Accidental complexity
i.e: why I still should bother on how to loop through a data
str...
@marioggar
It's not about the language!!!!
● FP IS NOT ABOUT A LANGUAGE ONLY
● IS ABOUT THE WAY YOU USE YOURS
@marioggar
FP in the JVM
PURE FUNCTIONALFUNCTIONAL STYLE
You can You do
@marioggar
It's Groovy a functional language ?
● It's not a pure functional language but...
– Good news! You can do FP :-)...
@marioggar
It's imperative so bad ?
@marioggar
Would you keep using Java 1.4 ?
@marioggar
Is “imperative” so bad ?
No per se but:
• Most of the time it doesn't enforce you in the right direction
• Time...
@marioggar
@marioggar
THANKS !!!!
@marioggar
{ Q, A -> Q & A }
Upcoming SlideShare
Loading in...5
×

Functional Programming with Groovy

444

Published on

Greach 2014 presentation about using functional paradigm with Groovy

Published in: Software, Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
444
On Slideshare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
8
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Transcript of "Functional Programming with Groovy"

  1. 1. @marioggar FUNCTIONAL PROGRAMMING WITH GROOVY (Mario Garcia)
  2. 2. @marioggar Who am I ? ● Software engineer at Kaleidos.net ● Groovy enthusiast ● Dublin GUG & Madrid GUG desmontandojava.blogspot.com @marioggar https://github.com/mariogarcia #FF9900 Mario García
  3. 3. @marioggar What's functional programming ?
  4. 4. @marioggar What's functional programming ? “In computer science, functional programming is a programming paradigm, a style of building the structure and elements of computer programs, that treats computation as the evaluation of mathematical functions and avoids state and mutable data. Functional programming emphasizes functions that produce results that depend only on their inputs and not on the program state - i.e. pure mathematical functions. It is a declarative programming paradigm, which means programming is done with expressions. In functional code, the output value of a function depends only on the arguments that are input to the function, so calling a function f twice with the same value for an argument x will produce the same result f(x) both times. Eliminating side effects, i.e. changes in state that don't depend on the function inputs, can make it much easier to understand and predict the behavior of a program, which is one of the key motivations for the development of functional programming...” Wikipedia (http://en.wikipedia.org/wiki/Functional_programming)
  5. 5. @marioggar What's functional programming ?
  6. 6. @marioggar
  7. 7. @marioggar Groovy is amazing!!!
  8. 8. @marioggar
  9. 9. @marioggar Why FP matters ? Aren't you tired of the same things ? COPY / PASTE REFACTORING IS HARD PATTERNS REQUIRE TMC FOR EACH HOW TO OPEN/CLOSE A FILE ... NOT ENOUGH SPACE :(
  10. 10. @marioggar Why FP matters ? Tacking Accidental complexity i.e: why I still should bother on how to loop through a data structure Modularity “...higher-order functions and lazy evaluation, can contribute greatly to modularity...” (John Hughes)
  11. 11. @marioggar It's not about the language!!!! ● FP IS NOT ABOUT A LANGUAGE ONLY ● IS ABOUT THE WAY YOU USE YOURS
  12. 12. @marioggar FP in the JVM PURE FUNCTIONALFUNCTIONAL STYLE You can You do
  13. 13. @marioggar It's Groovy a functional language ? ● It's not a pure functional language but... – Good news! You can do FP :-) – I don't want to be pure anyway :P – Let's see some code
  14. 14. @marioggar It's imperative so bad ?
  15. 15. @marioggar Would you keep using Java 1.4 ?
  16. 16. @marioggar Is “imperative” so bad ? No per se but: • Most of the time it doesn't enforce you in the right direction • Time to re-think on how we do things • FP enables concurrency and parallel programming Changing your programming paradigm is always a WIN: • Most languages have at least a “functional style” of doing things • Change your mind often...with some criteria of course ;)
  17. 17. @marioggar
  18. 18. @marioggar THANKS !!!!
  19. 19. @marioggar { Q, A -> Q & A }
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×