program comprehension: past, present, future
TRANSCRIPT
Janet Siegmund Program Comprehension 3
Higher-Level Programming Languages
Soloway & Ehrlich, 1984: Empirical Studies of Programming Knowledge
Janet Siegmund Program Comprehension 4
Measuring Program Comprehension
For… that‘s a loop… i = 1..2…3
?
Fill in the blankMemorization
Janet Siegmund Program Comprehension 5
Return Value of b
It should compute the median
Case for the odd array
That‘s the list of numbers…b should be 4.5
Case for the even array
public static void main(String [] args) {int [] data = {1, 2, 4, 5, 6, 10};computeMedian(data);
}
public int computeMedian(int[] data) { int[] data = data; sort(data); float b;
if (data.length % 2 == 1) b = data[data.length / 2]; else b = ((float) data[data.length / 2 - 1] +
(float) data[data.length / 2]) / 2;
return (b);}
Janet Siegmund Program Comprehension 6
Bottom-up comprehensionpublic static void main(String [] args) {
int [] data = {1, 2, 4, 5, 6, 10}; (data);
}
public int (int[] data) { int[] data = data; sort(data); float b;
if (data.length % 2 == 1) b = data[data.length / 2]; else b = ((float) data[data.length / 2 - 1] +
(float) data[data.length / 2]) / 2;
return (b);}
Weird variable naming
Check for odd array length…does not apply here
Even array… get entries at half the length… 4 and 5… sum and divde by 2… 4.5
it‘s the median
elephant
elephant
Janet Siegmund Program Comprehension 7
• How does this help us tounderstand theprogrammer of today?
• A little:– Useful variable names– Code layout– Tool support
public int enterprise (int[] kirk) { int[] data = kirk; sort(data); float picard; if (data.length % 2 == 1) picard = data[data.length / 2]; else picard = ((float) data[data.length / 2 - 1] +
(float) data[data.length / 2]) / 2;
return (picard);}
Present
Janet Siegmund Program Comprehension 8
Why Did Research onProgram Comprehension Stop?
What is more productive to use, a statically or dynamically typed language?
Janet Siegmund Program Comprehension 9
In the wild (realistic) In the lab (controlled)
Maximizeinternal validity
Reliably explains the causes of effects
Hard to generalize
Maximizeexternal validityReveals generally occurring effects
Causes of effects unclear A fundamentaltradeoff!
Janet Siegmund Program Comprehension 10
Neuro-Imaging MethodsElectroencephalography (EEG)
Higher cognitive load during programming task is reflected in the EEG signal
Janet Siegmund Program Comprehension 11
Functional Magnetic Resonance Imaging
Mirror
Screen
Head coil
MRI scanner
Janet Siegmund Program Comprehension 12
public static void main(String[] args) { int[] array = {1, 2, 4, 5, 6, 10}; sort(array); float b;
if (array.length % 2 == 1) b = array[array.length / 2]; else b = ((float)array[array.length / 2 - 1]
+ (float)array[array.length / 2]) / 2;
System.out.println(b);}
public static void main(String[] args) { int[] array = {1, 6, 4};
for (int i = 0; i <= array.length / 2 - 1; i++){ int tmp = array[array.length - i - 1]; array[array.length - i - 1] = array[i]; array[i] = tmp; }
for (int i = 0; i <= array.length - 1; i++) { System.out.println(array[i]); }}
public static void main(String[] args) { String word = "Hello"; String result = new String();
for (int j = word.length() - 1; j >= 0; j--) result = result + word.charAt(j);
System.out.println(result);}
Source-Code Snippets
Janet Siegmund Program Comprehension 13
BA21BA47Language processing:• Natural and artifical• Semantic processing at word level• Combinatorial aspects
VXVS
VXXXS
Adhering to grammar?
TPTXVS
TPTPS
Results
Janet Siegmund Program Comprehension 14
BA21
Raven‘s Progressive Matrices
Problem solvingDivided attentionSilent word readingWorking memory
Results
Janet Siegmund Program Comprehension 16
ResultPosterior cingulate cortex (BA31post)
Posterior cingulate cortex (BA31ant)
Prefrontal midline area (BA32)
Neuro-imaging methods provide interesting new
insights into developer‘s heads
Janet Siegmund The Human Factor in Computer Science 17
Perspective: Teaching
Object-oriented programming?
Functional programming?
How should we teach beginning programmers?Language Skills?