why groovy when java 8 or scala, or

Click here to load reader

Post on 28-Jan-2015




0 download

Embed Size (px)


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.


2. Aims, Goals and Objectives Show that Groovy cannot be complacent about its place in the JVM-verse. Survive till the end of the sessionCopyright 2012 Russel Winder2 3. Structure A beginning.A middle. An end.Copyright 2012 Russel Winder3 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 Winder4 5. Interstitial AdvertisementCopyright 2012 Russel Winder5 6. FrontispieceCopyright 2012 Russel Winder6 7. Copyright 2012 Russel Winder 7 8. Copyright 2012 Russel Winder 8 9. A PrefaceCopyright 2012 Russel Winder 9 10. Friends, programmers, humans,lend me your ears;Copyright 2012 Russel Winder 10 11. I come to bury Groovy, not to praise it.Copyright 2012 Russel Winder 11 12. A BeginningCopyright 2012 Russel Winder 12 13. StaticallyDynamically typed WAR typed languages languagesCopyright 2012 Russel Winder 13 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 Winder14 15. Catch errors early, before execution.Computational performance is all that matters.Copyright 2012 Russel Winder 15 16. Apart from correct implementation.Copyright 2012 Russel Winder16 17. And the right functionalityCopyright 2012 Russel Winder 17 18. And good user experience.Copyright 2012 Russel Winder18 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) catchbig codebases. trivially. Have to run the code to find out anything.Copyright 2012 Russel Winder19 20. Languages such as Java, Scala, Kotlin, Ceylonwork where Groovy, JRuby, Jython, Closureresult in incomprehensible codes.Copyright 2012 Russel Winder 20 21. Statically Dynamically typed Groovy typed languageslanguagesCopyright 2012 Russel Winder21 22. Groovy is in the middle of the battlefield by trying to be both dynamic and static.Copyright 2012 Russel Winder22 23. Guillaume Laforge [email protected] and @StaticCompilein his GGeX 2012 opening keynote.Copyright 2012 Russel Winder23 24. Guillaume Laforge emphasizedmaking Groovy static by defaultin his GGeX 2012 opening keynote.Copyright 2012 Russel Winder24 25. Why turn a perfectly good dynamic languageinto a static one?Copyright 2012 Russel Winder25 26. Lets not worry too much about RPython andCPython and PyPy. Or perhaps we shouldCopyright 2012 Russel Winder26 27. Just use a good designed to be statically-typedlanguage from the outset?Copyright 2012 Russel Winder 27 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. 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 Winder29 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. If a language has to define its own data structures library then you begin to think there is a problem.Copyright 2012 Russel Winder31 32. Or perhaps the Java Collections framework is fundamentally broken?Copyright 2012 Russel Winder32 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 Winder33 34. IntermissionCopyright 2012 Russel Winder34 35. http://steveonjava.com/nighthacking/Copyright 2012 Russel Winder 35 36. The fight is JavaFX vs.GroovyFXCopyright 2012 Russel Winder36 37. But, soft! what light through yonder window breaks?Copyright 2012 Russel Winder 37 38. A MiddleCopyright 2012 Russel Winder38 39. Jave 8 evolves the Collections framework by introducing public defender methods.Copyright 2012 Russel Winder39 40. Backward compatibility assured.Copyright 2012 Russel Winder 40 41. Data Parallelism in Collections.Copyright 2012 Russel Winder41 42. Data Parallelism Transform a sequence to another sequence all actions happen at the same time logically.Copyright 2012 Russel Winder42 43. GPars redundant?Copyright 2012 Russel Winder43 44. Dataflow Operators connected by Actorschannels 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. Actors Independent processes communicating via asynchronous exchange of messagesCopyright 2012 Russel Winder 45 46. Dataflow Operators connected by channels with activity triggered by arrival of data on the channels.Copyright 2012 Russel Winder 46 47. CSP Sequential processes connected by channels using synchronous message exchange (rendezvous).Copyright 2012 Russel Winder 47 48. The EndCopyright 2012 Russel Winder 48 49. To Groovy or not to GroovyCopyright 2012 Russel Winder49 50. that is the question.Copyright 2012 Russel Winder50 51. Copyright 2012 Russel Winder 51 52. Is static Groovy a better language than Java 8?Copyright 2012 Russel Winder52 53. Groovy has 6 months to stake its claim tohegemony over the JVM space.Copyright 2012 Russel Winder53 54. Surreptitious AdvertisementCopyright 2012 Russel Winder 54 55. DevoxxUK 20132013-03-26 & 2013-03-27 http://www.devoxx.com/display/UK13/HomeCopyright 2012 Russel Winder 55 56. Why Groovy When Java 8, Or Scala, OrRussel Winderemail: [email protected] xmpp: [email protected]: russel_winderCopyright 2012 Russel Winder56