Software modularity and reuse Paulo Borba Informatics Center Federal University of Pernambuco

[email protected] ◈ twitter.com/pauloborba Wednesday, August 18, 2010

1

Reuse opportunities

Wednesday, August 18, 2010

2

Different devices, 15 to 60 different applications…

Different clients, different products

http://www.androidauthority.com Wednesday, August 18, 2010

3

Little reuse and agility, high costs Even with J2ME!

Wednesday, August 18, 2010

4

Problem might also appear in the context of a single product... Wednesday, August 18, 2010

5

How to detect it? Wednesday, August 18, 2010

6

Code cloning tool, file

Wednesday, August 18, 2010

7

Code cloning tool, packages

Wednesday, August 18, 2010

8

But what is a clone? Wednesday, August 18, 2010

9

Clones? Strings? Tokens? if (first == null && second != null) { return -1; } if (first == null && second != null) { return -1; } if (f == null && s != null) { return -1; } if (f == null && s != null) { return 0; } Wednesday, August 18, 2010

10

Clones? Reuse opportunities? int getDay() { return day; } int getMonth() { return month; } int getDay() { return day+1; } Wednesday, August 18, 2010

11

Google wave clones int getDay() { return day; } int getMonth() { return month; } int getDay() { return day+1; } Wednesday, August 18, 2010

12

int sum(int x,int y){return x+y;} int sumInt(int a,int b){return a+b;} Wednesday, August 18, 2010

13

Changing clone notion, small

Wednesday, August 18, 2010

14

Changing clone notion, large

Wednesday, August 18, 2010

15

Minimum clone length (tokens) if (o.toString().equals("/")) { div = new DivExp(null, null)); } if (o.toString().equals("*")) { mult = new MultExp(null, null)); }

Wednesday, August 18, 2010

16

P-match... maps different variables and function names to different tokens if (x>0) {y=1; x=2; x=w;} else {y=1; x=2; x=z;} Wednesday, August 18, 2010

17

Minimum TKS (kinds of tokens) int x = 0; int y = 0; int z = 0; int a = 0; int b = 0; int c = 0;

Wednesday, August 18, 2010

18

Shaper level, hard and soft

Wednesday, August 18, 2010

19

Shaper level, easy and none

Wednesday, August 18, 2010

20

File metrics

 

• • •

LEN: File length (in tokens)

• • •

RSA: Ratio of similarity to another file



RNR: Ratio of non-repeated code

Wednesday, August 18, 2010

CLN: Number of Code Clones NBR: Neighbors, other files that share a code clone in this file

RSI: Ratio of similarity within the file CVR: Coverage, percentage of tokens covered by another code clone

21

Clone set metrics • • •

LEN: Length of a code fragment of the code clone



RAD (radius): Range of the source code fragments of a code clone in the directory hierarchy



RNR (ratio of non-repeated tokens): Ratio (percentage) of tokens that are not included in repeated part of a code fragment of the code clone



TKS (token set size): Size of a set of tokens of a code fragment of the code clone



LOOP, COND, McCabe

Wednesday, August 18, 2010

POP (population): Count of code fragments of the code clone NIF: Count of source files that include one or more code fragments of the code clone

22

Strategy • Start with stronger constraints • Analyze clones • Reduce constraints • Cycle until no more interesting clones Wednesday, August 18, 2010

23

Take notes, now! Wednesday, August 18, 2010

24

Reuse opportunities

Wednesday, August 18, 2010

25

Software modularity and reuse Paulo Borba Informatics Center Federal University of Pernambuco

[email protected] ◈ twitter.com/pauloborba Wednesday, August 18, 2010

26

Paulo Borba Informatics Center Federal University of ...

Code cloning tool, packages. 8. Wednesday, August 18, 2010 ... Minimum TKS (kinds of tokens) int x = 0; int y = 0; int z = 0; int a = 0; int b = 0; int c = 0;. 18. Wednesday, August 18, 2010 ... POP (population): Count of code fragments of the code clone. • NIF: Count of source files that include one or more code fragments of the ...

1MB Sizes 0 Downloads 118 Views

Recommend Documents

Paulo Borba Informatics Center Federal University of ...
Software as a Service. (SaaS). • Delivers software and data as a service over the Internet. • No need to install applications. • No need to backup or share data. • Easier to improve the service ...

Paulo Borba Informatics Center Federal University of ...
Little reuse and agility, high costs. Even with. Android! ... import java.util.Vector; import com.meantime.j2me.util.Screen; import com.meantime.j2me.util.bvg.BVGAnimator;. //#if device_graphics_transform_midp2. //# import javax.microedition.lcdui.ga

Paulo Borba Informatics Center Federal University of ...
Code cloning tool, file. Page 8. Code cloning tool, packages. Page 9 ... P-match... maps different variables and function names to different tokens if (x>0). {y=1; x=2; x=w;} else. {y=1; x=2; x=z;}. Page 17. Minimum TKS (kinds of tokens) int x = 0; i

Paulo Borba Informatics Center Federal University of ...
Check previous activities. • Log into google with your CIn account. • Access and answer today's questions (…) • Discuss class material. • what haven't you understood? what don't you agree? what haven't you liked? what are you missing to per

Paulo Borba Informatics Center Federal University of ...
PDC, bridge variation... class AccountRecord { private AccountRepository accounts;... public void register(Account a) { if (a != null) {. String n = a.getNumero(); if (!accounts.exists(n)) { ... Account search(String number); boolean exists(String nu

Paulo Borba Informatics Center Federal University of ...
Software development issues. (crisis?) □ Project cancellation rate of 25%. • 31% in another study, 16% are successful. □ development time and cost go well beyond the estimative. • in 53% of the analyzed projects. □ 75% of the analyzed syste

Denver Federal Center (2).pdf
There was a problem previewing this document. Retrying... Download. Connect more apps... Try one of the apps below to open or edit this item. Denver Federal ...

Federal University of Amazonas, Manaus, BRAZIL ...
RESULTS. Two evaluation metrics were used: • RMSE: adequate to evaluate the floating point results ... host city of all teams). • The problem of prediction of goal difference was interpreted as a temporal regression task. • We searched for a se

[PDF BOOK] Fundamentals of Federal Income Taxation (University ...
We would like to show you a description here but the site won’t allow us. Online PDF Fundamentals of Federal Income Taxation (University Casebook ...

Federal University of Technology, Owerri, Imo State ... ...
on Computational Sciences, Information Assurance, Big Data, and STEM. Education .... Room rates 2012/2014. ROOM. RATES. DEPOSIT. SUPERIOR DOUBLE.

The City University of New York - The Graduate Center, CUNY
Jul 6, 2011 - Act as a First Responder to alarms and calls for service. Observe campus activities, reporting suspicious behavior and other incidents to Central ...

National Survey - Public Policy Center - University of Iowa
Additionally, the project team brought in Knowledge Networks, a nationally .... Upon receiving the responses, the UI compiled all the expert responses into a single ..... 'social media (Facebook, twitter)' (4.7%) and 'brochures, pamphlets' (5.2%).

National Survey - Public Policy Center - University of Iowa
component of the National Driver Safety Education Campaign. ... Additionally, the project team brought in Knowledge Networks, a nationally ..... Respondents were asked to report (to the best of their knowledge) which vehicle safety ... Table 10: Tech

University of Texas Health Science Center at San Antonio.pdf
University of Texas Health Science Center at San Antonio.pdf. University of Texas Health Science Center at San Antonio.pdf. Open. Extract. Open with. Sign In.

The University of Arizona Center for Environmental Physics and ...
collaborative soil science research focused on the application of geospatial, ... for an individual that can assist in project management, including data analysis.

The University of Arizona Center for Environmental Physics and ...
The University of Arizona Center for Environmental Physics and Mineralogy and Environmental. Pedology ... immediate need for an individual that can assist in project management, including data analysis ... Please feel free to contact Craig.