13.07.2015 Views

High Level Clones Classification - International Journal of ...

High Level Clones Classification - International Journal of ...

High Level Clones Classification - International Journal of ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>High</strong> <strong>Level</strong> <strong>Clones</strong> <strong>Classification</strong>A. Behaviour <strong>Clones</strong>Juergens et al. [9] call two pieces <strong>of</strong> code behaviourallyequal, if they have the same sets <strong>of</strong> input and outputvariables and are equal with respect to their functioninterpretation. So, for each input valuation they have toproduce exactly the same outputs.. Kwon [10] describesbehavioural clones to depict similar run time behaviour.These can be detected as: if any two programs having sameDirected Acyclic Graph (DAG) modeling data dependencyor same control flow dependency, then they are behaviourclones <strong>of</strong> each other. Simply we can say that if two codesgive similar output by giving same input then they can callbehaviour clone. This is not necessary that they arerepresentationally same. They may or may not berepresentationally same. Such type <strong>of</strong> clone could berepresented by our example <strong>of</strong> swapping two variablevalues, Figure 2(a), 2(b) shows different representations <strong>of</strong>this example but they all give similar output <strong>of</strong> figure 2(c).templates”. Design patterns and mental templates (or"skeletons") <strong>of</strong> how a program should work, also fall underthe category <strong>of</strong> concept clones. Mental templates reflectcommon programming wisdom or programmer’s specificexperiences.C. Structural <strong>Clones</strong>These clones may be defined as similar program structuresthat are formed by lower level, smaller clones, with similarcode fragments (i.e., conventional clones described inliterature) at the bottom <strong>of</strong> such hierarchy. This concept <strong>of</strong>moving from lower level similarities to higher levelsimilarities can be repeatedly applied, leading to thediscovery <strong>of</strong> design concepts at various levels <strong>of</strong> abstraction.Basit[12] visualizes example <strong>of</strong> structural clones as in Fig 3.Figure 2 (a): Swap Nnumbers by Using Bitwise operatorFigure 2 (b): Swap Nnumbers by Using Temporary VariableFigure 2 (c) Output <strong>of</strong> Figure 2(a) and 2(b)B. Concept clonesFrom the experience <strong>of</strong> Marcus [11], these clones manifestthemselves as higher level abstractions in problem orsolution domain like an ADT (Abstract Data Type) list. It isworth noting that the high level concept for which the cloneis being detected depends on the user’s understanding <strong>of</strong> thesystem. Their detection is improved with internaldocumentation and program semantics, where a semanticsimilarity is defined in terms <strong>of</strong> similar input and outputconditions. Design solutions repeatedly applied byprogrammers to solve similar problems are called “mentalFigure 3 : Structural <strong>Clones</strong>This considers a group <strong>of</strong> simple clone configurationsrecurring rring in files X1, X2 and X3 a file-level structural cloneset. These file level structural clone set form collaborative(via message passing) structures <strong>of</strong> structural clones. Basit[13] describe how structural clone analysis extends thebenefits <strong>of</strong> analysis based on simple clones only and discussthe concept that structural clones covers all kinds <strong>of</strong> largegranularity repeated program structures.D. Domain model clonesThese are similarities in UML domain models like Classdiagram, ER diagram, Use case diagram etc. It is likely thatat some point, the overall model will contain duplicatefragments <strong>of</strong> sub models or model elements i.e. modelclones, as per Harald. [14]. <strong>Clones</strong> in UML domain modelscan cause a problem during model based development,hence it is important to detect them. This is best possiblethrough application <strong>of</strong> any <strong>of</strong> the reverse engineering tool,followed by domain expert’s knowledge.Case Study: Hospital Management SystemHere a case study <strong>of</strong> Hospital Management System is takento show UML diagrams to detect the clones at design leveland then removing them. The Hospital Management Systemprovides relevant information across the hospital to supporteffective decision making for patient care and hospitaladministration.The HOSPITAL MANAGEMENT SYSTEM (HMS) coversmany hospital activities. Every hospital big or small keepsthe records <strong>of</strong> its patients including the registration details <strong>of</strong>the patient and the fee payments. Patients are categorized asIn Patients and Out Patients. The entry <strong>of</strong> patients isdetermined whether he has arrived in emergency, OPD orfor a routine check-up. The patient who gets admitted isprovided with a room according to his/her choice. Thepatient is allotted a doctor according to his illness. The383

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!