How to Measure Software Redundancy
|
|
- Winifred Clark
- 5 years ago
- Views:
Transcription
1 How to Measure Software Redundancy Andrea Mattavelli University of Lugano, Switzerland In collaboration with: A. Carzaniga, M. Pezzè ( and A. Gorla, A. Goffi, N. Perino)
2 Software Redundancy
3 ... Software Redundancy Version 1 Input Checkpoint Execute Version Test Output Input Version 2 Selection Algorithm Output Exception Restore Fail Version n Yes Alternatives? No Fail N-version Recovery Blocks
4 ... Software Redundancy Deliberate Version 1 Input Checkpoint Execute Version Test Output Input Version 2 Selection Algorithm Output Exception Restore Fail Version n Yes Alternatives? No Fail N-version Recovery Blocks
5 Software Redundancy Intrinsic
6 Software Redundancy Intrinsic Google Guava MultiMap m = new MultiMap(); // //add a key-value pair in the map m.put(key, value);
7 Software Redundancy Intrinsic Google Guava MultiMap m = new MultiMap(); // //add a key-value pair in the map m.put(key, value); m.putall(key, new List().add(value)); m.entryset().add(new Entry(key, value));
8 Software Redundancy Intrinsic Joda-Time equivalences SWT GraphStream
9 Exploiting Intrinsic Redundancy Automatic Recovery From Runtime Failures Carzaniga, Gorla, Mattavelli, Perino, Pezzè [ICSE 2013] Cross-checking Oracles from Intrinsic Software Redundancy Goffi, Carzaniga, Gorla, Mattavelli, Pezzè [ICSE 2014]
10 Automatic Runtime Recovery A B Application state space
11 Automatic Runtime Recovery A Fault B Application state space
12 Automatic Runtime Recovery A Failure detection Fault B Application state space
13 Automatic Runtime Recovery A Checkpoint / Restore Fault Failure detection B Application state space
14 Automatic Runtime Recovery A Checkpoint / Restore Fault Failure detection Workaround B Application state space
15 Automatic Runtime Recovery Guava JodaTime Caliper Carrot2 Closure compiler FB2PDF Mutants Successfully recovered 27% 48% 43% 19%
16 Software Redundancy
17 Software Redundancy?
18 Software Redundancy? Intrinsic Google Guava MultiMap m = new MultiMap(); // //add a key-value pair in the map m.put(key, value); m.putall(key, new List().add(value)); m.entryset().add(new Entry(key, value)); How much code do they share?
19 ... Software Redundancy? Deliberate Intrinsic Version 1 Google Guava Input Version 2 Version n Selection Algorithm Output MultiMap m = new MultiMap(); // //add a key-value pair in the map m.put(key, value); m.putall(key, new List().add(value)); m.entryset().add(new Entry(key, value)); N-version Failures are correlated [Knight et al.] How much code do they share?
20 ... Software Redundancy? Deliberate Intrinsic Version 1 Google Guava Input Version 2 Version n Selection Algorithm Output MultiMap m = new MultiMap(); // //add a key-value pair in the map m.put(key, value); m.putall(key, new List().add(value)); m.entryset().add(new Entry(key, value)); N-version How much redundancy is there?
21 ... Software Redundancy? Deliberate Intrinsic Version 1 Google Guava Input Version 2 Version n Selection Algorithm Output MultiMap m = new MultiMap(); // //add a key-value pair in the map m.put(key, value); m.putall(key, new List().add(value)); m.entryset().add(new Entry(key, value)); N-version How much redundancy is there? Measuring Software Redundancy Carzaniga, Mattavelli, Pezzè [ICSE 2015]
22 Informal Definition of Redundancy Two fragments are redundant when they are functionally equivalent and at the same time their executions are different.
23 Informal Definition of Redundancy S0 CA Sn
24 CA
25 CA CB
26 CA Equivalence CB
27 CA Execution Diversity CB
28 Functional Equivalence S CA CB
29 Functional Equivalence
30 Observational Equivalence
31 Observational Equivalence CP OCP OCP CP
32 Observational Equivalence CP OCP OCP CP
33 Observational Equivalence CP2 CP3 CP4 CP OCP OCP2 OCP3 OCP4 OCP OCP2 OCP3 OCP4 CP CP2 CP3 CP4
34 Execution Diversity CA CB
35 Execution Diversity S CA Execution CA Execution CB CB
36 Execution Diversity Execution CA actiona actionb actionc actiond actionz actionb actionc actiond Execution CB
37 Execution Diversity Execution CA actiona actionb actionc actiond actionz actionb actionc actiond Execution CB
38 Software Redundancy Observational Equivalence Execution Diversity
39 Software Redundancy Observational Undecidable Equivalence Execution Diversity
40 Software Redundancy Observational Undecidable Equivalence Execution Diversity Binary measure Richer measure
41 A Practical Measure of Redundancy
42 A Practical Measure of Redundancy R= f ) Degree of Degree of Equivalence Diversity (,
43 A Practical Measure of Redundancy RS = es(ca,cb) ds(ca,cb) es, ds [0,1]
44 A Practical Measure of Redundancy RS = es(ca,cb) 0 ds(ca,cb) es, ds [0,1]
45 A Practical Measure of Redundancy RS = es(ca,cb) ds(ca,cb) 0 es, ds [0,1]
46 A Practical Measure of Redundancy RS = es(ca,cb) 1 ds(ca,cb) 1 es, ds [0,1]
47 A Practical Measure of Redundancy RS = es(ca,cb) ds(ca,cb) es, ds [0,1]
48 A Practical Measure of Redundancy RS = es(ca,cb) ds(ca,cb) es, ds [0,1] R CA,CB = AGGREGATE(RS)
49 A Practical Measure of Redundancy Sample the state space RS = es(ca,cb) ds(ca,cb) es, ds [0,1] R CA,CB = AGGREGATE(RS)
50 A Practical Measure of Redundancy Observational equivalence measure RS = es(ca,cb) ds(ca,cb) es, ds [0,1] R CA,CB = AGGREGATE(RS)
51 A Practical Measure of Redundancy RS = es(ca,cb) ds(ca,cb) es, ds [0,1] Difference between executions R CA,CB = AGGREGATE(RS)
52 A Practical Measure of Redundancy RS = es(ca,cb) ds(ca,cb) es, ds [0,1] R CA,CB = AGGREGATE(RS) Aggregate the redundancy measure
53 Sampling the State Space
54 Sampling the State Space ArrayListMultimap var0 = ArrayListMultimap.create(); var0.clear(); ArrayListMultimap var3 = ArrayListMultimap.create(); var3.clear(); boolean var5 = var3.isempty(); ArrayListMultimap var6 = ArrayListMultimap.create(); var6.clear(); boolean var8 = var6.isempty(); boolean var9 = var3.putall((multimap) var6); java.util.list var11 = var3.removeall("hi!"); boolean var12 = var0.putall((short) (-1), (java.lang.iterable) var11); var0.clear(); ArrayListMultimap var14 = ArrayListMultimap.create((Multimap) var0); ArrayListMultimap var17 = ArrayListMultimap.create(1, 10); var17.clear(); ArrayListMultimap var19 = ArrayListMultimap.create(); var19.clear(); ArrayListMultimap var21 = ArrayListMultimap.create((Multimap) var19); boolean var22 = var14.put(var17, var19);
55 Sampling the State Space ArrayListMultimap var0 = ArrayListMultimap.create(); var0.clear(); ArrayListMultimap var3 = ArrayListMultimap.create(); var3.clear(); boolean var5 = var3.isempty(); ArrayListMultimap var6 = ArrayListMultimap.create(); var6.clear(); boolean var8 = var6.isempty(); boolean var9 = var3.putall((multimap) var6); java.util.list var11 = var3.removeall("hi!"); boolean var12 = var0.putall((short) (-1), (java.lang.iterable) var11); var0.clear(); ArrayListMultimap var14 = ArrayListMultimap.create((Multimap) var0); ArrayListMultimap var17 = ArrayListMultimap.create(1, 10); var17.clear(); ArrayListMultimap var19 = ArrayListMultimap.create(); var19.clear(); ArrayListMultimap var21 = ArrayListMultimap.create((Multimap) var19); boolean var22 = var14.put(var17, var19); // Code fragment A
56 Observational Equivalence Measure ArrayListMultimap var0 = ArrayListMultimap.create(); var0.clear(); ArrayListMultimap var3 = ArrayListMultimap.create(); var3.clear(); boolean var5 = var3.isempty(); ArrayListMultimap var6 = ArrayListMultimap.create(); var6.clear(); boolean var8 = var6.isempty(); boolean var9 = var3.putall((multimap) var6); java.util.list var11 = var3.removeall("hi!"); boolean var12 = var0.putall((short) (-1), (java.lang.iterable) var11); var0.clear(); ArrayListMultimap var14 = ArrayListMultimap.create((Multimap) var0); ArrayListMultimap var17 = ArrayListMultimap.create(1, 10); var17.clear(); ArrayListMultimap var19 = ArrayListMultimap.create(); var19.clear(); ArrayListMultimap var21 = ArrayListMultimap.create((Multimap) var19); boolean var22 = var14.put(var17, var19); // Code fragment A
57 var0.clear(); ArrayListMultimap var14 = ArrayListMultimap.create((Multimap) var0); ArrayListMultimap var17 = ArrayListMultimap.create(1, 10); var17.clear(); ArrayListMultimap var19 = ArrayListMultimap.create(); var19.clear(); ArrayListMultimap var21 = ArrayListMultimap.create((Multimap) var19); boolean var22 = var14.put(var17, var19); // Code fragment A Observational Equivalence Measure
58 Observational Equivalence Measure // Code fragment A boolean var22 = var14.put(var17, var19); // linkage: boolean var22, ArrayListMultimap var14
59 Observational Equivalence Measure // Code fragment A // Code fragment B boolean var22 = var14.put(var17, var19); // linkage: boolean var22, ArrayListMultimap var14 List list = new List(); list.add(var19); boolean var22 = var14.putall(var17, list);
60 Observational Equivalence Measure // Code fragment A // Code fragment B boolean var22 = var14.put(var17, var19); // linkage: boolean var22, ArrayListMultimap var14 // generated probing code: System.out.println(var22); boolean x0 = var14.isempty(); System.out.println(x0); var14.clear(); java.util.map x1 = var14.asmap(); int x2 = var14.size(); System.out.println(x2); int x3 = x1.size(); System.out.println(x3); java.util.set x4 = x1.entryset(); java.util.iterator x5 = x4.iterator(); boolean x6 = x4.isempty(); System.out.println(x6); try { x5.remove(); } catch (java.lang.illegalstateexception e) { System.out.println(e); } //... probing code continues List list = new List(); list.add(var19); boolean var22 = var14.putall(var17, list);
61 Observational Equivalence Measure // Code fragment A // Code fragment B boolean var22 = var14.put(var17, var19); // linkage: boolean var22, ArrayListMultimap var14 List list = new List(); list.add(var19); boolean var22 = var14.putall(var17, list); true false 1 1 false // generated probing code: System.out.println(var22); boolean x0 = var14.isempty(); System.out.println(x0); var14.clear(); java.util.map x1 = var14.asmap(); int x2 = var14.size(); System.out.println(x2); int x3 = x1.size(); System.out.println(x3); java.util.set x4 = x1.entryset(); java.util.iterator x5 = x4.iterator(); boolean x6 = x4.isempty(); System.out.println(x6); try { x5.remove(); } catch (java.lang.illegalstateexception e) { System.out.println(e); } //... probing code continues true false 1 1 false
62 Observational Equivalence Measure es(ca,cb) = successful total CP1 CP2 CP3 CP4 CP5 CP6 CP7 CP8 CP9 CP10 es(ca,cb) = 1.0 CP1 CP2 CP3 CP4 CP5 CP6 CP7 CP8 CP9 CP10 es(ca,cb) = 0.7
63 Difference Between Executions ArrayListMultimap var0 = ArrayListMultimap.create(); var0.clear(); ArrayListMultimap var3 = ArrayListMultimap.create(); var3.clear(); boolean var5 = var3.isempty(); ArrayListMultimap var6 = ArrayListMultimap.create(); var6.clear(); boolean var8 = var6.isempty(); boolean var9 = var3.putall((multimap) var6); java.util.list var11 = var3.removeall("hi!"); boolean var12 = var0.putall((short) (-1), (java.lang.iterable) var11); var0.clear(); ArrayListMultimap var14 = ArrayListMultimap.create((Multimap) var0); ArrayListMultimap var17 = ArrayListMultimap.create(1, 10); var17.clear(); ArrayListMultimap var19 = ArrayListMultimap.create(); var19.clear(); ArrayListMultimap var21 = ArrayListMultimap.create((Multimap) var19); boolean var22 = var14.put(var17, var19);
64 ArrayListMultimap var14 = ArrayListMultimap.create((Multimap) var0); ArrayListMultimap var17 = ArrayListMultimap.create(1, 10); var17.clear(); ArrayListMultimap var19 = ArrayListMultimap.create(); var19.clear(); ArrayListMultimap var21 = ArrayListMultimap.create((Multimap) var19); boolean var22 = var14.put(var17, var19); Difference Between Executions
65 Difference Between Executions boolean var22 = var14.put(var17, var19); // Trace code fragment A Code Projections
66 Difference Between Executions boolean var22 = var14.put(var17, var19); // Trace code fragment A Code Projections Statement ArrayListMultimap.put(LObject;LObject;)Z@66 AbstractListMultimap.put(LObject;LObject;)Z@95 AbstractMultimap.put(LObject;LObject;)Z@200 Statement, Depth 3:ArrayListMultimap.put(LObject;LObject;)Z@66 4:AbstractListMultimap.put(LObject;LObject;)Z@95 5:AbstractMultimap.put(LObject;LObject;)Z@200
67 Difference Between Executions boolean var22 = var14.put(var17, var19); // Trace code fragment A Data Projections Type, Value Ljava/util/Map; {} Ljava/util/Set; [] Ljava/util/HashMap; {} I 1 I 1 Class, Field, Value AbstractMultimap.map {} HashMap.entrySet [] HashMap$EntrySet.this$0 {} HashMap$HashIterator.modCount 1 HashMap$HashIterator.expectedModCount 1
68 Difference Between Executions Code projection CA Code projection CB
69 Difference Between Executions Code projection CA Code projection CB ds(ca,cb) = 1-SIMILARITY(PS,A, PS,B)
70 A Practical Measure of Redundancy
71 A Practical Measure of Redundancy e s d s R s S S S S S S S S S S S
72 A Practical Measure of Redundancy e s d s R s S S S S S S S S S S S
73 A Practical Measure of Redundancy e s d s R s S S S S S S S S S S S
74 A Practical Measure of Redundancy e s d s R s S S S S S S S S S S S
75 A Practical Measure of Redundancy e s d s R s S S S S S S S S S S S R = AVG(Rs) = ± 0.10
76 Evaluation In theory, there is no difference between theory and practice. But, in practice, there is. - van de Snepscheut
77 Evaluation Is the proposed measure consistent? Are the measurements significant and useful?
78 Evaluation Is the proposed measure consistent? Are the measurements significant and useful?
79 Consistency: Stability
80 Consistency: Stability Ground Truth Algorithm # Impl. Binary search 4 Linear search 4 Bubble sort 7 Insertion sort 3 Merge sort 4 Quicksort 3
81 Redundancy Consistency: Stability Code Projections Extract to local variable Change name Inline expression Extract method Equivalent input ADice Man Cos DamLev Dice Euclid Jaccard Jaro JaroW Lev MC Need Ovlp qgrams SmithW SmithG Redundancy Data Projections Extract to local variable Change name Inline expression Extract method Equivalent input ADice Man Cos DamLev Dice Euclid Jaccard Jaro JaroW Lev MC Need Ovlp qgrams SmithW SmithG
82 Evaluation Is the proposed measure consistent? Are the measurements significant and useful?
83 Low-level vs High-level Code Redundancy vs Algorithmic Redundancy
84 Low-level vs High-level Code Redundancy vs Algorithmic Redundancy Binary search Linear search 1 1 Redundancy Redundancy DamLev Lev Need SmithW SmithG 0 DamLev Lev Need SmithW SmithG Same algorithm, different implementation Bubble sort Insertion sort 1 1 Redundancy Redundancy DamLev Lev Need SmithW SmithG 0 DamLev Lev Need SmithW SmithG
85 Low-level vs High-level Code Redundancy vs Algorithmic Redundancy Binary search Linear search 1 1 Redundancy Redundancy DamLev Lev Need SmithW SmithG 0 DamLev Lev Need SmithW SmithG Same algorithm, different implementation Bubble sort Insertion sort 1 1 Redundancy Redundancy DamLev Lev Need SmithW SmithG 0 DamLev Lev Need SmithW SmithG
86 Low-level vs High-level Code Redundancy vs Algorithmic Redundancy Binary search Linear search 1 1 Redundancy Redundancy DamLev Lev Need SmithW SmithG 0 DamLev Lev Need SmithW SmithG Different algorithm Bubble sort Insertion sort 1 1 Redundancy Redundancy DamLev Lev Need SmithW SmithG 0 DamLev Lev Need SmithW SmithG
87 Predictive Ability
88 Predictive Ability Automatic Runtime Recovery A Checkpoint / Restore Fault Failure detection Workaround B Application state space
89 Predictive Ability Automatic Runtime Recovery A Checkpoint / Restore Fault Failure detection Workaround B Application state space Does redundancy correlate with success?
90 Predictive Ability System Method (C A ) Workaround (C B ) Success ratio Redundancy Iterators.forArray(a) Arrays.asList(a).iterator() 3/3 (100%) 1.00 ± 0.00 LinkedHashMultiset.retainAll(Collection c) foreach(o in map) if(o not in c) map.remove(o); 1/2 (50%) 0.61 ±0.01 ArrayListMultimap.putAll(Object k,collection c) foreach(o in c) put(k,o); 8/41 (20%) 0.37 ±0.32 Caliper LinkedHashMultimap.putAll(Object k, Collection c) foreach(o in c) put(k,o); 0/1 (0%) 0.00 ±0.00 Caliper LinkedHashMultimap.create() create(100,100) 0/207 (0%) 0.12 ±0.15 LinkedHashMultimap.create(int,int) create() 0/202 (0%) 0.12 ±0.15 LinkedHashMultimap.isEmpty() size() == 0? true : false 0/34 (0%) 0.00 ±0.00 ImmutableMultiset.of(Object..c) foreach(o in c) builder().setcount(o,count(o in c)) 13/22 (59%) 0.56 ±0.07 ImmutableMultiset.of(Object..c) builder().add(..c).build() 7/19 (37%) 0.24 ±0.12 ArrayListMultimap.putAll(Object k,collection c) foreach(o in c) put(k,o); 1/13 (8%) 0.37 ±0.32 ImmutableMultiset.of(Object o) builder().add(o).build() 0/1 (0%) 0.32 ±0.14 Lists.newArrayList() new ArrayList() 0/24 (0%) 0.00 ±0.00 Carrot Lists.newArrayList() new ArrayList(10) 0/24 (0%) 0.00 ±0.00 Lists.newArrayListWithCapacity(int c) new ArrayList() 0/20 (0%) 0.00 ±0.00 Carrot2 Lists.newArrayListWithCapacity(int c) new ArrayList(c) 0/20 (0%) 0.00 ±0.00 Maps.newHashMap() Maps.newHashMapWithExpectedSize(16) 0/54 (0%) 0.00 ±0.00 Maps.newHashMap() new HashMap() 0/54 (0%) 0.00 ±0.00 Maps.newHashMap() new HashMap(16) 0/54 (0%) 0.00 ±0.00
91 Predictive Ability System Method (C A ) Workaround (C B ) Success ratio Redundancy Iterators.forArray(a) Arrays.asList(a).iterator() 3/3 (100%) 1.00 ± 0.00 LinkedHashMultiset.retainAll(Collection c) foreach(o in map) if(o not in c) map.remove(o); 1/2 (50%) 0.61 ±0.01 ArrayListMultimap.putAll(Object k,collection c) foreach(o in c) put(k,o); 8/41 (20%) 0.37 ±0.32 Caliper LinkedHashMultimap.putAll(Object k, Collection c) foreach(o in c) put(k,o); 0/1 (0%) 0.00 ±0.00 Caliper LinkedHashMultimap.create() create(100,100) 0/207 (0%) 0.12 ±0.15 LinkedHashMultimap.create(int,int) create() 0/202 (0%) 0.12 ±0.15 LinkedHashMultimap.isEmpty() size() == 0? true : false 0/34 (0%) 0.00 ±0.00 ImmutableMultiset.of(Object..c) foreach(o in c) builder().setcount(o,count(o in c)) 13/22 (59%) 0.56 ±0.07 ImmutableMultiset.of(Object..c) builder().add(..c).build() 7/19 (37%) 0.24 ±0.12 ArrayListMultimap.putAll(Object k,collection c) foreach(o in c) put(k,o); 1/13 (8%) 0.37 ±0.32 ImmutableMultiset.of(Object o) builder().add(o).build() 0/1 (0%) 0.32 ±0.14 Lists.newArrayList() new ArrayList() 0/24 (0%) 0.00 ±0.00 Carrot Lists.newArrayList() new ArrayList(10) 0/24 (0%) 0.00 ±0.00 Lists.newArrayListWithCapacity(int c) new ArrayList() 0/20 (0%) 0.00 ±0.00 Carrot2 Lists.newArrayListWithCapacity(int c) new ArrayList(c) 0/20 (0%) 0.00 ±0.00 Maps.newHashMap() Maps.newHashMapWithExpectedSize(16) 0/54 (0%) 0.00 ±0.00 Maps.newHashMap() new HashMap() 0/54 (0%) 0.00 ±0.00 Maps.newHashMap() new HashMap(16) 0/54 (0%) 0.00 ±0.00
92 Predictive Ability System Method (C A ) Workaround (C B ) Success ratio Redundancy Iterators.forArray(a) Arrays.asList(a).iterator() 3/3 (100%) 1.00 ± 0.00 LinkedHashMultiset.retainAll(Collection c) foreach(o in map) if(o not in c) map.remove(o); 1/2 (50%) 0.61 ±0.01 ArrayListMultimap.putAll(Object k,collection c) foreach(o in c) put(k,o); 8/41 (20%) 0.37 ±0.32 Caliper LinkedHashMultimap.putAll(Object k, Collection c) foreach(o in c) put(k,o); 0/1 (0%) 0.00 ±0.00 Caliper LinkedHashMultimap.create() create(100,100) 0/207 (0%) 0.12 ±0.15 LinkedHashMultimap.create(int,int) create() 0/202 (0%) 0.12 ±0.15 LinkedHashMultimap.isEmpty() size() == 0? true : false 0/34 (0%) 0.00 ±0.00 ImmutableMultiset.of(Object..c) foreach(o in c) builder().setcount(o,count(o in c)) 13/22 (59%) 0.56 ±0.07 ImmutableMultiset.of(Object..c) builder().add(..c).build() 7/19 (37%) 0.24 ±0.12 ArrayListMultimap.putAll(Object k,collection c) foreach(o in c) put(k,o); 1/13 (8%) 0.37 ±0.32 ImmutableMultiset.of(Object o) builder().add(o).build() 0/1 (0%) 0.32 ±0.14 Lists.newArrayList() new ArrayList() 0/24 (0%) 0.00 ±0.00 Carrot Lists.newArrayList() new ArrayList(10) 0/24 (0%) 0.00 ±0.00 Lists.newArrayListWithCapacity(int c) new ArrayList() 0/20 (0%) 0.00 ±0.00 Carrot2 Lists.newArrayListWithCapacity(int c) new ArrayList(c) 0/20 (0%) 0.00 ±0.00 Maps.newHashMap() Maps.newHashMapWithExpectedSize(16) 0/54 (0%) 0.00 ±0.00 Maps.newHashMap() new HashMap() 0/54 (0%) 0.00 ±0.00 Maps.newHashMap() new HashMap(16) 0/54 (0%) 0.00 ±0.00
93 Predictive Ability System Method (C A ) Workaround (C B ) Success ratio Redundancy Iterators.forArray(a) Arrays.asList(a).iterator() 3/3 (100%) 1.00 ± 0.00 LinkedHashMultiset.retainAll(Collection c) foreach(o in map) if(o not in c) map.remove(o); 1/2 (50%) 0.61 ±0.01 ArrayListMultimap.putAll(Object k,collection c) foreach(o in c) put(k,o); 8/41 (20%) 0.37 ±0.32 Caliper LinkedHashMultimap.putAll(Object k, Collection c) foreach(o in c) put(k,o); 0/1 (0%) 0.00 ±0.00 Caliper LinkedHashMultimap.create() create(100,100) 0/207 (0%) 0.12 ±0.15 LinkedHashMultimap.create(int,int) create() 0/202 (0%) 0.12 ±0.15 LinkedHashMultimap.isEmpty() size() == 0? true : false 0/34 (0%) 0.00 ±0.00 ImmutableMultiset.of(Object..c) foreach(o in c) builder().setcount(o,count(o in c)) 13/22 (59%) 0.56 ±0.07 ImmutableMultiset.of(Object..c) builder().add(..c).build() 7/19 (37%) 0.24 ±0.12 ArrayListMultimap.putAll(Object k,collection c) foreach(o in c) put(k,o); 1/13 (8%) 0.37 ±0.32 ImmutableMultiset.of(Object o) builder().add(o).build() 0/1 (0%) 0.32 ±0.14 Lists.newArrayList() new ArrayList() 0/24 (0%) 0.00 ±0.00 Carrot Lists.newArrayList() new ArrayList(10) 0/24 (0%) 0.00 ±0.00 Lists.newArrayListWithCapacity(int c) new ArrayList() 0/20 (0%) 0.00 ±0.00 Carrot2 Lists.newArrayListWithCapacity(int c) new ArrayList(c) 0/20 (0%) 0.00 ±0.00 Maps.newHashMap() Maps.newHashMapWithExpectedSize(16) 0/54 (0%) 0.00 ±0.00 Maps.newHashMap() new HashMap() 0/54 (0%) 0.00 ±0.00 Maps.newHashMap() new HashMap(16) 0/54 (0%) 0.00 ±0.00
94 Predictive Ability System Method (C A ) Workaround (C B ) Success ratio Redundancy Iterators.forArray(a) Arrays.asList(a).iterator() 3/3 (100%) 1.00 ± 0.00 LinkedHashMultiset.retainAll(Collection c) foreach(o in map) if(o not in c) map.remove(o); 1/2 (50%) 0.61 ±0.01 ArrayListMultimap.putAll(Object k,collection c) foreach(o in c) put(k,o); 8/41 (20%) 0.37 ±0.32 Caliper LinkedHashMultimap.putAll(Object k, Collection c) foreach(o in c) put(k,o); 0/1 (0%) 0.00 ±0.00 Caliper LinkedHashMultimap.create() create(100,100) 0/207 (0%) 0.12 ±0.15 LinkedHashMultimap.create(int,int) create() 0/202 (0%) 0.12 ±0.15 LinkedHashMultimap.isEmpty() size() == 0? true : false 0/34 (0%) 0.00 ±0.00 ImmutableMultiset.of(Object..c) foreach(o in c) builder().setcount(o,count(o in c)) 13/22 (59%) 0.56 ±0.07 ImmutableMultiset.of(Object..c) builder().add(..c).build() 7/19 (37%) 0.24 ±0.12 ArrayListMultimap.putAll(Object k,collection c) foreach(o in c) put(k,o); 1/13 (8%) 0.37 ±0.32 ImmutableMultiset.of(Object o) builder().add(o).build() 0/1 (0%) 0.32 ±0.14 Lists.newArrayList() new ArrayList() 0/24 (0%) 0.00 ±0.00 Carrot Lists.newArrayList() new ArrayList(10) 0/24 (0%) 0.00 ±0.00 Lists.newArrayListWithCapacity(int c) new ArrayList() 0/20 (0%) 0.00 ±0.00 Carrot2 Lists.newArrayListWithCapacity(int c) new ArrayList(c) 0/20 (0%) 0.00 ±0.00 Maps.newHashMap() Maps.newHashMapWithExpectedSize(16) 0/54 (0%) 0.00 ±0.00 Maps.newHashMap() new HashMap() 0/54 (0%) 0.00 ±0.00 Maps.newHashMap() new HashMap(16) 0/54 (0%) 0.00 ±0.00
95 Predictive Ability System Method (C A ) Workaround (C B ) Success ratio Redundancy Iterators.forArray(a) Arrays.asList(a).iterator() 3/3 (100%) 1.00 ± 0.00 LinkedHashMultiset.retainAll(Collection c) foreach(o in map) if(o not in c) map.remove(o); 1/2 (50%) 0.61 ±0.01 ArrayListMultimap.putAll(Object k,collection c) foreach(o in c) put(k,o); 8/41 (20%) 0.37 ±0.32 Caliper LinkedHashMultimap.putAll(Object k, Collection c) foreach(o in c) put(k,o); 0/1 (0%) 0.00 ±0.00 Caliper LinkedHashMultimap.create() create(100,100) 0/207 (0%) 0.12 ±0.15 LinkedHashMultimap.create(int,int) create() 0/202 (0%) 0.12 ±0.15 LinkedHashMultimap.isEmpty() size() == 0? true : false 0/34 (0%) 0.00 ±0.00 ImmutableMultiset.of(Object..c) foreach(o in c) builder().setcount(o,count(o in c)) 13/22 (59%) 0.56 ±0.07 ImmutableMultiset.of(Object..c) builder().add(..c).build() 7/19 (37%) 0.24 ±0.12 ArrayListMultimap.putAll(Object k,collection c) foreach(o in c) put(k,o); 1/13 (8%) 0.37 ±0.32 ImmutableMultiset.of(Object o) builder().add(o).build() 0/1 (0%) 0.32 ±0.14 Lists.newArrayList() new ArrayList() 0/24 (0%) 0.00 ±0.00 Carrot Lists.newArrayList() new ArrayList(10) 0/24 (0%) 0.00 ±0.00 Lists.newArrayListWithCapacity(int c) new ArrayList() 0/20 (0%) 0.00 ±0.00 Carrot2 Lists.newArrayListWithCapacity(int c) new ArrayList(c) 0/20 (0%) 0.00 ±0.00 Maps.newHashMap() Maps.newHashMapWithExpectedSize(16) 0/54 (0%) 0.00 ±0.00 Maps.newHashMap() new HashMap() 0/54 (0%) 0.00 ±0.00 Maps.newHashMap() new HashMap(16) 0/54 (0%) 0.00 ±0.00
96 Predictive Ability System Method (C A ) Workaround (C B ) Success ratio Redundancy Iterators.forArray(a) Arrays.asList(a).iterator() 3/3 (100%) 1.00 ± 0.00 LinkedHashMultiset.retainAll(Collection c) foreach(o in map) if(o not in c) map.remove(o); 1/2 (50%) 0.61 ±0.01 ArrayListMultimap.putAll(Object k,collection c) foreach(o in c) put(k,o); 8/41 (20%) 0.37 ±0.32 Caliper LinkedHashMultimap.putAll(Object k, Collection c) foreach(o in c) put(k,o); 0/1 (0%) 0.00 ±0.00 Caliper LinkedHashMultimap.create() create(100,100) 0/207 (0%) 0.12 ±0.15 LinkedHashMultimap.create(int,int) create() 0/202 (0%) 0.12 ±0.15 LinkedHashMultimap.isEmpty() size() == 0? true : false 0/34 (0%) 0.00 ±0.00 ImmutableMultiset.of(Object..c) foreach(o in c) builder().setcount(o,count(o in c)) 13/22 (59%) 0.56 ±0.07 ImmutableMultiset.of(Object..c) builder().add(..c).build() 7/19 (37%) 0.24 ±0.12 ArrayListMultimap.putAll(Object k,collection c) foreach(o in c) put(k,o); 1/13 (8%) 0.37 ±0.32 ImmutableMultiset.of(Object o) builder().add(o).build() 0/1 (0%) 0.32 ±0.14 Lists.newArrayList() new ArrayList() 0/24 (0%) 0.00 ±0.00 Carrot Lists.newArrayList() new ArrayList(10) 0/24 (0%) 0.00 ±0.00 Lists.newArrayListWithCapacity(int c) new ArrayList() 0/20 (0%) 0.00 ±0.00 Carrot2 Lists.newArrayListWithCapacity(int c) new ArrayList(c) 0/20 (0%) 0.00 ±0.00 Maps.newHashMap() Maps.newHashMapWithExpectedSize(16) 0/54 (0%) 0.00 ±0.00 Maps.newHashMap() new HashMap() 0/54 (0%) 0.00 ±0.00 Maps.newHashMap() new HashMap(16) 0/54 (0%) 0.00 ±0.00
97 Predictive Ability System Method (C A ) Workaround (C B ) Success ratio Redundancy Iterators.forArray(a) Arrays.asList(a).iterator() 3/3 (100%) 1.00 ± 0.00 LinkedHashMultiset.retainAll(Collection c) foreach(o in map) if(o not in c) map.remove(o); 1/2 (50%) 0.61 ±0.01 ArrayListMultimap.putAll(Object k,collection c) foreach(o in c) put(k,o); 8/41 (20%) 0.37 ±0.32 Caliper LinkedHashMultimap.putAll(Object k, Collection c) foreach(o in c) put(k,o); 0/1 (0%) 0.00 ±0.00 Caliper LinkedHashMultimap.create() create(100,100) 0/207 (0%) 0.12 ±0.15 LinkedHashMultimap.create(int,int) create() 0/202 (0%) 0.12 ±0.15 LinkedHashMultimap.isEmpty() size() == 0? true : false 0/34 (0%) 0.00 ±0.00 ImmutableMultiset.of(Object..c) foreach(o in c) builder().setcount(o,count(o in c)) 13/22 (59%) 0.56 ±0.07 ImmutableMultiset.of(Object..c) builder().add(..c).build() 7/19 (37%) 0.24 ±0.12 ArrayListMultimap.putAll(Object k,collection c) foreach(o in c) put(k,o); 1/13 (8%) 0.37 ±0.32 ImmutableMultiset.of(Object o) builder().add(o).build() 0/1 (0%) 0.32 ±0.14 Lists.newArrayList() new ArrayList() 0/24 (0%) 0.00 ±0.00 Carrot Lists.newArrayList() new ArrayList(10) 0/24 (0%) 0.00 ±0.00 Lists.newArrayListWithCapacity(int c) new ArrayList() 0/20 (0%) 0.00 ±0.00 Carrot2 Lists.newArrayListWithCapacity(int c) new ArrayList(c) 0/20 (0%) 0.00 ±0.00 Maps.newHashMap() Maps.newHashMapWithExpectedSize(16) 0/54 (0%) 0.00 ±0.00 Maps.newHashMap() new HashMap() 0/54 (0%) 0.00 ±0.00 Maps.newHashMap() new HashMap(16) 0/54 (0%) 0.00 ±0.00
98 Predictive Ability System Method (C A ) Workaround (C B ) Success ratio Redundancy Iterators.forArray(a) Arrays.asList(a).iterator() 3/3 (100%) 1.00 ± 0.00 LinkedHashMultiset.retainAll(Collection c) foreach(o in map) if(o not in c) map.remove(o); 1/2 (50%) 0.61 ±0.01 ArrayListMultimap.putAll(Object k,collection c) foreach(o in c) put(k,o); 8/41 (20%) 0.37 ±0.32 Caliper LinkedHashMultimap.putAll(Object k, Collection c) foreach(o in c) put(k,o); 0/1 (0%) 0.00 ±0.00 Caliper LinkedHashMultimap.create() create(100,100) 0/207 (0%) 0.12 ±0.15 LinkedHashMultimap.create(int,int) create() 0/202 (0%) 0.12 ±0.15 LinkedHashMultimap.isEmpty() size() == 0? true : false 0/34 (0%) 0.00 ±0.00 ImmutableMultiset.of(Object..c) foreach(o in c) builder().setcount(o,count(o in c)) 13/22 (59%) 0.56 ±0.07 ImmutableMultiset.of(Object..c) builder().add(..c).build() 7/19 (37%) 0.24 ±0.12 ArrayListMultimap.putAll(Object k,collection c) foreach(o in c) put(k,o); 1/13 (8%) 0.37 ±0.32 ImmutableMultiset.of(Object o) builder().add(o).build() 0/1 (0%) 0.32 ±0.14 Lists.newArrayList() new ArrayList() 0/24 (0%) 0.00 ±0.00 Carrot Lists.newArrayList() new ArrayList(10) 0/24 (0%) 0.00 ±0.00 Lists.newArrayListWithCapacity(int c) new ArrayList() 0/20 (0%) 0.00 ±0.00 Carrot2 Lists.newArrayListWithCapacity(int c) new ArrayList(c) 0/20 (0%) 0.00 ±0.00 Maps.newHashMap() Maps.newHashMapWithExpectedSize(16) 0/54 (0%) 0.00 ±0.00 Maps.newHashMap() new HashMap() 0/54 (0%) 0.00 ±0.00 Maps.newHashMap() new HashMap(16) 0/54 (0%) 0.00 ±0.00 Correlation: 0.94
99
100 ... Software Redundancy? Deliberate Intrinsic Version 1 Google Guava Input Version 2 Version n Selection Algorithm Output MultiMap m = new MultiMap(); // //add a key-value pair in the map m.put(key, value); m.putall(key, new List().add(value)); m.entryset().add(new Entry(key, value)); N-version How much redundancy is there?
101 ... Software Redundancy? Informal Definition of Redundancy Deliberate Intrinsic Input Version 1 Version 2 Version n Selection Algorithm Output Google Guava MultiMap m = new MultiMap(); // //add a key-value pair in the map m.put(key, value); m.putall(key, new List().add(value)); m.entryset().add(new Entry(key, value)); Two fragments are redundant when they are functionally equivalent and at the same time their executions are different. N-version How much redundancy is there?
102 ... Software Redundancy? Informal Definition of Redundancy A Practical Measure of Redundancy Deliberate Intrinsic Input Version 1 Version 2 Version n Selection Algorithm Output Google Guava MultiMap m = new MultiMap(); // //add a key-value pair in the map m.put(key, value); m.putall(key, new List().add(value)); m.entryset().add(new Entry(key, value)); Two fragments are redundant when they are functionally equivalent and at the same time their executions are different. RS = es(ca,cb) ds(ca,cb) es, ds [0,1] N-version How much redundancy is there? R CA,CB = AGGREGATE(RS)
103 ... Software Redundancy? Informal Definition of Redundancy A Practical Measure of Redundancy Deliberate Intrinsic Input Version 1 Version 2 Version n Selection Algorithm Output Google Guava MultiMap m = new MultiMap(); // //add a key-value pair in the map m.put(key, value); m.putall(key, new List().add(value)); m.entryset().add(new Entry(key, value)); Two fragments are redundant when they are functionally equivalent and at the same time their executions are different. RS = es(ca,cb) ds(ca,cb) es, ds [0,1] N-version How much redundancy is there? R CA,CB = AGGREGATE(RS) Redundancy Consistency: Stability Code Projections Extract to local variable Change name Inline expression Extract method Equivalent input ADice Man Cos DamLev Dice Euclid Jaccard Jaro JaroW Lev MC Need Ovlp qgrams SmithW SmithG Redundancy Data Projections Extract to local variable Change name Inline expression Extract method Equivalent input ADice Man Cos DamLev Dice Euclid Jaccard Jaro JaroW Lev MC Need Ovlp qgrams SmithW SmithG
104 ... Software Redundancy? Informal Definition of Redundancy A Practical Measure of Redundancy Deliberate Intrinsic Input Version 1 Version 2 Version n Selection Algorithm Output Google Guava MultiMap m = new MultiMap(); // //add a key-value pair in the map m.put(key, value); m.putall(key, new List().add(value)); m.entryset().add(new Entry(key, value)); Two fragments are redundant when they are functionally equivalent and at the same time their executions are different. RS = es(ca,cb) ds(ca,cb) es, ds [0,1] N-version How much redundancy is there? R CA,CB = AGGREGATE(RS) Consistency: Stability Code Projections Low-level vs High-level Code Redundancy vs Algorithmic Redundancy Redundancy Extract to local variable Change name Inline expression Extract method Equivalent input ADice Man Cos DamLev Dice Euclid Jaccard Jaro JaroW Lev MC Need Ovlp qgrams SmithW SmithG Redundancy Binary search DamLev Lev Need SmithW SmithG Redundancy Linear search DamLev Lev Need SmithW SmithG Redundancy Data Projections Extract to local variable Change name Inline expression Extract method Equivalent input ADice Man Cos DamLev Dice Euclid Jaccard Jaro JaroW Lev MC Need Ovlp qgrams SmithW SmithG Redundancy Bubble sort DamLev Lev Need SmithW SmithG Different algorithm Redundancy Insertion sort DamLev Lev Need SmithW SmithG
105 ... Software Redundancy? Informal Definition of Redundancy A Practical Measure of Redundancy Deliberate Intrinsic Input Version 1 Version 2 Version n N-version Selection Algorithm Output Google Guava MultiMap m = new MultiMap(); // //add a key-value pair in the map m.put(key, value); m.putall(key, new List().add(value)); m.entryset().add(new Entry(key, value)); How much redundancy is there? Two fragments are redundant when they are functionally equivalent and at the same time their executions are different. RS = es(ca,cb) ds(ca,cb) R CA,CB es, ds [0,1] = AGGREGATE(RS) Consistency: Stability Code Projections Low-level vs High-level Code Redundancy vs Algorithmic Redundancy Predictive Ability Redundancy Redundancy Extract to local variable Change name Inline expression Extract method Equivalent input ADice Man Cos DamLev Dice Euclid Jaccard Jaro JaroW Lev MC Need Ovlp qgrams SmithW SmithG Data Projections Extract to local variable Change name Inline expression Extract method Equivalent input ADice Man Cos DamLev Dice Euclid Jaccard Jaro JaroW Lev MC Need Ovlp qgrams SmithW SmithG Redundancy Redundancy Binary search DamLev Lev Need SmithW SmithG Bubble sort DamLev Lev Need SmithW SmithG Redundancy Redundancy Different algorithm Linear search DamLev Lev Need SmithW SmithG Insertion sort DamLev Lev Need SmithW SmithG System Method (CA) Workaround (CB) Success ratio Redundancy Iterators.forArray(a) Arrays.asList(a).iterator() 3/3 (100%) 1.00 ± 0.00 LinkedHashMultiset.retainAll(Collection c) foreach(o in map) if(o not in c) map.remove(o); 1/2 (50%) 0.61 ±0.01 ArrayListMultimap.putAll(Object k,collection c) foreach(o in c) put(k,o); 8/41 (20%) 0.37 ±0.32 Caliper LinkedHashMultimap.putAll(Object k, Collection c) foreach(o in c) put(k,o); 0/1 (0%) 0.00 ±0.00 LinkedHashMultimap.create() create(100,100) 0/207 (0%) 0.12 ±0.15 Caliper LinkedHashMultimap.create(int,int) create() 0/202 (0%) 0.12 ±0.15 LinkedHashMultimap.isEmpty() size() == 0? true : false 0/34 (0%) 0.00 ±0.00 ImmutableMultiset.of(Object..c) foreach(o in c) builder().setcount(o,count(o in c)) 13/22 (59%) 0.56 ±0.07 ImmutableMultiset.of(Object..c) builder().add(..c).build() 7/19 (37%) 0.24 ±0.12 ArrayListMultimap.putAll(Object k,collection c) foreach(o in c) put(k,o); 1/13 (8%) 0.37 ±0.32 ImmutableMultiset.of(Object o) builder().add(o).build() 0/1 (0%) 0.32 ±0.14 Lists.newArrayList() new ArrayList() 0/24 (0%) 0.00 ±0.00 Carrot Lists.newArrayList() new ArrayList(10) 0/24 (0%) 0.00 ±0.00 Lists.newArrayListWithCapacity(int c) new ArrayList() 0/20 (0%) 0.00 ±0.00 Carrot2 Lists.newArrayListWithCapacity(int c) new ArrayList(c) 0/20 (0%) 0.00 ±0.00 Maps.newHashMap() Maps.newHashMapWithExpectedSize(16) 0/54 (0%) 0.00 ±0.00 Maps.newHashMap() new HashMap() 0/54 (0%) 0.00 ±0.00 Maps.newHashMap() new HashMap(16) 0/54 (0%) 0.00 ±0.00 Correlation: 0.94
Measuring Software Redundancy
25 IEEE/ACM 37th IEEE International Conference on Software Engineering Measuring Software Antonio Carzaniga, Andrea Mattavelli and Mauro Pezzè Università della Svizzera italiana (USI), Switzerland University
More informationAutomatic Recovery from Runtime Failures Authors: Antonio Carzaniga, Alessandra Gorlay, Andrea Mattavelli, Nicol`o Perino, Mauro Pezz`e
Automatic Recovery from Runtime Failures Authors: Antonio Carzaniga, Alessandra Gorlay, Andrea Mattavelli, Nicol`o Perino, Mauro Pezz`e slide author names omitted for FERPA compliance The Approach Intrinsic
More informationSynthesis of Equivalent Method Calls in Guava
Synthesis of Equivalent Method Calls in Guava Andrea Mattavelli 1, Alberto Goffi 1 and Alessandra Gorla 2 1 Università della Svizzera italiana (USI), Lugano, Switzerland {andrea.mattavelli,alberto.goffi}@usi.ch
More informationAutomatic Recovery from Runtime Failures. presenter name(s) removed for FERPA considerations
Automatic Recovery from Runtime Failures presenter name(s) removed for FERPA considerations Key Idea Use automatic recovery tools to generate alternative ways to achieve the same functionality of code
More informationAutomatic Recovery from Runtime Failures
Automatic Recovery from Runtime Failures Antonio Carzaniga Alessandra Gorla Andrea Mattavelli Nicolò Perino Mauro Pezzè University of Lugano Faculty of Informatics Lugano, Switzerland Saarland University
More informationAutomatic Generation of Oracles for Exceptional Behaviors
Automatic Generation of Oracles for Exceptional Behaviors ISSTA * * Artifact Consistent * Complete * Well Documented * Easy to Reuse * Evaluated * AEC * Alberto Goffi alberto.goffi@usi.ch USI Università
More informationIntrinsic Redundancy for Reliability and Beyond
Intrinsic Redundancy for Reliability and Beyond Alberto Goffi, Alessandra Gorla, Andrea Mattavelli, and Mauro Pezzè Abstract Software redundancy is an essential mechanism in engineering. Different forms
More informationCP222 Computer Science II. Searching and Sorting
CP222 Computer Science II Searching and Sorting New Boston Dynamics wheeled robot Tech News! Tech News! New Boston Dynamics wheeled robot Man charged with arson based on pacemaker data Quiz! How do you
More informationCOMP-202: Foundations of Programming. Lecture 26: Image Manipulation; Wrap-Up Jackie Cheung, Winter 2015
COMP-202: Foundations of Programming Lecture 26: Image Manipulation; Wrap-Up Jackie Cheung, Winter 2015 Announcements Assignment 6 due Tue Apr 14 at 11:59pm Final is scheduled for Apr 29, 6pm 9pm Please
More informationDecision Structures. Selection. Selection options (in Java) Plain if s (3 variations) Each action could be any of: if else (3 variations)
Decision Structures if, if/ conditions Selection DECISION: determine which of 2 paths to follow (1+ statements in each path) CS1110 - Kaminski (ELSE path optional) 2 Selection options (in Java) Plain if
More informationCS 110 Practice Final Exam originally from Winter, Instructions: closed books, closed notes, open minds, 3 hour time limit.
Name CS 110 Practice Final Exam originally from Winter, 2003 Instructions: closed books, closed notes, open minds, 3 hour time limit. There are 4 sections for a total of 49 points. Part I: Basic Concepts,
More informationSoftware diversification. Benoit Baudry WASP Professor in Software Technology KTH Royal Institute of Technology
Software diversification Benoit Baudry WASP Professor in Software Technology KTH Royal Institute of Technology 1 P src P exe P exe P exe P exe P exe P exe 2 P src P exe P exe P exe P exe P exe P exe 3
More informationPROBLEM 1 : (Short Answer: 13 points) Three points each, except for last two which are two points 1. Both bubble-sort and selection sort are O(n 2 ) s
Test 2: CPS 100 Owen Astrachan April 3, 1996 Name: Honor code acknowledgement (signature) Problem 1 Problem 2 Problem 3 Problem 4 Problem 5 EXTRA TOTAL: value 13 pts. 14 pts. 13 pts. 12 pts. 15 pts. 8
More informationAutomatic Workarounds for Web Applications
Automatic Workarounds for Web Applications Antonio Carzaniga, Alessandra Gorla, Nicolò Perino, and Mauro Pezzè Faculty of Informatics University of Lugano Lugano, Switzerland {antonio.carzaniga alessandra.gorla
More informationSum this up for me. Let s write a method to calculate the sum from 1 to some n. Gauss also has a way of solving this. Which one is more efficient?
Sum this up for me Let s write a method to calculate the sum from 1 to some n public static int sum1(int n) { int sum = 0; for (int i = 1; i
More informationMutation-based Generation of Tests and Oracles. Gordon Fraser and Andreas Zeller Saarland University, Germany
Mutation-based Generation of Tests and Oracles Gordon Fraser and Andreas Zeller Saarland University, Germany LocalDate date = new LocalDate(2010, 7, 15); date.plusyears(1); assertequals(date.getyear(),
More informationSome Sample AP Computer Science A Questions - Solutions
Some Sample AP Computer Science A Questions - s Note: These aren't from actual AP tests. I've created these questions based on looking at actual AP tests. Also, in cases where it's not necessary to have
More informationAP Computer Science 4325
4325 Instructional Unit Algorithm Design Techniques -divide-and-conquer The students will be -Decide whether an algorithm -classroom discussion -backtracking able to classify uses divide-and-conquer, -worksheets
More informationCP222 Computer Science II. Recurrence Relations and Basic Sorting
CP222 Computer Science II Recurrence Relations and Basic Sorting Amazon raising Prime subscription price to $119 Tech News! Tech News! Amazon raising Prime subscription price to $119 Golden State Killer
More informationAlgorithm efficiency can be measured in terms of: Time Space Other resources such as processors, network packets, etc.
Algorithms Analysis Algorithm efficiency can be measured in terms of: Time Space Other resources such as processors, network packets, etc. Algorithms analysis tends to focus on time: Techniques for measuring
More informationTutorial #11 SFWR ENG / COMP SCI 2S03. Interfaces and Java Collections. Week of November 17, 2014
Tutorial #11 SFWR ENG / COMP SCI 2S03 Interfaces and Java Collections Week of November 17, 2014 Interfaces An interface defines a specification or contract that a class must meet to be defined as an instance
More informationCOMP-202: Foundations of Programming. Lecture 26: Review; Wrap-Up Jackie Cheung, Winter 2016
COMP-202: Foundations of Programming Lecture 26: Review; Wrap-Up Jackie Cheung, Winter 2016 Announcements Final is scheduled for Apr 21, 2pm 5pm GYM FIELD HOUSE Rows 1-21 Please submit course evaluations!
More informationQualitätssicherung von Software (SWQS)
Qualitätssicherung von Software (SWQS) Prof. Dr. Holger Schlingloff Humboldt-Universität zu Berlin und Fraunhofer FOKUS 28.5.2013: Modellprüfung II - BDDs Folie 2 Existenzgründer gesucht! Folie 3 Fragen
More informationBoca Raton Community High School AP Computer Science A - Syllabus 2009/10
Boca Raton Community High School AP Computer Science A - Syllabus 2009/10 Instructor: Ronald C. Persin Course Resources Java Software Solutions for AP Computer Science, A. J. Lewis, W. Loftus, and C. Cocking,
More informationSorting Pearson Education, Inc. All rights reserved.
1 19 Sorting 2 19.1 Introduction (Cont.) Sorting data Place data in order Typically ascending or descending Based on one or more sort keys Algorithms Insertion sort Selection sort Merge sort More efficient,
More information1. AVL Trees (10 Points)
CSE 373 Spring 2012 Final Exam Solution 1. AVL Trees (10 Points) Given the following AVL Tree: (a) Draw the resulting BST after 5 is removed, but before any rebalancing takes place. Label each node in
More informationWall Painting Reconstruction Using a Genetic Algorithm. Elena Sizikova, Thomas Funkhouser Princeton University
Wall Painting Reconstruction Using a Genetic Algorithm Elena Sizikova, Thomas Funkhouser Princeton University Motivation Wall paintings recovered from Akrotiri (Santorini), Greece Part of a reconstructed
More informationObject Oriented Programming Exception Handling
Object Oriented Programming Exception Handling Budditha Hettige Department of Computer Science Programming Errors Types Syntax Errors Logical Errors Runtime Errors Syntax Errors Error in the syntax of
More informationAP CS Unit 7: Interfaces Exercises Assume all code compiles unless otherwise suggested.
AP CS Unit 7: Interfaces Exercises Assume all code compiles unless otherwise suggested. 1. The Nose class... b) will not compile because the m1 method parameter should be named n, not x. 2. The Ears class...
More informationHiroki Yasuga, Elisabeth Kolp, Andreas Lang. 25th September 2014, Scientific Programming
Hiroki Yasuga, Elisabeth Kolp, Andreas Lang 25th September 2014, Scientific Programming What is sorting and complexity? Big O notation Sorting algorithms: Merge sort Quick sort Comparison: Merge sort &
More informationFacebook. / \ / \ / \ Accenture Nintendo
1. Binary Tree Traversal Consider the following tree: +---+ 4 +---+ 1 9 / / +---+ 6 0 2 +---+ 3 8 \ \ \ \ 7 5 Fill in each of the traversals below : Pre-order: 4 1 6 3 7 0 8 5 9 2 In-order: 3 7 6 1 0 8
More informationComparing Non-adequate Test Suites using Coverage Criteria
Comparing Non-adequate Test Suites using Coverage Criteria Milos Gligoric 1, Alex Groce 2, Chaoqiang Zhang 2 Rohan Sharma 1, Amin Alipour 2, Darko Marinov 1 ISSTA 2013 Lugano, Switzerland July 18, 2013
More informationChapter 3, Selection. Liang, Introduction to Programming with C++, Second Edition, (c) 2010 Pearson Education, Inc. All rights reserved.
Chapter 3, Selection 1 The bool Type and Operators 2 One-way if Statements if (booleanexpression) { statement(s); } if (radius >= 0) { area = radius * radius * PI; cout
More informationInterfaces and Collections
Interfaces and Collections COMPSCI 2S03 Mikhail Andrenkov Department of Computing and Software McMaster University Week 9: November 14-18 Mikhail Andrenkov Interfaces and Collections 1 / 25 Outline 1 Interfaces
More informationAdvanced Java Concepts Unit 2: Linked Lists.
Advanced Java Concepts Unit 2: Linked Lists. The List interface defines the structure of a linear collection. Here are some of its methods. boolean add( E element ) Appends the element to the end of the
More informationPrelim 2. CS 2110, 16 November 2017, 7:30 PM Total Question Name Short Heaps Tree Collections Sorting Graph
Prelim 2 CS 2110, 16 November 2017, 7:30 PM 1 2 3 4 5 6 7 Total Question Name Short Heaps Tree Collections Sorting Graph answer Max 1 18 10 25 10 16 20 100 Score Grader The exam is closed book and closed
More informationAP Computer Science AB
AP Computer Science AB Dr. Tyler Krebs Voice Mail: 431-8938 Classroom: B128 Office: TV Studio Characteristics We Value in This Classroom: 1. Respect. (Show respect for everyone and everything.) 2. Integrity.
More informationTranslating Code Comments to Procedure Specifications
Translating Code Comments to Procedure Specifications Arianna Blasi Alberto Goffi Konstantin Kuznetsov Alessandra Gorla Michael D. Ernst Mauro Pezzè Sergio Delgado USI Università della Svizzera italiana,
More informationCS 177 Spring 2010 Exam I
CS 177 Spring 2010 Exam I There are 25 multiple choice questions. Each one is worth 4 points. The total score for the exam is 100. Answer the multiple choice questions on the bubble sheet given. Fill in
More information1.00/ Introduction to Computers and Engineering Problem Solving. Final Exam / December 21, 2005
1.00/1.001 Introduction to Computers and Engineering Problem Solving Final Exam / December 21, 2005 Name: Email Address: TA: Section: You have 180 minutes to complete this exam. For coding questions, you
More informationChapter 12 Supplement: Recursion with Java 1.5. Mr. Dave Clausen La Cañada High School
Chapter 12 Supplement: Recursion with Java 1.5 La Cañada High School Recursion: Definitions Recursion The process of a subprogram (method) calling itself. A clearly defined stopping state must exist. The
More informationImproving Test Suites via Operational Abstraction
Improving Test Suites via Operational Abstraction Michael Ernst MIT Lab for Computer Science http://pag.lcs.mit.edu/~mernst/ Joint work with Michael Harder, Jeff Mellen, and Benjamin Morse Michael Ernst,
More informationNetwork Troubleshooting from End-Hosts. Renata Teixeira Laboratoire LIP6 CNRS and UPMC Sorbonne Universités
Network Troubleshooting from End-Hosts Renata Teixeira Laboratoire LIP6 CNRS and UPMC Sorbonne Universités Internet problems are hard to troubleshoot DNS? NAT? DHCP???? Net1 Stanford network Is my connection
More informationSCHOOL OF COMPUTING, ENGINEERING AND MATHEMATICS SEMESTER 2 EXAMINATIONS 2014/2015 CI101/CI101H. Programming
s SCHOOL OF COMPUTING, ENGINEERING AND MATHEMATICS SEMESTER 2 EXAMINATIONS 2014/2015 CI101/CI101H Programming Time allowed: THREE hours Answer: ALL questions Items permitted: Items supplied: There is no
More informationRun-Time Environments
1 Run-Time Environments Chapter 7 COP5621 Compiler Construction Copyright Robert van Engelen, Florida State University, 2007-2011 2 Procedure Activation and Lifetime A procedure is activated when called
More informationAPCS Semester #1 Final Exam Practice Problems
Name: Date: Per: AP Computer Science, Mr. Ferraro APCS Semester #1 Final Exam Practice Problems The problems here are to get you thinking about topics we ve visited thus far in preparation for the semester
More informationUniversity Interscholastic League. Computer Science Competition
University Interscholastic League Computer Science Competition Number 121 (District 1-2010) General Directions (Please read carefully!): 1) DO NOT OPEN EXAM UNTIL TOLD TO DO SO. 2) NO CALCULATOR OF ANY
More informationCS 146 Spring 2017 Homework 4 Sections 5 and 6. The homework assignment is available at:
The homework assignment is available at: http://www.jennylam.cc/courses/146-s17/homework04.html 1. Here is a working Java solution which runs in linear time in the total length of the input lists. /**
More informationExam Questions. How to Answer
Exam Questions How to Answer This flowchart asks the user for their desired download speed. Then, it prints the cost of the service. Write the code that would result from this flowchart. Make sure that
More informationProgramming Languages Research at the University of Colorado, Boulder
Amer Diwan Jeremy Siek Bor-Yuh Evan Chang Sriram Sankaranarayanan Programming Languages Research at the University of Colorado, Boulder PL research at CU has breadth! How do we effectively express computation?
More information1 / 20 2 / 20 3 / 20 4 / 20 5 / 20
CSC 207 (17fa) Exam 2 Practice Page 1 of 12 Exam 2 Practice (November 10, 2017) This exam is closed-book, notes, and technology. Please do not open the test until the instructor says time has begun. Please
More informationAbout this exam review
Final Exam Review About this exam review I ve prepared an outline of the material covered in class May not be totally complete! Exam may ask about things that were covered in class but not in this review
More informationFinding and Fixing Bugs in Liquid Haskell. Anish Tondwalkar
Finding and Fixing Bugs in Liquid Haskell Anish Tondwalkar Overview Motivation Liquid Haskell Fault Localization Fault Localization Evaluation Predicate Discovery Predicate Discovery Evaluation Conclusion
More informationDepth-wise Hashing with Deep Hashing Structures. A two dimensional representation of a Deep Table
Proceedings of Student Research Day, CSIS, Pace University, May 9th, 2003 Depth-wise Hashing with Deep Hashing Structures Edward Capriolo Abstract The objective of this research is to implement a variation
More informationTECHNICAL WHITEPAPER. Performance Evaluation Java Collections Framework. Performance Evaluation Java Collections. Technical Whitepaper.
Performance Evaluation Java Collections Framework TECHNICAL WHITEPAPER Author: Kapil Viren Ahuja Date: October 17, 2008 Table of Contents 1 Introduction...3 1.1 Scope of this document...3 1.2 Intended
More informationCOMP 103. Mid Trimester Test 17 August 2006
Name ID: COMP 103 Mid Trimester Test 17 August 2006 Time: 90 minutes Marks: 90 Answer all questions. Non programmable calculators permitted Unannotated foreign language dictionaries permitted 1. Collection
More informationCSE 8B Final Exam Fall 2015
Name: Tutor: Student ID: Signature: CSE 8B Final Exam Fall 2015 You can rip off the last page and use as scratch paper. Page 2 Page 3 Page 4 Page 5 Page 6 Page 7 Page 8 Page 9 Page 10 Page 11 Page 12 0
More informationThe MapReduce Abstraction
The MapReduce Abstraction Parallel Computing at Google Leverages multiple technologies to simplify large-scale parallel computations Proprietary computing clusters Map/Reduce software library Lots of other
More informationObject-Oriented Genetic Improvement for Improved Energy Consumption in Google Guava
Object-Oriented Genetic Improvement for Improved Energy Consumption in Google Guava Nathan Burles 1, Edward Bowles 1, Alexander E. I. Brownlee 2, Zoltan A. Kocsis 2, Jerry Swan 1, Nadarajen Veerapen 2
More informationSearching and Sorting
CS 211 SEARCH & SORT SEARCHING & SORTING Searching and Sorting Searching means that we have some collection of data, and we seek a particular value that might be contained within our collection. We provide
More informationPrelim 2 SOLUTION. CS 2110, 16 November 2017, 7:30 PM Total Question Name Short Heaps Tree Collections Sorting Graph
Prelim 2 SOLUTION CS 2110, 16 November 2017, 7:30 PM 1 2 3 4 5 6 7 Total Question Name Short Heaps Tree Collections Sorting Graph answer Max 1 18 10 25 10 16 20 100 Score Grader The exam is closed book
More informationCSC 1351: Exam 2: Midterm
VERSION C CSC 1351: Exam 2: Midterm 1 Recursion 1.1 From CodingBat. Given a string, compute recursively a new string where all the adjacent chars are now separated by a *. allstar (" hello ") -> "h*e*l*l*o"
More informationStatic Program Analysis
Static Program Analysis Lecture 1: Introduction to Program Analysis Thomas Noll Lehrstuhl für Informatik 2 (Software Modeling and Verification) noll@cs.rwth-aachen.de http://moves.rwth-aachen.de/teaching/ws-1415/spa/
More information1.Which four options describe the correct default values for array elements of the types indicated?
1.Which four options describe the correct default values for array elements of the types indicated? 1. int -> 0 2. String -> "null" 3. Dog -> null 4. char -> '\u0000' 5. float -> 0.0f 6. boolean -> true
More informationLecture 6 Sorting and Searching
Lecture 6 Sorting and Searching Sorting takes an unordered collection and makes it an ordered one. 1 2 3 4 5 6 77 42 35 12 101 5 1 2 3 4 5 6 5 12 35 42 77 101 There are many algorithms for sorting a list
More informationData Structures and Algorithms Notes
Data Structures and Algorithms Notes Notes by Winst Course taught by Dr. G. R. Baliga 256-400 ext. 3890 baliga@rowan.edu Course started: September 4, 2012 Last generated: December 18, 2013 Interfaces -
More informationProgramming Basics. Digital Urban Visualization. People as Flows. ia
Programming Basics Digital Urban Visualization. People as Flows. 28.09.2015 ia zuend@arch.ethz.ch treyer@arch.ethz.ch Programming? Programming is the interaction between the programmer and the computer.
More informationJava 2. Course Outcome Summary. Western Technical College. Course Information. Course History. Course Competencies
Western Technical College 10152155 Java 2 Course Outcome Summary Course Information Description Career Cluster Instructional Level Total Credits 4.00 Total Hours 90.00 The goal as programmers, is to create
More informationKing Saud University College of Computer and Information Sciences Computer Science Department
King Saud University College of Computer and Information Sciences Computer Science Department Course Code: CSC 111 Course Title: Introduction to Programming Semester: Fall 2017-2018 Exercises Cover Sheet:
More information1. Binary Tree Traversal. 2. Binary Search Tree. 1 of 12. Consider the following tree: Pre-order: In-order: Post-order:
1. Binary Tree Traversal Consider the following tree: +---+ 4 +---+ 1 9 / / +---+ 6 0 2 +---+ 3 8 \ \ \ \ 7 5 Fill in each of the traversals below : Pre-order: In-order: Post-order: 2. Binary Search Tree
More informationBBM 102 Introduction to Programming II Spring 2017
BBM 102 Introduction to Programming II Spring 2017 Collections Framework Instructors: Ayça Tarhan, Fuat Akal, Gönenç Ercan, Vahid Garousi 1 Today The java.util.arrays class Java Collection Framework java.util.collection
More informationBBM 102 Introduction to Programming II Spring 2017
BBM 102 Introduction to Programming II Spring 2017 Collections Framework Today The java.util.arrays class Java Collection Framework java.util.collection interface java.util.list interface java.util.arraylist
More informationIssues in Programming Language Design for Embedded RT Systems
CSE 237B Fall 2009 Issues in Programming Language Design for Embedded RT Systems Reliability and Fault Tolerance Exceptions and Exception Handling Rajesh Gupta University of California, San Diego ES Characteristics
More informationGridGain and Apache Ignite In-Memory Performance with Durability of Disk
GridGain and Apache Ignite In-Memory Performance with Durability of Disk Dmitriy Setrakyan Apache Ignite PMC GridGain Founder & CPO http://ignite.apache.org #apacheignite Agenda What is GridGain and Ignite
More informationMAJOR: An Efficient and Extensible Tool for Mutation Analysis in a Java Compiler
MAJOR: An Efficient and Extensible Tool for Mutation Analysis in a Java Compiler René Just 1, Franz Schweiggert 1, and Gregory M. Kapfhammer 2 1 Ulm University, Germany 2 Allegheny College, USA 26th International
More informationYou must define a class that represents songs. Your class will implement the Song interface in $master/proj2/cs61b/song.java.
CS 61B Summer 2005 Project 2 (spec version 2.0) CD Database Due: July 22, 2005 5pm Overview This project will give you practice with Linked List data structures and sorting algorithms. You will be building
More informationEvaluating the Fault Tolerance Capabilities of Embedded Systems via BDM
Evaluating the Fault Tolerance Capabilities of Embedded Systems via BDM M. Rebaudengo, M. Sonza Reorda Politecnico di Torino Dipartimento di Automatica e Informatica Torino, Italy Fault tolerant system
More informationCSCI-140 Midterm Review October 10, 2015 Presented by the RIT Computer Science Community
CSCI-140 Midterm Review October 10, 2015 Presented by the RIT Computer Science Community http://csc.cs.rit.edu 1. In each of the following situations, would it be better to use array-backed storage or
More informationFacebook. / \ / \ / \ Accenture Nintendo
1. Binary Tree Traversal Consider the following tree: +---+ 4 +---+ 1 9 / / +---+ 6 0 2 +---+ 3 8 \ \ \ \ 7 5 Fill in each of the traversals below : Pre-order: 4 1 6 3 7 0 8 5 9 2 In-order: 3 7 6 1 0 8
More informationWhy Should You Care? Writing a CSP Solver in 3 (or 4) Easy Lessons. Talk Aims. Why Should You Care? Not Talk Aims. Talk Aims
Writing a CSP Solver in 3 (or 4) Easy Lessons Christopher Jefferson University of Oxford Why Should ou Care? Understanding how the solver works makes better models. Minion already imposes this on you,
More informationCS 61B Summer 2005 (Porter) Midterm 2 July 21, SOLUTIONS. Do not open until told to begin
CS 61B Summer 2005 (Porter) Midterm 2 July 21, 2005 - SOLUTIONS Do not open until told to begin This exam is CLOSED BOOK, but you may use 1 letter-sized page of notes that you have created. Problem 0:
More informationAP Computer Science A Syllabus
AP Computer Science A Syllabus Course Overview The focus of this class is structured logic with an emphasis on developing simple, elegant algorithms and thinking in an object-oriented manner. The Java
More informationd. If a is false and b is false then the output is "ELSE" Answer?
Intermediate Level 1) Predict the output for the below code: public void foo( boolean a, boolean b) if( a ) System.out.println("A"); if(a && b) System.out.println( "A && B"); if (!b ) System.out.println(
More informationRun Time Environment. Activation Records Procedure Linkage Name Translation and Variable Access
Run Time Environment Activation Records Procedure Linkage Name Translation and Variable Access Copyright 2015, Pedro C. Diniz, all rights reserved. Students enrolled in the Compilers class at the University
More informationCSE 373, Winter 2013 Final Exam, Tuesday, March 19, Good luck! You can do it!
CSE 373, Winter 2013 Final Exam, Tuesday, March 19, 2012 Name: Quiz Section: Student ID #: TA/Grader: Rules: You have 110 minutes to complete this exam. You may receive a deduction if you keep working
More informationJava Basics Programming Fundamentals
Java Basics Programming Fundamentals The 2009 Multiple Choice section of the AP Computer Science A exam was broken down as follows: Programming fundamentals - 30/40 Data Structures - 8/40 Logic - 4/40
More informationObject Oriented Programming: In this course we began an introduction to programming from an object-oriented approach.
CMSC 131: Chapter 28 Final Review: What you learned this semester The Big Picture Object Oriented Programming: In this course we began an introduction to programming from an object-oriented approach. Java
More informationMeasuring Complexity
Measuring Complexity outline why should we measure the complexity of a software system? what might we want to measure? complexity of the source code within a code module between code modules complexity
More informationToday's Topics. CISC 458 Winter J.R. Cordy
Today's Topics Last Time Semantics - the meaning of program structures Stack model of expression evaluation, the Expression Stack (ES) Stack model of automatic storage, the Run Stack (RS) Today Managing
More informationMidterm 1 Written Exam
COS 126 Intro to CS Fall 2015 Midterm 1 Written Exam There are eight questions on this exam, weighted as indicated at the bottom of this page. There is one question per lecture, numbered corresponding
More informationCS 177 Week 15 Recitation Slides. Review
CS 177 Week 15 Recitation Slides Review 1 Announcements Final Exam on Friday Dec. 18 th STEW 183 from 1 3 PM Complete your online review of your classes. Your opinion matters!!! Project 6 due Just kidding
More informationJava code(assembler) ******************************************************************* package A1;
Java code(assembler) ******************************************************************* package A1; import java.io.bufferedreader; import java.io.fileinputstream; import java.io.filewriter; import java.io.inputstreamreader;
More information1B1a Arrays. Arrays. Indexing. Naming arrays. Why? Using indexing. 1B1a Lecture Slides. Copyright 2003, Graham Roberts 1
Ba Arrays Arrays A normal variable holds value: An array variable holds a collection of values: 4 Naming arrays An array has a single name, so the elements are numbered or indexed. 0 3 4 5 Numbering starts
More informationStatic Program Analysis
Static Program Analysis Thomas Noll Software Modeling and Verification Group RWTH Aachen University https://moves.rwth-aachen.de/teaching/ss-18/spa/ Preliminaries Outline of Lecture 1 Preliminaries Introduction
More informationRepairing crashes in Android Apps. Shin Hwei Tan Zhen Dong Xiang Gao Abhik Roychoudhury National University of Singapore
Repairing crashes in Android Apps Shin Hwei Tan Zhen Dong Xiang Gao Abhik Roychoudhury National University of Singapore Android Repair System Criteria for Android repair system: Could be used by any smartphone
More informationMODULE 6q - Exceptions
MODULE 6q - Exceptions THE TRY-CATCH CONSTRUCT Three different exceptions are referred to in the program below. They are the ArrayIndexOutOfBoundsException which is built-into Java and two others, BadLuckException
More informationJava Software Solutions for AP Computer Science 3rd Edition, Lewis et al. 2011
A Correlation of AP Computer Science 3rd Edition, Lewis et al. 2011 To the INTRODUCTION This document demonstrates how AP (Advanced Placement) Computer Science, 3rd Edition 2011, Lewis et al. meets the
More informationPrelim 2. CS 2110, November 19, 2015, 7:30 PM Total. Sorting Invariants Max Score Grader
Prelim 2 CS 2110, November 19, 2015, 7:30 PM 1 2 3 4 5 6 Total Question True Short Complexity Searching Trees Graphs False Answer Sorting Invariants Max 20 15 13 14 17 21 100 Score Grader The exam is closed
More informationCS 206 Introduction to Computer Science II
CS 206 Introduction to Computer Science II 03 / 05 / 2018 Instructor: Michael Eckmann Today s Topics Questions? Comments? binary search trees Finish delete method Discuss run times of various methods Michael
More informationCS 163 Practice Final Exam Winter 2012
CS 163 Practice Final Exam Winter 2012 The final exam is Saturday, 21 April. Any problem from either midterm or either practice midterm may (and often does) appear again on the final. In addition, make
More information