Top Banner
Identifying Reusable Identifying Reusable Components in Web Components in Web Applications Applications P. Tramontana P. Tramontana U. De Carlini, A.R. Fasolino U. De Carlini, A.R. Fasolino Dipartimento di Informatica e Dipartimento di Informatica e Sistemistica Sistemistica University of University of Naples Federico II, Italy Naples Federico II, Italy G.A. Di Lucca G.A. Di Lucca RCOST – Research Centre on Software Technology RCOST – Research Centre on Software Technology University of Sannio, Benevento, Italy University of Sannio, Benevento, Italy
19

Identifying Reusable Components in Web Applications

Nov 15, 2014

Download

Technology

The growing market request for Web Applications is forcing software industries to produce applications under the pressure of a short time-to-market and a strong competition, with the consequence that low quality and poor documented software is often produced. Maintaining, evolving or comprehending these applications are not straightforward tasks, and reverse engineering processes should be defined and validated to support them.
In this paper a reverse engineering approach for reconstructing an object-oriented conceptual model of the application domain of a Web Application is presented. The proposed approach defines a process that reconstructs the model in three steps. In each step, heuristic criteria exploiting source code analysis are used for the identification of objects and their relationships. Tools for implementing this method have been produced, and experiments for validating it have been carried out with the support of case studies. Experimental results showed the feasibility and the effectiveness of the proposed approach.
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Identifying Reusable Components in Web Applications

Identifying Reusable Identifying Reusable Components in Web Components in Web

ApplicationsApplications

P. Tramontana P. Tramontana

U. De Carlini, A.R. FasolinoU. De Carlini, A.R. Fasolino Dipartimento di Informatica e SistemisticaDipartimento di Informatica e Sistemistica

University of Naples Federico II, ItalyUniversity of Naples Federico II, Italy

G.A. Di LuccaG.A. Di LuccaRCOST – Research Centre on Software TechnologyRCOST – Research Centre on Software Technology

University of Sannio, Benevento, ItalyUniversity of Sannio, Benevento, Italy

Page 2: Identifying Reusable Components in Web Applications

OutlineOutline

• Reusability in Web Applications

• Clones

• Clone Analysis Process

• An experiment

Page 3: Identifying Reusable Components in Web Applications

Web Applications (WA): Web Applications (WA): problems and open issuesproblems and open issues

• Basic software engineering principles, such as modularity, encapsulation, or separation of concerns cannot be realized with some Web Application implementation technologies

Maintaining and evolving these systems are difficult and expensive tasks.

Page 4: Identifying Reusable Components in Web Applications

Web Applications (WA): Web Applications (WA): problems and open issuesproblems and open issues

• HTML language does not encourage HTML language does not encourage the information content to be the information content to be separated from its renderingseparated from its rendering

• Server and Client scripting languages Server and Client scripting languages don’t encourage separation between don’t encourage separation between Layout, Content and Business RulesLayout, Content and Business Rules

Page 5: Identifying Reusable Components in Web Applications

Web Applications (WA): Web Applications (WA): problems and open issuesproblems and open issues

• Practice of developing new applications by cloning existing pieces of code is frequently adopted

Web applications provide a valuable source of reusable software, which can be used with success to support their maintenance, reengineering and evolution.

Page 6: Identifying Reusable Components in Web Applications

Clone DefinitionClone Definition

Clones: Clones: Duplicated or similar Duplicated or similar portions of code in software portions of code in software artifactsartifacts

What kind of portions of code?What kind of portions of code?

How measure similarity between How measure similarity between these portions of code?these portions of code?

Page 7: Identifying Reusable Components in Web Applications

What kind of portions of code?What kind of portions of code?

Degree of granularity of a clone

Type of clone

Client Page Web Page

Server Page

Script Block

Script Function

HTML Form

Client Page inner components

HTML table

Script Block Server Page inner components

Script Function

Page 8: Identifying Reusable Components in Web Applications

Comparing source code Comparing source code

•Levenshtein distance:Levenshtein distance:Minimum number of insertions, deletions, and replacements of elements necessary to make two vectors equal

• Euclidean distanceEuclidean distance

Page 9: Identifying Reusable Components in Web Applications

Distance between portions of Distance between portions of codecode

Technique

Description

STH Strings of HTML tags extracted from client pages are compared by the Levenshtein distance.

CTH Counts of HTML tags extracted from client pages are compared by the Euclidean distance.

SOA Strings of ASP built-in objects extracted from server pages are compared by the Levenshtein distance.

AMA An array of software metrics extracted from ASP script blocks in server pages is used to compare server pages by the Euclidean distance.

Page 10: Identifying Reusable Components in Web Applications

  Software MetricsNTC Total Number of characters per page

NTRC Total Number of lines of code per page

NTBC Total Number of ASP code blocks per page

NTSD Total Number of declarative statements per page

NTSC Total Number of conditional statements per page

NTSI Total Number of cyclic statements per page

NTF Total Number of Functions per page

NTS Total Number of Subroutines per page

NTOP Total Number of built-in ASP objects per page

LDBC Levenshtein distance of ASP code blocks

Metrics for AMAMetrics for AMA

Page 11: Identifying Reusable Components in Web Applications

Phases of Clone Analysis ProcessPhases of Clone Analysis Process

1.1. Separation of control and data Separation of control and data component within Web pagescomponent within Web pages

2.2. Clone DetectionClone Detection3.3. Clone ValidationClone Validation4.4. Template GenerationTemplate Generation5.5. Repository population Repository population 

Page 12: Identifying Reusable Components in Web Applications

Separation of control and data Separation of control and data componentcomponent

• Structure and data component are separated in HTML portions of code

• ASP block code is transformed removing blank characters and comments from the line, and substituting each data element (such as constants, or identifiers) by a dummy one. .

• Consecutive blocks of ASP code will be merged in a single comprehensive block.

Page 13: Identifying Reusable Components in Web Applications

Clone DetectionClone Detection

• Metrics are calculated for each component

• Clone analysis techniques are applied

• Clone and near-miss-clone are automatically detected with the support of CloneDetector tool

Page 14: Identifying Reusable Components in Web Applications

Clone ValidationClone Validation

Clones (and near-miss-clones) are assessed by an expert, considering:•meaningfulnessmeaningfulness (does the considered clone (does the considered clone implement a meaningful abstraction in the implement a meaningful abstraction in the business domain, or in the solution domain?)business domain, or in the solution domain?)•completenesscompleteness (does the clone include all the (does the clone include all the lines of code necessary for implementing a lines of code necessary for implementing a valid abstraction?). valid abstraction?).

Clones may be discarded, merged or accepted Clones may be discarded, merged or accepted as reusable components.as reusable components.

Page 15: Identifying Reusable Components in Web Applications

Template generationTemplate generation

For each validated cluster of clones, a Template will be derived

Page 16: Identifying Reusable Components in Web Applications

Repository populationRepository population

Template information are stored in a repository, together with component information

Template

CloneCluster DataComponent

TagAttribute

WebPage

Client Server

PageSubComponent

Form Table Script Function Subroutine

{incomplete}

Dummy

ControlComponent

HTMLTag Statement

follows

1

1

1..*

1

1

0..*

**

Page 17: Identifying Reusable Components in Web Applications

ExperimentExperiment

An experiment has been carried out, with 4 real web applicationsWe used CloneDetector tool to search exact clones of:

HTML pages (STH technique) client scripts (STH technique) functions in client scripts (STH

technique) forms (STH technique) tables (STH technique) ASP pages (AMA technique) ASP script blocks (AMA technique) functions/subroutines in ASP pages (AMA

technique)

Page 18: Identifying Reusable Components in Web Applications

WA1 WA2 WA3 WA4 # HTML pages 55 23 23 - # cloned HTML pages 18 2 8 - # clusters of cloned HTML pages 3 1 4 - # scripts in client pages 3 12 10 - # cloned client scripts 3 4 2 - # cluste rs of cloned client scripts 1 2 1 - # functions in client pages 12 10 10 - # cloned client functions 12 4 2 - # clusters of cloned client functions 4 2 1 - # forms in client pages 1 8 10 - # cloned client forms 0 2 9 - # clusters of clo ned client forms 0 1 3 - # tables in client pages 7 4 3 - # cloned client tables 0 0 0 - # clusters of cloned client tables 0 0 0 - # ASP pages 19 73 37 71 # cloned ASP pages 2 15 3 2 # clusters of cloned ASP pages 1 6 1 1 # scripts in ASP pages 75 576 150 5341 # cloned ASP scripts 4 0 36 0 # clusters of cloned ASP scripts 2 0 3 0 # functions/subroutines in ASP pages 5 0 3 165 # cloned ASP functions/subroutines 0 0 0 9 # clusters of cloned ASP functions/subroutines

0 0 0 3

ResultsResults

Page 19: Identifying Reusable Components in Web Applications

ConclusionsConclusions

A clone detection method has been presented

An experiment has been carried out

Many cluster of cloned artifact has been detected and validated

Some reusable component has been abstracted as templates

Reengineering of static pages in a XML/XSL architecture may be performed

Reuse of components or pages may be performed