Presentation is loading. Please wait.

Presentation is loading. Please wait.

GroovyOne: the first Groovy conference James Strachan Let's Get Groovy!

Similar presentations


Presentation on theme: "GroovyOne: the first Groovy conference James Strachan Let's Get Groovy!"— Presentation transcript:

1 GroovyOne: the first Groovy conference James Strachan http://groovy.codehaus.org Let's Get Groovy!

2 Agenda Why Groovy? Why Groovy sucks? The future

3 Java’s biggest strengths? VM rocks Binary compatibility of components Lots of reusable software & components & tools Massive community of people & companies We can innovate at the source code level if we play nice at the binary level

4 Times have changed When Java was created, we needed a systems programming language  A ‘better C++’ Java is now feeling quite verbose Now we need more of an integration glue language  Most of the components are written; its about gluing stuff together The web tier is a perfect example of this

5 Requirements for Groovy Desire for complete binary compatibility with Java  No difference at the JVM / bytecode level to Java code  No wrappers or separate islands of APIs  allow easy mix and match of Groovy & Java code Java friendly syntax  We’ve enough to worry about as enterprise developers without unnecessary low level language syntax differences Reuse the J2SE / J2EE APIs  Build on the Java platform, rather than porting an existing platform inside Java which leads to leaky abstractions  No need to learn a new set of APIs such as in Jython / JRuby  Help make J2SE and J2EE APIs easier to use A language specifically designed for use in the Java Platform by Java developers for Java developers

6 Groovy at a glance Concise syntax for working with collections, arrays and beans Closures Operator overloading Static and dynamic typing Markup & Gpath Making the JDK more Groovy with new methods So much more concise, powerful and fun!

7 Lessons learnt so far Dynamic & concise languages are fun Reused many features from languages like  Dylan, Lisp, Ruby, Smalltalk, Python IDE integration vital these days

8 Static v dynamic typing If an IDE could do full completion and refactoring with Groovy in static type mode - I’d probably stay statically typed in Groovy and ditch Java I’d also probably only use dynamic typing for throw away scripts

9 Personal use cases Scripty glue for building, testing and integration EAI processing (e.g. gluing enterprise applications together easily)  J2EE duct tape Interactive command console for J2EE, JMX, Spring containers As a kinda XQuery / SQL replacement

10 Long term use cases? Long term replacement for javac?  Needs more static typed bytecode  Needs great IDE refactoring in Eclipse/IDEA Competitor to PHP / Ruby / Python for RAD building of web apps etc?

11 Why Groovy sucks? Time to start ranting! :)

12 Why Groovy sucks? We developed it using a XP / TDD approach  So it looks like what we wanted  Though there are some holes/cracks where we glossed over some issues So we need to start from the fundamentals to fix the smelly parts It was also easier to make all the implementation dynamic

13 Why Groovy sucks? Scoping/naming issues  There’s quite a few to go through… GroovyMarkup needs to support full XML / namespaces Lets be a little more static yet keep the dynamic feel

14 Why Groovy sucks? James needs to get off his fat ass and fix it

15 Why Groovy sucks? James needs to get off his fat ass and fix it Some help from the community would be great!

16 Decisions decisions We need to make cast iron decisions ASAP on things like  Whitespace / newlines  Optional semicolons  Optional parenthesis  Should we have a ‘let / any’ keyword for dynamically typed variable declarations?

17 How we fix it? Today and tomorrow we should be able to work through many of the issues Lets tackle things high priority first  Naming scopes  Type system  Modules  Markup  Other sucky parts Lets fix broken stuff first, then look at new stuff

18 The Future New stuff to consider…  This all comes from http://docs.codehaus.org/display/GroovyJSR/Discussions

19 New: casting syntax x = y as String Neater than x = (String) y Allow classes to overload how they are cast/coerced to different types. (e.g. like toString() toInteger() toCheese() etc) Maybe through new method  Object asType(Class type) { … }

20 New: overloading new Define new as a method on Class Allow it to be overloaded on a class bases x = new Cheese() Would really mean x = Cheese.newInstance() How do we implement newInstance()? E.g. calling new Cheese() inside Cheese.newInstance() we need to avoid recursion :)

21 New: in keyword We already use ‘in’ as an operator when iterating  for (x in coll) { … } Consider using it as a syntax sugar for collection contains() type methods  if (x in coll) { … } Which would mean  If (coll.contains(x)) { … }

22 New: div keyword? Support integer division  I think Steve/Brian added \ as integer division  ‘div’ is maybe less perlish

23 New: macros/annotations Long story! :) Supporting annotations is gonna be increasingly important Annotations in Java 5 are a poor mans macro Macros are a great way of making DSLs  E.g. defining entity models, schemas etc

24 Example use com.acme.DatabaseModule class Customer extends Table { @primaryKey Integer id String name Address address @index name @index address.city }

25 Encouraging Participation The code for the parser and bytecode generator are a little hard to grok Tidy up the parser code a little Consider replacing ASM with Janino Using a Java based AST avoids us having to grok JVM op codes

26 Making Groovy more static If the compiler can deduce typing; we should be able to generate normal statically typed bytecode This results in way less RAM and much better performance We should only pay for the dynamisms we use

27 Biggest issues Getting good IDE refactoring/completion support Fixing the smelly parts of the language

28 Lets get to work By the end of GroovyOne we should hopefully all have a better understanding of the issues Together we can fix it!

29 For More Information Groovy Home Page  http://groovy.codehaus.org GDK Javadoc  http://groovy.codehaus.org/groovy-jdk.html JSR-241: Groovy Language Specification  http://www.jcp.org/en/jsr/detail?id=241

30 GroovyOne James Strachan http://groovy.codehaus.org Let's Get Groovy!


Download ppt "GroovyOne: the first Groovy conference James Strachan Let's Get Groovy!"

Similar presentations


Ads by Google