Archive for January, 2012

Google Guava EventBus – an easy and elegant way for your publisher – subscriber use cases

Tags: , ,

Google Guava in version number 10 introduced new package eventbus with a few very interesting classes to deal with listener (or publisher – subscriber) use case. Below I present my short introduction to EventBus class and its family.

Basics

To listen to some events we need a listener class. Such class created in google-guava-way doesn’t have to implement any particular interface or extend any specified class. It can be any class with just one required element: a method marked with @Subscribe annotation:

public class EventListener {

    public int lastMessage = 0;

    @Subscribe
    public void listen(OurTestEvent event) {
        lastMessage = event.getMessage();
    }

    public int getLastMessage() {
        return lastMessage;
    }
}

lastMessage property is used in tests below to check if events were received successfully.

And of course we need an event class to send it around:

public class OurTestEvent {

    private final int message;

    public OurTestEvent(int message) {
        this.message = message;
    }

    public int getMessage() {
        return message;
    }
}

How it works

The best way to show something in action is to write some tests, so let’s see how simple usage of EventBus looks like:

Continue reading this post …


Be Sociable, Share!

Human side of Agile methodology – review of “Individuals and Interactions: An Agile Guide”

Tags: , , , , ,

Some time ago, after I had written a review of The Clean Coder, I received a tweet from @InformIT saying that they liked my review. And then, after a few e-mails with person from Pearson I received three selected books to read and review. Individuals and Interactions: An Agile Guide is the first of them.

Review

You all probably know this sentence:

“Individuals and interactions over processes and tools”, but for those who don’t, this is the first point of Agile Manifesto, a set of principles defining agile software development. And if I had to describe or review this book in one sentence, this one would be the best to describe content and general philosophy of this title.

In my opinion most of the books regarding Agile are about other four principles and the first one is somehow forgotten and neglected. But Individuals and Interactions: An Agile Guide is quite different as it (as title might suggest :) ) concentrates mostly on people as a team members. It shows how to take advantage of differences in developers personalities, how easily find and use “work-arounds” for those differences that might cause some trouble and ferment among the team and how to prepare to conflicts that might occur so they won’t distract members of team from doing their job. And last but not least, it shows how to motivate people in a various ways and create effectively working and well communicating team from different personalities without leaving anyone feeling used, ignored or alienated.

Continue reading this post …


Be Sociable, Share!