Model Oriented Programming: An Empirical Study of Comprehension Omar Badreddin Andrew Forward...

29
Model Oriented Programming: An Empirical Study of Comprehension Omar Badreddin Andrew Forward Timothy C. Lethbridge try.umple.org

Transcript of Model Oriented Programming: An Empirical Study of Comprehension Omar Badreddin Andrew Forward...

Model Oriented Programming: An Empirical Study of

Comprehension

Omar Badreddin

Andrew Forward

Timothy C. Lethbridge

try.umple.org

2

3

Technology TrendL

evel

s o

f A

bst

ract

ion

Assembly

Pascal

Java, C++

Alf, Umple

4

What is Umple?

• Model Oriented Programming• Add modeling abstractions to code

– Class diagram– State machines

• Model-Code Duality

• State-of-the-art code generation

• Open source (Google Code)

• Available online (try.umple.org) as well as on the command line and in Eclipse

5

Examples of Umple code

6

7

Associations

8

State Machines

9

What else can you model in Umple

• Composite state machine.– Nested– Concurrent

• Do Activities in state machines

• Tracing directives

• Aspect-oriented concepts– Code injection (Before, After)

• Certain patterns (e.g. singleton, immutable)

10

Umple online (try.umple.org)

11

Development Approaches

• Model-Only

• Code-Only

• A mix of Code and Model (Complete running systems)

12

Technology trend revisited

main

mov cx,3

loopstart: do

mov dh,10 ;row 10

mov dl,20 ;column 20

call Gotoxy ;locate cursor

PromptForIntegers

ArraySum

DisplaySum ENDP

END main

for (int i = 0; i < 3; i++)

12

JavaJava

AssemblyAssembly

13

Technology trend revisited

public boolean e() {

boolean wasEventProcessed = false;

Status aStatus = status;

switch (aStatus) {

case On:

setStatus(Status.Off);

wasEventProcessed = true;

break;

case Off:

setStatus(Status.Off);

wasEventProcessed = true;

break; }

return wasEventProcessed; }

status { On { e -> Off;} Off{ e -> Off;}}

13

UmpleUmple

JavaJava

14

Experiment Hypotheses & Design

15

Hypothesis

• H1: A system written in Umple is more comprehensible than an equivalent Java implementation of the system

– H10: Umple and Java do not differ in comprehensibility

• H2: A system written in Umple has a different comprehensibility level than an equivalent UML diagram of the system

– H20: Umple and UML diagrams do not differ in comprehensibility

16

Experiment Design

Umple UML

Java

17

Experiment Design

Umple UML

Java

C

MM

C

18

Umple UML

Java

C

MM

C

T V

T

Experiment Design

19

Umple

Java

C

M

C

T

T

Comparing Umple & Java

Common to both:Textual syntaxComplete system

Natural advantage to Java:Familiarity

20

Umple UMLC

MM

T V

Comparing Umple and UML

Common to both:Modeling notation

Natural advantage to UML:FamiliarityModel only (fewer details)

21

Experiment Procedure

22

Experiment Procedure

System Example

Analyze

9 Participants3 system examples represented in 3

notations (Umple, UML, Java)

12 Questions per example

Measure time, count number

of incorrect responses

Mix of students and professionals

Questions reflect comprehension and

some require tracing

23

Experiment Results

24

Average Response Time

Participants

25

Box Plot of Response Time

Notation

26

Statistical tests

• Examining Data for Umple and Java– Mann-Whitney test ((p = 8.9x10-9)– Two Tailed t-test: Umple was faster for users than Java

(p=1.5x10-8)

• Examining Data for Umple and UML– Mann-Whitney test (p = 0.2)– Two Tailed t-test: Umple ~ UML (p=0.9)

• Number of errors

27

Threats of Validity

• Number of Participants and their experience• Will users interpret questions consistently?

• Fairness of comparing Umple, UML, and Java– Umple & Java / Umple and UML

• Examples could be too simple, not realistic/representative, not ‘the same’ as each other

• Time for response is very small.

• External validity (can it scale to real systems?)

28

Conclusion

• Modeling abstractions embedded in code enhances comprehensibility.

• Such abstractions retain comprehensibility benefits as evident in UML.

• Replication of experiment

• Experimenting with larger, more complex system examples and tasks.

Future Work

29