Loading presentation...

Present Remotely

Send the link below via email or IM

Copy

Present to your audience

Start remote presentation

  • Invited audience members will follow you as you navigate and present
  • People invited to a presentation do not need a Prezi account
  • This link expires 10 minutes after you close the presentation
  • A maximum of 30 users can follow your presentation
  • Learn more about this feature in our knowledge base article

Do you really want to delete this prezi?

Neither you, nor the coeditors you shared it with will be able to recover it again.

DeleteCancel

Make your likes visible on Facebook?

Connect your Facebook account to Prezi and let your likes appear on your timeline.
You can change this under Settings & Account at any time.

No, thanks

Everything's Groovy

Presentation about Groovy lang. The code from presentation is located here http://goo.gl/EQuVL1
by

Dmitry Voloshko

on 29 May 2015

Comments (0)

Please log in to add your comment.

Report abuse

Transcript of Everything's Groovy

Everything's Groovy
From Java To Groovy
Groovy Collections
Smooth Operators
AST (Abstract Syntax Tree) Transformations
Groovy Performance
About myself?
Technical Leader at SoftServe
Agenda
What is Groovy
Groovy...
Groovy Ecosystem
7 years in IT industry
Java
Swing
Groovy
Grails
Spring
Hibernate
Scrum
JUnit
Spock
Code review
Design Patterns
Dmitry Voloshko
is an agile and
dynamic language
for the
Java Virtual Machine
builds upon the strengths of
Java
but has
additional power features
supports
Domain-Specific Languages
provides the ability to
statically type check
and
statically compile
makes writing shell and build scripts easy with its
powerful processing primitives
simplifies testing
by supporting unit testing and mocking out-of-the-box
seamlessly
integrates with all existing Java classes and libraries
compiles straight to
Java bytecode

so you can use it anywhere you can use Java
@GlamourOff
History
James Strachan
First mention in August 2003
First releases 2004 - 2006
Version 1.0 January 2, 2007
Version 1.1 December 7, 2007
Groovy 1.1 immediately rebranded as Groovy 1.5
Groovy won the first prize at JAX 2007 innovation award
Version 2.0 July 2, 2012
I can honestly say if someone had shown me the Programming in Scala book by Martin Odersky, Lex Spoon & Bill Venners back in 2003 I'd probably have never created Groovy.
Monday, 6 July 2009
POJOs on steroids are POGOs
JSR 241 March 2004
def
keyword as a type of variables (Duck typing)
GString instead of String
Semicolons at end-of-line are optional
Everything is
public
unless defined otherwise
The
return
keyword is optional
Simplified
System.out.println
Magic of creation
Useful operations
Powerful looping
Incredible search
Other Cool Stuff
[ ]
- ArrayList by default
[ : ]
- LinkedHashMap by default
n..m
- Range
[ ] as Set
- LinkedHashSet
<<
- Add to Collection
+
- Aggregate Collections
-
- Remove from Collection
collect()
- Return a new Collection
each()
- The For-Each Loop
flatten()
- Flatten a collection
grep()
- Return all items which satisfy the truth
eachWithIndex()
- The For-Each Loop with index
*.
- Call some method of each item
in
- Check if item contains in Collection
max()
/
min()
- Max / Min item
find()
/
findAll()
- Item(s) which satisfy the truth
first()
/
last()
- First / Last item
unique()
- Only unique items
take()
- Number of items from the head
findResults()
- Return a new Collection w/o null
groupBy()
- Group items
AST Transformations provides Groovy with improved
compile-time metaprogramming capabilities
Global AST Transformations
Local AST Transformations
@PackageScope
@Sortable
@EqualsAndHashCode
@ToString
Annotation based AST Transformations
Annotation based AST Transformations
@TypeChecked
@CompileStatic
Annotation based AST Transformations
@InheritConstructors
@TupleConstructor
Annotation based AST Transformations
@Delegate
@Immutable
@Canonical
@Singleton
Annotation based AST Transformations
@Grab
@Log
Annotation based AST Transformations
@TimedInterrupt
@ThreadInterrupt
@ConditionalInterrupt
@WithReadLock
and
@WithWriteLock
@Builder
@AutoClone
Object-Related Operators
Overriding getProperty/setProperty
The spread java field (
*.@
)
Java field (
.@
)
'as' -
"manual coercion"

-
asType(t)
method
Groovy
==
(
equals()
) behavior.
is
for identity
Elvis Operator (
?:
)

Safe Navigation Operator (
?.
)

Regular Expression Operators:
find (
=~
) match (
==~
)

Arithmetic and Conditional Operators
a + b
- a.plus(b)
a - b
- a.minus(b)
a * b
- a.multiply(b)
a ** b
- a.power(b)
a / b
- a.div(b)
a % b
- a.mod(b)
a <=> b
- a.compareTo(b)
a > b
- a.compareTo(b) > 0
a < b
- a.compareTo(b) < 0
a >= b
- a.compareTo(b) >= 0
a <= b
- a.compareTo(b) <= 0
History
Groovy Ecosystem
From Java To Groovy
Groovy Collections
AST Transformations
Groovy Performance
If someone says me Groovy is slow...
sort()
- Sort items
any()
- Is any item suitable?
every()
- Is every item suitable?
Smooth Operators
Full transcript