Why Groovy When Java 8 or Scala, or…

23,202 views

Published on

My presentation at Groovy and Grails eXchange 2012. Trying to tease out various issues in the tension between dynamic and static languages on the JVM. Groovy is the only language that can be both a dynamic and a static language.

Published in: Technology
1 Comment
16 Likes
Statistics
Notes
  • The Scala performance is much better than Groovy.
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total views
23,202
On SlideShare
0
From Embeds
0
Number of Embeds
767
Actions
Shares
0
Downloads
122
Comments
1
Likes
16
Embeds 0
No embeds

No notes for slide

Why Groovy When Java 8 or Scala, or…

  1. 1. Why Groovy When Java 8, Or Scala, Or… Russel Winder email: russel@winder.org.uk xmpp: russel@winder.org.uk twitter: russel_winderCopyright © 2012 Russel Winder 1
  2. 2. Aims, Goals and Objectives ● Show that Groovy cannot be complacent about its place in the JVM-verse. ● Survive till the end of the session…Copyright © 2012 Russel Winder 2
  3. 3. Structure A beginning. A middle. An end.Copyright © 2012 Russel Winder 3
  4. 4. Protocol ● Questions or short comments during the session are entirely in order. ● Let me know you have an interjection by raising your hand, and when I come to an appropriate pause, Ill pass you the token. Questions, answers, comments, etc. appearing to get too long as interjections may get stacked to be unstacked at a break.Copyright © 2012 Russel Winder 4
  5. 5. Interstitial AdvertisementCopyright © 2012 Russel Winder 5
  6. 6. FrontispieceCopyright © 2012 Russel Winder 6
  7. 7. Copyright © 2012 Russel Winder 7
  8. 8. Copyright © 2012 Russel Winder 8
  9. 9. A PrefaceCopyright © 2012 Russel Winder 9
  10. 10. Friends, programmers, humans, lend me your ears;Copyright © 2012 Russel Winder 10
  11. 11. I come to bury Groovy, not to praise it.Copyright © 2012 Russel Winder 11
  12. 12. A BeginningCopyright © 2012 Russel Winder 12
  13. 13. Statically Dynamically typed WAR typed languages languagesCopyright © 2012 Russel Winder 13
  14. 14. Static Typing Mandatory ● Compilers catch: ● Compiled direct to ● Incorrect use of types. target: ● Silly spelling errors. ● Less overhead. ● Need fewer tests. ● Faster ● Can work with big code bases because of the testable modularity.Copyright © 2012 Russel Winder 14
  15. 15. Catch errors early, before execution. Computational performance is all that matters.Copyright © 2012 Russel Winder 15
  16. 16. Apart from correct implementation.Copyright © 2012 Russel Winder 16
  17. 17. And the right functionalityCopyright © 2012 Russel Winder 17
  18. 18. And good user experience.Copyright © 2012 Russel Winder 18
  19. 19. Dynamic is Inadequate ● Cannot program to ● Every action is interfaces. “interpreted” and so ● Have to write tests for slow. things a compiler can ● Difficult to work with (and should) catch big codebases. trivially. ● Have to run the code to find out anything.Copyright © 2012 Russel Winder 19
  20. 20. Languages such as Java, Scala, Kotlin, Ceylon work where Groovy, JRuby, Jython, Closure result in incomprehensible codes.Copyright © 2012 Russel Winder 20
  21. 21. Statically Dynamically typed Groovy typed languages languagesCopyright © 2012 Russel Winder 21
  22. 22. Groovy is in the middle of the battlefield by trying to be both dynamic and static.Copyright © 2012 Russel Winder 22
  23. 23. Guillaume Laforge emphasized @TypeChecked and @StaticCompile in his GGeX 2012 opening keynote.Copyright © 2012 Russel Winder 23
  24. 24. Guillaume Laforge emphasized making Groovy static by default in his GGeX 2012 opening keynote.Copyright © 2012 Russel Winder 24
  25. 25. Why turn a perfectly good dynamic language into a static one?Copyright © 2012 Russel Winder 25
  26. 26. Lets not worry too much about RPython and CPython and PyPy. Or perhaps we should…Copyright © 2012 Russel Winder 26
  27. 27. Just use a good designed to be statically-typed language from the outset?Copyright © 2012 Russel Winder 27
  28. 28. Scala ● Doesnt have the same data model as Java. ● Is in its own world effectively. ● So Scala projects generally all Scala.Copyright © 2012 Russel Winder 28
  29. 29. Ceylon ● Doesnt have the same data model as Java. ● Is in its own world effectively. ● So Ceylon projects generally all Ceylon. Ceylon supports optional typing!Copyright © 2012 Russel Winder 29
  30. 30. Kotlin ● Doesnt have the same data model as Java. ● Is in its own world effectively. ● So Kotlin projects generally all Kotlin.Copyright © 2012 Russel Winder 30
  31. 31. If a language has to define its own data structures library then you begin to think there is a problem.Copyright © 2012 Russel Winder 31
  32. 32. Or perhaps the Java Collections framework is fundamentally broken?Copyright © 2012 Russel Winder 32
  33. 33. Java 8 ● Has exactly the same data model as Java. ● Is the new world effectively. ● So Java 8 projects generally all Java. The only question is when to upgrade from Java 5, 6 and 7 to Java 8.Copyright © 2012 Russel Winder 33
  34. 34. IntermissionCopyright © 2012 Russel Winder 34
  35. 35. http://steveonjava.com/nighthacking/Copyright © 2012 Russel Winder 35
  36. 36. The fight is JavaFX vs. GroovyFXCopyright © 2012 Russel Winder 36
  37. 37. But, soft! what light through yonder window breaks?Copyright © 2012 Russel Winder 37
  38. 38. A MiddleCopyright © 2012 Russel Winder 38
  39. 39. Jave 8 evolves the Collections framework by introducing public defender methods.Copyright © 2012 Russel Winder 39
  40. 40. Backward compatibility assured.Copyright © 2012 Russel Winder 40
  41. 41. Data Parallelism in Collections.Copyright © 2012 Russel Winder 41
  42. 42. Data Parallelism Transform a sequence to another sequence all actions happen at the same time logically.Copyright © 2012 Russel Winder 42
  43. 43. GPars redundant?Copyright © 2012 Russel Winder 43
  44. 44. Dataflow Operators connected by Actors channels with activity Independent processes triggered by arrival of communicating via data on the channels. asynchronous exchange of messages CSP Sequential processes connected by channels using synchronous message exchange (rendezvous).Copyright © 2012 Russel Winder 44
  45. 45. Actors Independent processes communicating via asynchronous exchange of messagesCopyright © 2012 Russel Winder 45
  46. 46. Dataflow Operators connected by channels with activity triggered by arrival of data on the channels.Copyright © 2012 Russel Winder 46
  47. 47. CSP Sequential processes connected by channels using synchronous message exchange (rendezvous).Copyright © 2012 Russel Winder 47
  48. 48. The EndCopyright © 2012 Russel Winder 48
  49. 49. To Groovy or not to Groovy…Copyright © 2012 Russel Winder 49
  50. 50. …that is the question.Copyright © 2012 Russel Winder 50
  51. 51. Copyright © 2012 Russel Winder 51
  52. 52. Is static Groovy a better language than Java 8?Copyright © 2012 Russel Winder 52
  53. 53. Groovy has 6 months to stake its claim to hegemony over the JVM space.Copyright © 2012 Russel Winder 53
  54. 54. Surreptitious AdvertisementCopyright © 2012 Russel Winder 54
  55. 55. DevoxxUK 2013 2013-03-26 & 2013-03-27 http://www.devoxx.com/display/UK13/HomeCopyright © 2012 Russel Winder 55
  56. 56. Why Groovy When Java 8, Or Scala, Or… Russel Winder email: russel@winder.org.uk xmpp: russel@winder.org.uk twitter: russel_winderCopyright © 2012 Russel Winder 56

×