Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to 12/13/20111 Prepared by: Vincent Schwarzer, Chih-Hung Hsieh Java Enterprise Application Development.

Similar presentations


Presentation on theme: "Introduction to 12/13/20111 Prepared by: Vincent Schwarzer, Chih-Hung Hsieh Java Enterprise Application Development."— Presentation transcript:

1 Introduction to 12/13/20111 Prepared by: Vincent Schwarzer, Chih-Hung Hsieh Java Enterprise Application Development

2 12/13/20112 Java Enterprise Application Development Structure 1.The history of Groovy 2. What is Groovy? Features & Strengths 4. Groovy vs. Java OOP 3. Groovy Builder 5. Common use cases 6. Short example

3 12/13/20113 Java Enterprise Application Development The history of Groovy Several versions released between 2004 and 2006 James Strachan started developing Groovy in 2003 Released final version called Groovy 1.0 in 2007

4 12/13/20114 Java Enterprise Application Development What is Groovy? An agile and dynamic language for the JVM Builds upon the strength of Java Additional power features inspired by languages like Ruby, Python and SmallTalk Almost zero learning curve for Java Developers Seamlessly integrates with all existing Java classes and libraries You can use it anywhere you can use Java

5 12/13/20115 Java Enterprise Application Development Features & Strengths // old school Java code, but also valid Groovy code System.out.println("Hello, world!"); // idiomatic Groovy println "Hello, world!" // dynamic variable definition def name = “Peter" // GString featuring string interpolation println "Hello, $name" // => "Hello, Peter" // statically typed variable String songName = "Coding in the Name of" println "Now playing - $songName" String multiline = """this is a multiline string. There is not need to embed newline characters in it""" println multiline

6 12/13/20116 Java Enterprise Application Development Features & Strengths // method definition def greet(name) { println "Hello, $name!" } // method invocation greet “Peter" greet(“Peter“) // a list def beers = [“Becks", “Corona", “Budweiser", “Heineken"] // list access println "My favourite beer is ${beers[1]}“ for (i in beers) { println i } // imports can appear anywhere and support the creation of aliases import static java.util.Calendar.getInstance as now import java.sql.Date as SDate

7 12/13/20117 Java Enterprise Application Development Groovy Builder one use for builders is the generation of markup:

8 12/13/20118 Java Enterprise Application Development Groovy Builder Result:

9 12/13/20119 Java Enterprise Application Development Groovy vs. Java Similar capabilities to Java: Define classes, interfaces, enums, annotations Differences to Java: Classes (and interfaces etc.) public by default Methods public by default Property support within classes (auto-setters/getters)

10 12/13/201110 Java Enterprise Application Development Common use cases Web application development scripting Rapid prototyping As a proof on concept Exploratory Programming Test class / method capabilities

11 12/13/201111 Java Enterprise Application Development Thank You


Download ppt "Introduction to 12/13/20111 Prepared by: Vincent Schwarzer, Chih-Hung Hsieh Java Enterprise Application Development."

Similar presentations


Ads by Google