Login | Register
My pages Projects Community openCollabNet

Discussions > The Developers' mailing list > [argouml-dev] Remove 11 Blob listeners

Discussion topic

Back to topic list

[argouml-dev] Remove 11 Blob listeners

Author arnob
Full name Arnaud
Date 2017-01-18 10:00:28 PST
Message Hi guys,

Sorry in advance for the long text (and you can refer to the patch we submitted here: http://argouml.tigri​s.org/issues/show_bu​g.cgi?id=6524)

We are researchers in software engineering that currently work on user interface
(UI) bad coding practices. We are studying UI listeners, in particular listeners
that manage several widgets, like the following listener extracted from ArgoUML:

public void itemStateChanged(ItemEvent e) {
    Object src = e.getSource();
    Fig target = getPanelTarget();
    if (e.getStateChange() == ItemEvent.SELECTED
        && target instanceof FigText) {
    if (src == fontField) {
    } else if (src == sizeField) {
    } else if (src == styleField) {
    } else if (src == justField) {
    } else if (src == textColorField) {
        if (e.getItem() == getCustomItemName()) {
                    ((FigText) target).getTextColor());
    } else {

In such listeners, the source widget is identified using if/switch statements.
Thanks to empirical studies we have indications that such a practice has a
negative impact on the code quality. We call UI listeners that control three or
more widgets, Blob Listeners (see this PDF document for more details:

We identified in ArgoUML 11 instances of the Blob listener for which we have a
refactoring solution. This patch removes these 11 Blob listeners by splitting
them into atomic UI listeners (i.e. they manage a single widget). We manually
tested ArgoUML for any regression. The new code is less complex in terms of
cyclomatic complexity (CC) and lines of code (LoC): the new code has -35 LoCs
and -54 of CC on the refactored files (according to Sonar analyses).

Complementary to this path, we have several questions for the ArgoUML's developers:

1/ Do you think that coding UI listeners that manage several widgets is a bad
coding practice?

2/ Do you think that the threshold of three or more widgets per listener
relevant for characterising a Blob listener?

3/ Do you consider the refactored code suitable for removing Blob listeners?

4/ Do you have any idea of the reason of the presence of Blob listeners in the code?
For example, lack of anonymous functions (aka lambdas) in Java 7 (and previous
JDKs)? Mutltiple developers? etc.

5/ Do you have suggestions about other bad user interface coding practices? This
can concern controllers, commands, GUIs, widgets, data bindings, GUI testing, etc.

-- Arno

« Previous message in topic | 1 of 1 | Next message in topic »


Show all messages in topic

[argouml-dev] Remove 11 Blob listeners arnob Arnaud 2017-01-18 10:00:28 PST
Messages per page: