During many project engagements I have been involved in offshore development environments. Personally I always felt like “that’s not going to pay off”, you spend way more time in communication and mostly so-called “Offshore Senior Level Engineers” didn’t have the proper level of education as you would expect locally.

I was forwarded an extremely hilarious communication between an offshore senior Java EE developer and a local developer. Just make up your mind…

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
[10/15/2009 2:23:57 PM] LOCAL_STAFF says: ok, let's try it different:
[10/15/2009 2:24:03 PM] LOCAL_STAFF says:     public int retrieveOverallHealthStatus(Integer[] states)
    {
        for (Integer result : states)
        {
            switch ((Integer) (result))
            {
            case ERROR:
                return ERROR;
            case WARNING:
                return WARNING;
            case GOOD:
                break;
            }
        }
        return GOOD;
    }
[10/15/2009 2:24:27 PM] LOCAL_STAFF says: This is basically the same method, only it receives the list already as input. So no jGroups here, no JMX.
[10/15/2009 2:25:28 PM] LOCAL_STAFF says: This method still has the same problem, if we provide two elements in the list with



states[0] = WARNING
states[1] = ERROR



then we return "WARNING" as highest overall state, which is simply not true, as there is an ERROR state as well.



This is the problem that this Ticket talks about!
[10/15/2009 2:31:30 PM] OFFSHORE_STAFF says: in this particualr example you gaveme, it will run through the loop and willl check the last element in the array which is  states[1] that is ERROR
[10/15/2009 2:32:32 PM] OFFSHORE_STAFF says: it will break of 2nd time from the switch stament with state ERRO
[10/15/2009 2:32:37 PM] LOCAL_STAFF says: in the first iteration of the loop, it will reach the "return WARNING" for the states[0] already and there it will return WARNING, where it should return ERROR in this case from the method.
[10/15/2009 2:33:49 PM] OFFSHORE_STAFF says: so you are saying that instead of checking it chronologicallay, one shouldb check it in a combined format
[10/15/2009 2:33:59 PM] OFFSHORE_STAFF says: instead of switch
[10/15/2009 2:36:41 PM] OFFSHORE_STAFF says: we will use  if (  ( state[0] == ERRO || sate[1]==ERROR] retnr error;
[10/15/2009 2:37:01 PM] OFFSHORE_STAFF says: right?
[10/15/2009 2:40:33 PM] OFFSHORE_STAFF says: something like
[10/15/2009 2:40:35 PM] OFFSHORE_STAFF says: public int retrieveOverallHealthStatus(Integer[] states)
    {
        for (Integer result : states)
        {
            if states[0]==ERROR || states[1]==ERROR
   return ERROR;
        }
        return GOOD;
    }
[10/15/2009 2:40:57 PM] OFFSHORE_STAFF says: sorry
[10/15/2009 2:41:33 PM] OFFSHORE_STAFF says: public int retrieveOverallHealthStatus(Integer[] states)
    {
        for (Integer result : states)
        {
            if states[i]==ERROR    return ERROR;
        }
        return GOOD;
    }
[10/15/2009 2:41:47 PM] OFFSHORE_STAFF says: is that what you are sussgesting?
[10/15/2009 2:42:39 PM] LOCAL_STAFF says: no, sorry
[10/15/2009 2:47:16 PM] OFFSHORE_STAFF says: public int retrieveOverallHealthStatus(Integer[] states)
    {
        for (Integer result : states)
        {
            if states.toInteger().value().equals(ERROR)
   return ERROR;
        }
        return GOOD;
    }
[10/15/2009 2:49:17 PM] OFFSHORE_STAFF says: perhaps
[10/15/2009 2:49:20 PM] OFFSHORE_STAFF says: public int retrieveOverallHealthStatus(Integer[] states)
    {
        for (Integer result : states)
        {
            if states.toInteger().value().equals(ERROR)
   return ERROR;



   if states.toInteger().value().equals(WARNING)
   return WARNING;
        }
        return GOOD;
    }
[10/15/2009 2:49:43 PM] OFFSHORE_STAFF says: is that what you were implying
[10/15/2009 2:50:09 PM] LOCAL_STAFF says: they all don't solve the case that I showed above, just try to step through your code with the input that I gave, or better, write a small unit test...
[10/15/2009 2:50:39 PM] OFFSHORE_STAFF says: is it easier for mathias or yourself ot do it?
[10/15/2009 2:51:44 PM] LOCAL_STAFF says: no, we've got ClearCase disconnected over here today...
[10/15/2009 2:51:56 PM] OFFSHORE_STAFF says: hehe
[10/15/2009 2:52:02 PM] OFFSHORE_STAFF says: not being funny
[10/15/2009 2:52:14 PM] OFFSHORE_STAFF says: but can you email me what you think is the right soltiuion
[10/15/2009 2:52:53 PM] OFFSHORE_STAFF says: i mean this is basic prgramming right
[10/15/2009 2:52:59 PM] OFFSHORE_STAFF says: as yu mentioned earlier

Comments