I want to fix the diversity on my event, help me!

If someone linked you this post is probable you are organizing an event where diversity and inclusivity is an issue and they want to help you fix that. If you want, you can jump to the subsection that better adjust to your case. Remember: diversity is not a TL;DR, you probably need to read the full article to get a better grasp of what you need. As usual: I’m going to focus on the gender gap because it’s easier for me to talk in those terms, but similar strategies can be applied to any other under-represented group.

I was told I have a manel, what’s that?

A manel is a panel full of men (usually white and middle aged). Usually this manel is the main panel or the keynoters panel whose members are the most relevant/the most advertised speakers. They are the display case of your event and they may tell more about your event than you probably suspect.

Bonus track: Have you heard about the Techdel Test?

But I had no women speaker candidates for my event!

It doesn’t matter if it was a set of speakers chosen manually or if you sent a call for papers to the internet waiting for proposals. If you have few (or none) proposals that improve your diversity line-up, something went wrong. Because there are women (and PoC and functionally diverse speakers) out there. You just didn’t met them. But don’t worry, there’s many things you can do to improve it.

Continue reading “I want to fix the diversity on my event, help me!”

How can I get a diverse and inclusive team?

TL;DR: If you are really interested on improving the inclusivity and diversity on your team, you need more than a TL;DR

TL;DR: Ok, there is a video on gvSIG Festival on diversity that cover most of the contents here.

Why do we need inclusivity and diversity?

Do we really need to explain the problem of diversity? IT is mainly white and male. Even the most egalitarian person have biases due to have lived on a non egalitarian world and this reflects on our community. There are also society pressure to some groups of persons not to work on IT.

“True peace is not merely the absence of tension; it is the presence of justice.”

Martin Luther King

In short, diversity should just be a matter of Social Justice.

But if you are looking for more purely economical reasons, recent studies have shown that diverse teams are more efficient and provide more quality outputs [1][2]. This means that even when a company invest explicitly on improve their inclusivity and diversity, the return of investment is usually high. Investing in diversity is a win win situation, but it requires some deconstruction and some effort from all the people involved.

Continue reading “How can I get a diverse and inclusive team?”

Personalized Event Listeners in Java

Although the Observer pattern is implemented natively in Java, sometimes we need to make an event management that suits better our needs when using event listeners.

Some context

The problem of event handling is very simple: We have an object that will be changing its state. Without touching its code, we should be able to “hook” to other objects that are pending status changes and act accordingly. This “hook” must be turned on and off dynamically at runtime.

To implement it we will use a static object, a class and an interface. The static object will be responsible for ensuring the relationships between observers and observables. It will also notify relevant changes to the objects concerned. To pass information during an event we use that class. The interfaces will make the distinction between objects observed and observable objects and any other objects on the application.

A real example

But the best way to see how event listeners works is through an example:

The instances of the class will be those that carry MyCustomEvent information to an observable object from the observed object when an event occurs. This class should contain all the necessary information on that event. For example, if the event was a mouse click, this class should carry data such as coordinates on the screen or the number of clicks. Specifically, our event class contains only the original object that triggered the event (the observable object).

import java.util.EventObject;
import java.util.LinkedList;
import java.util.List;

public class MyCustomEvent extends EventObject {

  private static final long serialVersionUID = 7383182229898306240L;

  private final MyCustomListener source;

  public MyCustomEvent (MyCustomListener OriginalSource) {
    super (OriginalSource);
    this.source = OriginalSource;
  }

 MyCustomListener public getSource () {
    this.source return;
  }
}

The static object that keeps the relations between observers and observables is MyCustomEventHandler. It is very important to use synchronization methods to avoid concurrency issues in multithreaded applications:

import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class MyCustomEventHandler {
  private static final Log log = LogFactory.getLog(MyCustomEventHandler.class);

  private static Map <MyCustomListener, Set > = new LinkedHashMap observable <MyCustomListener, Set > ();

  public static void fire (MyCustomEvent event) {
    log.trace ("fire (" + event + ")");
    try {
      Observers = getRemarks September (source);
      if (Observers! = null) {
        for (final MyCustomListener pl: Observers) {
          try {
            pl.fire (event);
          } catch (Throwable t) {
            log.error (t, t);
          }
        }
      }
    } catch (Throwable t) {
      log.error (t, t);
    }
  } 

  private static synchronized September getRemarks (MyCustomListener source) {
    observables.get return (source);
  }

/ **
* Register to watch to alert you when observable change
*
* @ Param observer
* @ Param observable
* /
  public static synchronized void register (MyCustomListener observer, MyCustomListener observable) {
    Observers getRemarks September = (observable);
    if (null == observers) {
      observers = new HashSet();
    }
    observers.add(observer);
    observables.put(observable, Observers);
  }

/ **
* Deregister not become observers to alert you when observable
* Modify
*
* @ Param observer
* @ Param observable
* /
  public static synchronized void deregister (MyCustomListener observer, MyCustomListener observable) {
    Observers getRemarks September = (observable);
    if (null == Observers) {
      Observers = new HashSet ();
    }
    observers.remove (observer);
    observables.put (observable, Observers);
  }
}

Both objects (observable objects as observers) must implement the interface MyCustomListener. This interface requires implementing the function fire(MyCustomEvent event) . In the observable, this function will be responsible for calling MyCustomEventHandler. For observers, this function will be called when the observed object launches an event.

Actually, it would be convenient to separate the interface into two: one for observers and another for observables. If an object wants to be both observer and observed, it may have problems with this system. But for simplicity for the example we have chosen this implementation.

import java.util.EventListener;

public interface extends EventListener {MyCustomListener
  public void fire (MyCustomEvent event);
}

If we have different types of events (similar to how the MouseListener), all we need to do is to expand MyCustomListener interface with all the functionality we want to have:

import java.util.EventListener;

public interface MyCustomListener extends EventListener {
  public void fireObjectRecycled (MyCustomEvent event);
  public void fireObjectRefreshed (MyCustomEvent event);
  public void fireObjectUpdated (MyCustomEvent event);
}

So, we might use different classes derived from MyCustomEvent for each of these features.

We have to modify the static object MyCustomEventHandler to launch the different events.

References: thread which discusses this type of implementation of Event Handler