Programming Groovy 2_ Dynamic Productivity for the Java by Venkat Subramaniam PDF

By Venkat Subramaniam

Groovy brings you the easiest of either worlds: a versatile, hugely effective, agile, dynamic language that runs at the wealthy framework of the Java Platform. Groovy preserves the Java semantics and extends the JDK to provide you precise dynamic language features. Programming Groovy 2 can help you, the skilled Java developer, examine and benefit from the most recent model of this wealthy dynamic language. you are going to move from the fundamentals of Groovy to the newest advances within the language, together with strategies for variety checking, tail-call and memoization optimizations, assemble time metaprogramming, and fluent interfaces to create DSLs.

You do not need to depart the wealthy Java Platform to use Groovy. Groovy preserves Java's semantics and extends the JDK, so programming in Groovy appears like the Java language has been augmented; it is like operating with a lighter, extra stylish Java. in case you are an skilled Java developer who desires to learn the way Groovy works, you will discover precisely what you wish during this book.

You'll commence with the basics of programming in Groovy and the way it really works with Java, after which you are going to discover complex techniques similar to unit trying out with mock gadgets, utilizing developers, operating with databases and XML, and growing DSLs. you will grasp Groovy's strong but advanced run-time and compile-time metaprogramming features.

Much has developed within the Groovy language because the book of the 1st variation of Programming Groovy. Programming Groovy 2 might help you study and follow Groovy's new good points. developing DSLs is less complicated now, and Groovy's already-powerful metaprogramming amenities have more advantageous much more. you will see tips on how to paintings with closures, together with tail name optimization and memoization. The booklet additionally covers Groovy's new static compilation feature.

Whether you are studying the fundamentals of the language or drawn to getting informed with the recent gains, Programming Groovy 2 has you covered.

What You Need

To paintings at the examples within the publication you would like Groovy 2.0.5 and Java JDK five or higher.

Show description

Read Online or Download Programming Groovy 2_ Dynamic Productivity for the Java Developer PDF

Similar object-oriented design books

Download e-book for iPad: Hibernate Quickly by Patrick Peak

A concise creation to Hibernate's many configuration and layout innovations, this ebook distills Hibernate into digestible items with many code examples, useful utilization eventualities, and insurance of the instruments on hand to builders writing Hibernate purposes. utilizing a move slowly, stroll, run educating method, builders will examine what Hibernate is, what it might do, and the way it may be used successfully.

Download PDF by David Robinson: Aspect-Oriented Programming with the e Verification Language

What’s this AOP factor besides, really―when you get down to it―and can anyone please clarify what a facet really is? Aspect-Oriented Programming with the e Verification Language takes a realistic, instance established, and enjoyable method of unraveling the mysteries of AOP. during this e-book, you’ll find out how to:• Use AOP to arrange your code in a fashion that makes it effortless to house the belongings you fairly care approximately on your verification environments.

Dragan Gaševic, Dragan Djuric, Vladan Devedžic, Bran V.'s Model Driven Architecture and Ontology Development PDF

Defining a proper area ontology is usually thought of an invaluable, to not say important step in virtually each software program undertaking. this is why software program bargains with rules instead of with self-evident actual artefacts. notwithstanding, this improvement step is infrequently performed, as ontologies depend upon well-defined and semantically robust AI suggestions equivalent to description logics or rule-based platforms, and so much software program engineers are mostly unexpected with those.

Download e-book for iPad: UML @ Classroom: An Introduction to Object-Oriented Modeling by Martina Seidl, Marion Scholz, Christian Huemer, Gerti Kappel

This textbook regularly addresses novices and readers with a easy wisdom of object-oriented programming languages like Java or C#, yet with very little modeling or software program engineering adventure – hence reflecting the vast majority of scholars in introductory classes at universities. utilizing UML, it introduces simple modeling innovations in a hugely distinctive demeanour, whereas refraining from the translation of infrequent specific instances.

Extra info for Programming Groovy 2_ Dynamic Productivity for the Java Developer

Sample text

Tom, Jerry, and null If the excess variable is a primitive type, something that can’t be set to ​null​, then Groovy will throw an exception—this is a new behavior. x. As you can see, Groovy makes it quite easy to send and receive multiple parameters. 6 Implementing Interfaces In Groovy we can morph a map or a block of code into interfaces, which lets us implement interfaces with multiple methods quickly. In this section, you’ll see a Java way of implementing interfaces, and then you’ll learn how to take advantage of Groovy’s facilities.

So, in this case, the expression ​if (obj) ​ evaluates as t​ rue​ only if o ​ bj​ is not n​ ull​ and the collection has at least one element; look at the following code example: ​ lst0 = null ​ println lst0 ? ​'lst0 true'​ : ​'lst0 false'​ ​ lst1 = [1, 2, 3] ​ println lst1 ? ​'lst1 true'​ : ​'lst1 false'​ ​ lst2 = ​[]​ ​ println lst2 ? ​'lst2 true'​ : ​'lst2 false'​ We can check our understanding of how Groovy handles ​boolean​ for ​Collection​s with the following output: ​ lst0 false ​ lst1 true ​ lst2 false Collection​s are not the only things that receive special ​boolean​ treatment.

Lst1 true'​ : ​'lst1 false'​ ​ lst2 = ​[]​ ​ println lst2 ? ​'lst2 true'​ : ​'lst2 false'​ We can check our understanding of how Groovy handles ​boolean​ for ​Collection​s with the following output: ​ lst0 false ​ lst1 true ​ lst2 false Collection​s are not the only things that receive special ​boolean​ treatment. To see the types that get special treatment and how Groovy evaluates their truth, refer to the following table: Table 1. Types and Their Special Treatment for Boolean Evaluation Type ​Collection​ ​Character​ Condition for Truth True Not empty Value not 0 ​CharSequence​ ​Enumeration​ ​Iterator​ Length greater than 0 Has more elements Has next ​Number​ ​Map​ Double value not 0 Not empty At least one match Length greater than 0 Reference not null ​Boolean​ ​Matcher​ ​Object[]​ Any other type In addition to enjoying the built-in Groovy truth conventions, we can write our own ​boolean​ conversions easily by implementing an ​asBoolean​ method in our classes.

Download PDF sample

Programming Groovy 2_ Dynamic Productivity for the Java Developer by Venkat Subramaniam


by William
4.2

Rated 4.03 of 5 – based on 12 votes