Groovy introduction

9
www.cognitomedia.c om Giri Pottepalem Nov 20, 2013 Groovy – An Introduction

description

An introduction to Groovy language for Java developers

Transcript of Groovy introduction

Page 1: Groovy introduction

www.cognitomedia.com

Giri PottepalemNov 20, 2013

Groovy – An Introduction

Page 2: Groovy introduction

2

What we will cover today…

What is Groovy?

Why Groovy (when we have Java)?

Installation and Integration with Java

Tools

Groovy for Java Eyes

Resources

Hands on, code examples etc.

Page 3: Groovy introduction

3

What is Groovy?

Agile and Dynamic Programming language for Java Platform (JVM)

Builds upon the strengths of Java Language

Better, Lighter Java

More readable, less verbose, less noisy than Java

Brings in powerful modern programming features to Java, inspired by languages like Python, Ruby and Smalltalk

Backed by VMware

Taken into core Spring technology stack of latest Spring Eco System (http://spring.io/platform)

Page 4: Groovy introduction

4

Why Groovy (when we have Java)?

We are coding in 2013

Many things around us have changed, but not Java

Java evolved as a robust and matured platform, but language is still 1990s and started to show it’s age

Polyglot Programming

Productive language

A flat learning curve for Java Developers

Interoperates with Java seamlessly, compiles to java byte code

Brings the Joy or Programming back to Java

Page 5: Groovy introduction

5

Installation and Integration

Installation

http://groovy.codehaus.org/ - Download, unzip

Set env variable GROOVY_HOME

Add %GROOVY_HOME%\bin to PATH

Integration

All you need is just one jar file for Java applications (groovy-all.jar)

Page 6: Groovy introduction

6

Tools

groovysh

groovyconsole

IDE plugins (Eclipse, IntelliJ)

Page 7: Groovy introduction

7

Groovy for Java Eyes

Optional Java features

Semicolon, parenthesis, obvious scopes, return statement etc.

Enhanced JDK classes

GDK Classes

Native Language support for Collections with consistent syntax like Java arrays

Groovy Beans

Groovy truth

Exception Handling

Classes, Scripts, Constructors etc

Operator overloading

Convenient operators (?. , *. , ?: , << etc. )

Annotations (@Log4j, @ToString etc.)

Page 9: Groovy introduction

9

Let’s get some hands on