Search

Dark theme | Light theme
Showing posts with label Gr8Conf2012. Show all posts
Showing posts with label Gr8Conf2012. Show all posts

June 11, 2012

Gr8Conf 2012 Conference Report: Day Two

The final day of Gr8Conf 2012 in Copenhagen. The first conference day was really inspring, so I was ready for my second day and learn a lot from all the great presenters. The day started half an hour earlier than the day before, but it seemed not everybody knew this. During the first session a lot of people arrived and had to sneek in while the session was already on the way.

The first session I went to was Grails EE. The title might suggest that Grails will be part of Java EE, but it was a presentation about a real big Grails project and the lessons learned from the project. Ivo Houbrechts did a good job explaining the nice things Grails added to the project, but also pitfalls. I really like the parts where he showed how they achieved a lot of code reduction by implementation AST transformations. The code really looked much beter after this redesign and also the repetitive code blocks were gone. Also the addition and use of UI components was great. Cleaning your code and applying the DRY principle also needs to apply to the view layer in the application. On the project several specific project plugins and some are also available for use like the GSP taglib plugin and Rich Domain plugin. I got some very good ideas from the presentation.

Next up for me was the GPars session presented by Russel Winder. This was a fun session. Russel is a great presenter and capable of explaining complex subjects with humor and make it understandable. GPars is a library part of Groovy (but can be used standalone with Java apps as well) to support parallelism. Now a days the computer power of a single CPU core is limited. To improve performance we should use parallelism, so use multiple processors, to execute our code. Threads are something we shouldn't care about in our applications. They are part of infrastructure and we shouldn't manage them. With several examples we saw how different models of parallelism can influence the outcome and performance. There is no one-model-to-rule-them-all, we need choices. And GPars provides these choices with actors, dataflow and Communicating Sequential Processes (CSP). The nice thing is that all these models are developed somewhere in the sixties and seventies of the previous century. You can read more at Russel Winder's website.

After a coffee break I attended the Hacking the Spring Security Plugin presented by THE Burt Beckwith. Burt is a great presenter and how showed us all the different parts that make up the Spring Security plugin. We can pick and choose a lot of the components/filters and reconfigure them in our own application. The plugin is very flexible (as is the underlying Spring Security) and we can reconfigure parts easily. In the end there is a lot of Spring stuff underneath and we can reconfigure it by overriding components or setting properties.

Peter Ledbrook presented the Asynchronous IO on the JVM: Vert.x session. Vert.x is like Node.js, but we can use Groovy! Writing Vert.x code is very easy as Peter showed us. We write modules that will interact via an event bus. We don't have to worry about the event bus, it can run in a single JVM, but can also spawn multiple JVMs on different computers. Scaling a Vert.x application is very easy. With a concrete example we saw how easy it was to see real-time logging from a Grails application in a Javascript application running in the browser.

After lunch it was time for my final session on this Gr8Conf: Gradle Hidden Gems. I showed with several examples how we can work with Gradle build files. Different command-line options, task configuration and more were covered. During the talk I made the classic Gradle mistake to create a new task and leaving out the leftShift operator (<<), which would only configure the task. But the nice thing about live coding is that the audience will always help and try to find out what went wrong.

Next I went to Luke Daley's session Releasing Software with Gradle. He showed with a lot of example code how we can use Gradle for a project that we want to deploy to Maven Central repository. All steps necessarry were covered. Like creating a correct POM, signing the JAR file and uploading multiple artifacts to a Maven repositories. Very insightful and showed there is no excuse not to use Gradle. Luke also put the code on GitHub as reference.

I couldn't attend the last two sessions of the day, because I had to catch my plane back home. Which was unfortunate, because in the last two sessions interesting Spock things were covered and also Betamax, a tool to interact with HTTP services in tests.

Gr8Conf 2012 Europe was packed with interesting sessions. If you are developing Grails applications, work with Gradle, write test code with Spock or Geb, or use any other Gr8 technology, you should really attend this conference. Everybody is really approachable and it is great to meet the people behind all the projects. Mostly we know their names, but it is good to meet them in real life. Copenhagen is a great city with friendly people that speak English easily and ready to help. The conference takes place at the IT University and has nice auditoria to follow the session, while you can use your laptop to immediatelly try things from the session. The organizers did a great job organizing the conference (they even went through the "trouble" of brewing a special conference beer!). Thank you very much and hopefully see you all next year!

Gr8Conf 2012 Conference Report: Day One

After the university day the conference now really starts with a lot of sessions. Aside from the first session all sessions are in parallel tracks. This means you sometimes have to make though choises. Luckely a lot of the presentations or code from the presentation is online. If we go to the Gr8Conf website and look at the Presentations page we can go directly to a presentation. On that page we see more about the subject and the speaker, but also the presentation itself is included or a link is available.

Søren Berg Glasius started the day and gave us a very big welcome to the 4-th Gr8Conf Europe. Guillaume Laforge presented the first session Groovy Update: What's New in 1.8 and What's Coming in 2.0?. First he gave a short recap off all the features that were added in Groovy 1.8. But quickly we got to see what is in store for Groovy 2.0, which is just around the corner. First of all Groovy will be more modular. This means we don't need to have a big JAR file to work with Groovy, but we can decided which parts of Groovy we need. The core itself will be small and we have modules like console, XML, templates and more. Also Groovy 2 will have JDK 7 alignments. It will use invokeDynamic which is in JDK 7 to improve performance. And finally we get static type checking and static compilation.

After a small coffee break it was for my session Grails Hidden Gems. I showed with live coding many features of Grails. It is stuff you probably read about or used before, but somehow forgot it was there. Or maybe you didn't even know that it was possible with Grails. The small code snippets I used are available on GitHub. Mean while at the other room of the conference Andres Almiray released Griffon 1.0! Would have loved to be there and celebrate the moment, but that is what Gr8Conf is about: making though choices (or you need to present, while in the other room there is a great session).

Next I went to the Testing with Geb session. I already read some stuff about Geb, but I never got around to use it in my projects. After a great presenation by Luke Daley I am convinced I really need to do this in my projects. Geb has a very concise syntax to define tests or specifications. It can be used in JUnit tests or Spock specifications. Also we can abstract pages and use variable definitions with closures to define constraints and behaviour for a page. And with a jQuery like syntax we can traverse the generated HTML structure and use that for simulating user behaviour. To simulate a browser Geb uses Webdriver, the successor to Selenium. This is very flexible and allows to simulate for example Firefox, Chrome or Internet Explorer. We can even do mobile browsing.

After a good lunch Graeme Rocher presented the Grails Update session. He showed all the cool features that were added in Grails 2.0. Then he showed what is happening for the Grails 2.1 release. A lot of effort is put into the Maven plugin. It turned out developers working on Grails projects wanted or needed to support Maven for the company's build system. So that way a Grails application can be part of a bigger suite of applications and with proper Maven support it would be fully supported by their build systems. Also the cache plugin is updated in Grails 2.1. There is now an API, which is independent of the underlying implementation. Plugin authors should use this API and the Grails developers can configure the underlying caching mechanism for their application. In Grails 2.2 we may expect that Groovy 2 will be supported.

Next up was my Groovy Hiden Gems session. In this session I went to a lot of the cool features of Groovy with live coding. All mentioned samples are already described in my blog. So this was a subset of those blog posts showing off how Groovy can make your development live easier.

In the Gradle in the Enterprise session presenter Luke Daley showed how Gradle can be used in enterprise projects. Enterprise means big, a lot of dependencies between many projects, legacy projects and a heterogeneous environment. Gradle is really suited for this scenario as Luke showed. We can even define a company configured Gradle build and put it up in one location. We can define which scripts need to be executed for a Gradle build. The incremental build support really speeds up the build process, so even for big projects the build will be fast. Also we can create a specific build DSL for our projects, so we use the same 'language' in our build system as we would use when we talk about it in person. At the end of the presentation Peter Niederwieser showed how well Gradle already integrates with Eclipse (via STS). Gradle exposes a tools API, which is invoked by the Eclipse plugin. People from Gradle are developing the tools API, but the people at SpringSource are writing the Eclipse/STS plugin.

The last session of the day I attended was Keeping your Grails code clean. Andreas Aredal showed how we can apply the Clean Code rules of Uncle Bob to a Grails application. He gave pointers on how we can reduce the amount of repetition in our code base. Also how we can use informative method names and the like. It was interesting to see how we can apply good developer's craftmanship to a Grails application.

The day ended with a nice BBQ where we could mingle and speek to all speakers and attendees.


June 10, 2012

What to Learn and Use from Gr8Conf 2012 Europe

Going to Gr8Conf is great! You can meet all the good people that develop those amazing Groovy products and projects. You get to learn a lot during 2 (or 3) days which are packed with very informative presentations. Also the fact that you don't have to worry about the "problems-at-the-office" your mind gets into gear. And for me that always results in a new burst of energy and ideas.

Here is my short list from the conference sessions:

  • Do a project with Griffon
  • Learn more about Vert.x
  • Learn more about Betamax
  • Use Geb on projects

 

And then my mind started to wonder off:

  • Create a new site with categorization and search options for the now time-sorted blog posts from Groovy/Grails/Gradle Goodness
  • Work on book with Groovy snippets from Groovy Goodness blog posts. Someone mentioned Leanpub, which looks promising.
  • Implement Gr8labs.org with real educational material for people to learn Groovy (Grails, Gradle, Spock)
  • See if "Koans" can help with Gr8labs. I know there is already a Groovy Koans out there.

Gr8Conf 2012 Conference Report: University Day

This year's Gr8Conf Europe in Copenhagen started with a University day. During this day longer sessions are presented to dive deeper into a subject and use a workshop to give the audience hands-on exercises. I presented the Getting Groovy session with an introduction to Groovy. The presentation and accompanying document are available. During my session there was also Gradle bootcamp session. From what I've heard Peter Niederwieser and Luke Daley did a great job introducing Gradle to the audience.

After the lunch I visited My "Perfect" Toolchain Setup for Grails Projects presented by Stefan Armbruster. He gave a good overview of all aspects that relate to a good project setup. Not only the technical stuff like continuous integration, ticket systems, wiki, but also project organization and methodology were covered. It was good to hear the things we do ourselves on projects were also mentioned by Stefan. Stefan provided the audience with a pre-configured virtual machine to be used during the workshop. At the same time the session Creating Responsive HTML 5 Applications in Grails was presented by Stephen Pember. During a workshop the audience was instructed to build a HTML 5 application with Backbone.js

After these two sessions I had to choose between GAELYK bootcamp and Jumpstarting Griffon. I went to the Griffon session presented by Alexander Klein and Andres Almiray. Here we saw how easy it is to write a Griffon application especially if you know Grails. Griffon also provides a very good structure to group the MVC parts in a MVC group. A lot of things are automatically done with Griffon if we follow conventions. This makes writing a GUI Swing application easy. Then like with Grails we can install plugins to add extra functionality to the application in an easy way. After the presentation I was (again) very enthusiastic about Griffon and I really (really) need to work with Griffon in the near future.

The first day ended with Hackergarten. During Hackergarten we can contribute to an open-source project. And because a lot of the core contributors are in the room it is a great to 'hack' with them on the code. Unfortunately I couldn't attend Hackergarten, because I had to get up very early on this day to be on time in Copenhagen.

June 9, 2012

Code Samples from my Gr8Conf 2012 Sessions on GitHub

I enjoyed a really great Gr8Conf 2012 in Copenhagen. I presented four sessions this year. As you might know I tend not to have any slides, but love to do live coding. Which means you must have been there to be able see what is covered. But for the university session Getting Groovy I have written a 60+ page document with text and code samples. Also there is a slide deck for this session.

For the Grails Hidden Gems session I have pushed the code I have written (and wanted to have written during the session, but one-hour is not that much if you want to show all cool Grails stuff) to GitHub. The Groovy Hidden Gems was also live coding and unfortunately I didn't save or record the code. The code I have written in my last session Gradle Hidden Gems is also on GitHub.

June 7, 2012

Groovy Goodness: Revisited Getting the Sum of Items in a Collection

A while ago I wrote a blog post Groovy Goodness: Getting the Sum of Items in a Collection. Today I presented about this little topic as part of the "Groovy Hidden Gems" session at Gr8Conf 2012. One of the attendees noticed the code where we calculate the sum of the Person objects was not working. So it time to revisit this topic.

The problem with the presented solution is that with more than two elements in the list the code throws an exception. The return method of the plus() method is a BigDecimal so Groovy tries to invoke the plus() method on the BigDecimal class with a Person type argument. And that doesn't exist, hence the exception.

To fix this we must return a new Product object from the plus() method with the sum of the price property. The code is now:

class Product {
    String name
    BigDecimal price

    Product plus(Product other) {
        new Product(price: this.price + other.price)
    }
}
def products = [
    new Product(name: 'laptop', price: 999), 
    new Product(name: 'netbook', price: 395),
    new Product(name: 'iPad', price: 200)
]

assert 1594 == products.sum().price

EDIT: I like to thank the people that wrote a comment. The current solution focuses on the implementation of a plus() method in a class to get a sum value. But we can also use a closure for the sum(). In the closure we define the property to calculate the sum for. Or we can use the optional spread operator to get the price property of all products and invoke the sum() method.

assert products.sum { it.price } == 1594
assert products.price.sum() == 1594
assert products*.price.sum() == 1594