{ by david linsin }

Showing posts with label groovy. Show all posts
Showing posts with label groovy. Show all posts

January 11, 2010

Groovy @ JUG-Ka

The first talk of 2010 at the Java User Group Karlsruhe is this coming Wednesday. After a successful finale in December 2009 with a talk on Scrum, we are turning our attention to the technical side of things again - Groovy.

We had a talk on Groovy back in early 2008, in case you remember. It was an introduction, whereas this coming talk will target a more advanced audience.

The speaker of the night will be Dierk König from Canoo Engineering AG, Switzerland. He is a Groovy committer and author of the book Groovy in Action. He'll give us an overview of 7 scenarios in which to use Groovy in your project.

I'm excited, that we are going to have a Groovy expert in the house Wednesday evening. If you have any questions on Groovy, it's your chance to get an answer, so make sure to drop by.

The talk will take place at University Karlsruhe in room 102, located in the basement - just follow our duke featured logo. The talk will start at 7:15pm.

Our monthly lottery of JetBrains and ZeroTurnaround, which are each giving away a free license of one of their products is already on. If you are interested in participating in the draw, submit your details through our online form. The winners are going to be announced at the end of the talk and must be present.

To keep up with all the JUG goodness in 2010 subscribe to our Google Calendar or join our Xing Group.

June 29, 2009

Wrapping-up Jazoon09

I was attending Jazoon09 in Zurich, Switzerland last week. As with springOne 2009, I wasn't really satisfied with this content of the conference.

The problem was, that there were only a few really good speakers and thus only a couple of great talks. The keynotes were average, only Adrian Colyer's presentation on the last day was standing out. Even James Gosling's presentation or Danny Cowards talk were both not that exciting.

However, instead of telling you what sucked, I rather want to highlight, that the organization of the conference was great! The food was really good! There was an vegetarian alternative every day and the coffee was delicious. Jazoon took place in a movie theater, just like Devoxx, thus it was easy to get there by train and the seats were nice and comfy. Kudos to the organizers.

There were a couple of great talks I want to highlight: Neal Ford's "Smithying in the 21st Century" as well as Ed Burns' "Secrets of the Rockstar Programmers" were really awesome and I can only commend listening to them, in case they come up on the schedule of another conference.

I'm not too sure if I'll come back to Jazoon next year, although I think it could be a really cool conference and a great alternative to Devoxx, which takes place in Antwerp.

June 21, 2009

Jazoon 2009

I'll be at Jazoon 2009, which is starting next week on Monday with a Glassfish Day. It's going to be my first time in Zurich this year and I'm really excited, because they have a great line up of speakers.

Among others, there's gonna be the father of Java himself Mr. James Gosling. For me it's always something special to listen to a keynote of him.

There's gonna be sessions on a wide range of topics, e.g. "Concurrency and Performance Reloaded" with Kirk Pepperdine, "Development for the iPhone" or "Design Patterns in Dynamic Languages" with Neal Ford, to name only a few of the first conference day.

April 16, 2009

More Playing with GAE

In my previous blog about the Google App Engine (GAE), I wrote about the problems I had encountered using JPA and Maven. In this post I want to share how using Groovy on the GAE worked out and what my impressions are on the scalability of the platform.

Inspired by SpringSource's blog on Groovy with the GAE and after almost a year, I decided to do some Groovy coding. I wrote a small Groovlet, which uses the JPA to fetch entities from persistent storage. Again, I'm quite astonished of how smooth coding can be:

import javax.persistence.*
import java.util.List
import de.linsin.sample.gae.domain.User
import de.linsin.sample.gae.EMF

EntityManager em = EMF.getInstance().createEntityManager()
Query query = em.createQuery("SELECT u FROM " + User.class.getName() + " u")
List<User> users = query.getResultList()

for (User user : users) {
out.println(user.getName() + " " + user.getLastname() + "<br/>")
}

em.close();


To be fair, I have no Exception handling in this code and there is no finally making sure the EntitManager is closed at the end. Yet, it feels like Java without the clutter.

To get this working on the GAE, all you need to do is drop the groovy-all.jar into the WEB-INF/lib folder of your WAR file and add the GroovyServlet to your web.xml. You add your Groovlet to a groovy folder under WEB-INF and access it like a good old Servlet in your browser e.g. http://dlinsin-area51.appspot.com/HelloWorld.groovy.

Unfortunately there is one major drawback, which makes developing Groovy for GAE a real pain - local deployment of Groovlets is not working right now. It seems like Google has been notified about the issue, but even after a few days the bug is still in status "new", so I don't think there'll be a fix anytime soon. Since daily deployment is limited by a quota, I think this bug is almost a show-stopper and I wouldn't want to develop in Groovy for the GAE right now.

Let's turn our attention to performance and scalability. First off I have a disclaimer: I didn't run any thorough or scientific tests! Although I have some numbers to back up my opinion, you might want to run further tests before you draw a final conclusion.

To get us all on the same page, let's start with a little "theory". When I talk about performance it means something like this:

... performance is characterized by the amount of useful work accomplished by a computer system compared to the time and resources used.

...performance may involve one or more of the following:
  • Short response time
  • High throughput

  • The same goes for scalability, although in general it's more subtle to properly define it:

    ...scalability is a desirable property of a system, a network, or a process, which indicates its ability to either handle growing amounts of work in a graceful manner, or to be readily enlarged.

    With that out of the way let's head over to the test setup. It consists of a simple Apache JMeter test script, which puts my poor sample application under load. The script loads the start page http://dlinsin-area51.appspot.com, then inserts the name "JMeter" into the input field and submits the form. The submission results in a redirect to the start page again. I mainly wanted to test "writes" to the persistent storage, because in my experience that's the most hardest part to scale.





    I ran the test script with 10 threads (blue shaded) and with 100 threads hitting my sample app. Each thread runs the test procedure 10 times. The results were quite interesting. If you take a closer look at the average response time of both samplers you can see only a small difference between 10 users and 100 users (or threads) hitting the application at the same time. The response time for inserting a row into the persistent storage went up insignificantly, which I think is quite astonishing, considering the increase of load.

    However, you should take these results with a grain of salt. They merely exist to give me a hint of what the GAE is capable of. I would be interested in real benchmarks, because I think it's crucial to see how scalable the GAE is under field conditions.

    Update: The test results are simply wrong! Thx for pointing it out Bernd, I'm working on it!

    Update 2: Here comes the bugfix!

    gae_summary_revised_10.png




    You might ask what happened? Frankly, I mixed up the pictures and didn't double check, before pushing out the post. Sorry about that! I ran the tests with the same specs as mentioned above again and as you can see from the results, this time it looks reasonable.

    Based on the new numbers, I have to put my conclusion a little bit into perspective. It still think the GAE scales reasonably well, but the numbers are not that astonishing anymore.

    May 03, 2008

    Does IDE Support Influence Your Language Choice?

    The talk about Groovy at JUG-Ka the other week got me interested. The language seems to have similar features like Scala, just a little more OO-like.

    Another huge reason for me to make a little detour to Groovyland, was IntelliJ IDEA's excellent Groovy support. It's almost as good as with Java: you can create Groovy scripts, get code completion and run your code in the IDE. Just like you would expect it with Java code.

    Scala's IDE support on the other hand is very rudimentary. The Eclipse plug-in is rather buggy and only helpful to a certain extend. The only reason why I'm using it is the editor. It gives you basic syntax highlighting and the fact that you are in your IDE comfort zone.

    Right after getting my hands dirty with Groovy, a screen cast on Daniel Spiewak's blog popped up and demonstrated the potential of a new Scala Eclipse plug-in. It's still early and there's a lot to do, but it was enough to put me back on track with Scala.

    For me, the most essential features of an IDE, especially when new to a language are: syntax highlighting, human readable compiler/error messages and code completion. There's other stuff like formatting code or easy deployment, which is not less important, but to get you started I think those three are indispensable.

    I guess we all know the feeling, when we are sitting in front of our machine and trying to figure out what the compiler tries to tell us with its cryptic error messages. That's why I think proper compiler/error messages, provided by your IDE in a human readable form, are of tremendous value - even more than syntax highlighting or code completion.

    To wrap this up and answer my own question "Does IDE support influence your language choice?": yes it does - at least to a certain extend. I have no problems with limited IDE support, as long as I'm not a beginner. I do admit that I like the comfort and features provided by an IDE. It just makes development so much easier! However, in my current project, I would just be happy if the mouse wheel worked in my IDE.

    September 24, 2007

    Scripting with Java Interfaces

    I just read a nice article at java.net about scripting support in Java. I've read various articles about the Scripting API so far, but using POJI for let's say JavaScript functions was new to me. You can take a simple Java interface like this one

    public interface Time {
    public void getTimeForCountry(String argCountry);
    }

    and basically implement it using for instance JavaScript.

    function getTimeForCountry(country) {
    return "Time in " + country + " is " + new Date();
    }

    I think this approach gives you the power of designing your application using statically typed interfaces, but at the same time keeping the flexibility of using a scripting language for implementation.

    In the article mentioned above the author tries to tackle the issue of performance. He suggests using a scripting language for development phase and switching over to their byte code representation when going live. Groovy is mentioned in this regards, cause it supports compilation to Java byte code.

    I don't fully agree with this. For me the power of using a scripting language in Java is it's dynamic nature: making changes on the fly without having to recompile or redeploy your application together with an easy to understand syntax. I wouldn't introduce another language just for the sake of "enhancing" development productivity, since you always introduce more complexity and clutter.

    What I do agree on is that languages like Groovy and Scala, which are both compatible with the Java language, bring value in terms of expressiveness. Features like mixins or case classes in Scala give you so much power and yet the language itself is so concise and clean. I could very well think of implementing components using Scala, putting up with more complexity, but gaining more power and conciseness.

    com_channels

    • mail(dlinsin@gmail.com)
    • jabber(dlinsin@gmail.com)
    • skype(dlinsin)

    recent_postings

    loading...