• 제목/요약/키워드: code clone

검색결과 25건 처리시간 0.023초

Domain Analysis of Device Drivers Using Code Clone Detection Method

  • Ma, Yu-Seung;Woo, Duk-Kyun
    • ETRI Journal
    • /
    • 제30권3호
    • /
    • pp.394-402
    • /
    • 2008
  • Domain analysis is the process of analyzing related software systems in a domain to find their common and variable parts. In the case of device drivers, they are highly suitable for domain analysis because device drivers of the same domain are implemented similarly for each device and each system that they support. Considering this characteristic, this paper introduces a new approach to the domain analysis of device drivers. Our method uses a code clone detection technique to extract similarity among device drivers of the same domain. To examine the applicability of our method, we investigated whole device drivers of a Linux source. Results showed that many reusable similar codes can be discerned by the code clone detection method. We also investigated if our method is applicable to other kernel sources. However, the results show that the code clone detection method is not useful for the domain analysis of all kernel sources. That is, the applicability of the code clone detection method to domain analysis is a peculiar feature of device drivers.

  • PDF

CCR : 트리패턴 기반의 코드클론 탐지기 (CCR : Tree-pattern based Code-clone Detector)

  • 이효섭;도경구
    • 한국소프트웨어감정평가학회 논문지
    • /
    • 제8권2호
    • /
    • pp.13-27
    • /
    • 2012
  • 본 연구에서는 트리패턴 기반으로 코드클론을 탐지하는 도구인 CCR(Code Clone Ransacker)를 제안하고 구현하였다. CCR은 프로그램 트리의 모든 하위트리 쌍을 비교하여 중복된 부분인 트리패턴을 찾고 동일한 모양의 패턴들을 하나로 묶어 프로그램에 존재하는 클론들을 샅샅이 탐지한다. 이때 이미 찾은 패턴 내부의 클론 패턴을 비교대상에서 제외하여 중복계산을 하지 않아 불필요한 예산을 최대한 줄인다. 실험으로 CCR의 성능을 평가한 결과, CCR의 정확성과 탐지성은 높다. 프로그램의 구조를 비교하는 기존의 트리패턴 기반의 코드클론 탐지 도구들의 정확성과 탐지성은 이미 좋은 것으로 알려져 있지만, CCR은 높은 정확성을 유지하면서 탐지성은 기존의 Asta보다는 최대 5배, CloneDigger보다는 약 1.9배 높다. 그리고 CCR이 찾은 코드클론은 기존의 코드클론 표본 집합체의 클론을 대부분 포함한다.

Tree-Pattern-Based Clone Detection with High Precision and Recall

  • Lee, Hyo-Sub;Choi, Myung-Ryul;Doh, Kyung-Goo
    • KSII Transactions on Internet and Information Systems (TIIS)
    • /
    • 제12권5호
    • /
    • pp.1932-1950
    • /
    • 2018
  • The paper proposes a code-clone detection method that gives the highest possible precision and recall, without giving much attention to efficiency and scalability. The goal is to automatically create a reliable reference corpus that can be used as a basis for evaluating the precision and recall of clone detection tools. The algorithm takes an abstract-syntax-tree representation of source code and thoroughly examines every possible pair of all duplicate tree patterns in the tree, while avoiding unnecessary and duplicated comparisons wherever possible. The largest possible duplicate patterns are then collected in the set of pattern clusters that are used to identify code clones. The method is implemented and evaluated for a standard set of open-source Java applications. The experimental result shows very high precision and recall. False-negative clones missed by our method are all non-contiguous clones. Finally, the concept of neighbor patterns, which can be used to improve recall by detecting non-contiguous clones and intertwined clones, is proposed.

트리 기반 컨볼루션 신경망을 이용한 BigCloneBench 개선 (Improvement of BigCloneBench Using Tree-Based Convolutional Neural Network)

  • 박건우;홍성문;김현하;도경구
    • 한국소프트웨어감정평가학회 논문지
    • /
    • 제15권1호
    • /
    • pp.43-53
    • /
    • 2019
  • 기계 학습을 이용하여 의미가 유사한 코드 클론을 탐지하는 도구의 성능 평가에 빅클론벤치를 많이 활용한다. 하지만 빅클론벤치는 기계 학습에 최적화된 벤치마크가 아니기 때문에 그대로 기계 학습에 사용하면 잘못된 학습 데이터가 만들어질 수 있다. 본 연구에서는 빅클론벤치에서 제공하고 있는 코드 클론 데이터에서 누락된 타입-4 클론을 기계 학습을 이용하여 추가로 찾아 보완함으로써 빅클론벤치를 개선할 수 있음을 실험적으로 밝힌다. 트리 기반 컨볼루션 신경망을 이용한 기계 학습 모델을 사용해서 개선된 데이터를 학습했을 때, 기존의 데이터를 학습했을 때에 비해 기계 학습의 정확도 및 성능이 향상되었음을 확인하였다.

공통 토큰에 기반한 서로 다른 언어의 유사성 검사 (Cross-Language Clone Detection based on Common Token)

  • 홍성문;김현하;이제형;박성우;모지환;도경구
    • 한국소프트웨어감정평가학회 논문지
    • /
    • 제14권2호
    • /
    • pp.35-44
    • /
    • 2018
  • 서로 다른 언어로 작성된 소스코드의 유사성 검사는 주로 요약구문트리를 기반으로 비교를 수행한다. 하지만 대규모의 소스코드를 실용적인 수준으로 비교하려면 토큰수준 기반에서 작동하는 유사성 검사 기술이 필요하다. 본 연구에서는 서로 다른 언어에서 생성되었지만 같은 의미를 지닌 토큰을 표현할 수 있는 공통 토큰을 정의하고, 소스코드에서 언어별 처리 과정을 거쳐 생성한 공통 토큰의 나열을 입력으로 소스코드의 유사성 검사를 수행하는 방법을 제안한다. 한국저작권위원회의 표절검사 도구 exEyes를 사용해서 서로 다른 언어로 작성된 동일한 코드를 대상으로 실험한 결과, 제안한 방법을 사용했을 때, 유사성 평가 성능이 향상됨을 보였다.

code2vec을 이용한 유사도 감정 도구의 성능 개선 (Enhancing the performance of code-clone detection tools using code2vec)

  • 엄태호;홍성문;양준혁;장효석;도경구
    • 한국소프트웨어감정평가학회 논문지
    • /
    • 제17권1호
    • /
    • pp.31-40
    • /
    • 2021
  • 소스코드 표절은 원본 자료의 출처를 분명히 밝히지 않고 자신의 것처럼 사용하는 행위를 말한다. 소스코드 표절로 인한 문제는 법적인 분쟁을 다투는 경우까지 다양한 문제를 일으킨다. 소스코드의 표절 여부는 일반적으로 비교 대상 소프트웨어 프로젝트 내의 각 소스코드를 전수 비교하여 유사도를 측정하여 결정한다. 전수 비교는 표절 가능성이 전혀 없는 코드도 비교 대상에 포함하기 때문에 그만큼의 시간을 헛되이 소모한다. 소스코드 표절로 의심되는 비교 쌍만 선별하여 비교할 수 있으면 그만큼 비교 횟수는 줄어들게 되어 탐지 도구의 실행 속도를 향상시킬 수 있을 뿐만 아니라, 표절 가능성이 높은 부분만을 대상으로 탐지의 정확도를 높이는데 집중할 수도 있다. 본 논문에서는 code2vec 이라는 기계학습 모델을 활용하여 코드 클론으로 의심되는 소스코드들을 미리 분류하여 비교 횟수를 줄임으로써 소스코드 표절 탐지의 성능을 개선할 수 있음을 보인다.

코드클론 표본 집합체 자동 생성기 (Automatic Generation of Code-clone Reference Corpus)

  • 이효섭;도경구
    • 한국소프트웨어감정평가학회 논문지
    • /
    • 제7권1호
    • /
    • pp.29-39
    • /
    • 2011
  • 프로그램 내의 코드클론을 찾아주는 도구나 기술들을 평가하기 위해서는 해당 도구가 탐지하는 못하는 클론이 있는지 확인해야 한다. 이를 위해서 샘플 소스코드에 대해서 코드클론을 모두 모아놓은 표준 표본 집합체가 필요하다. 그런데 기존의 코드클론 표본 집합체는 여러 클론탐지 도구의 결과들을 참조해 수작업으로 구축하지만 평가 기준으로 사용하기에는 빠져있는 표본이 많다. 본 연구에서는 자동으로 코드클론 표본 집합체를 생성하는 방법을 제안하고 도구를 구현하였다. 이 도구는 프로그램 소스를 핵심구문트리로 변환한 뒤, 트리를 샅샅이 비교하여 클론 패턴을 찾아낸다. 본 도구는 오탐이 없으며, 특정한 패턴을 제외하고 미탐도 없어서 코드클론 표본 집합체를 자동으로 생성하기 적합하다. 실험결과 상용도구인 CloneDR에서 찾아낸 클론을 모두 포함하면서 2-3배 더 많은 클론들을 찾아내었고, Bellon의 기존 표본 집합체의 클론들을 거의 대부분 포함(93-100%)하면서 자동 구축한 표본 집합체의 크기가 훨씬 크다.

토큰 크기 및 출현 빈도에 기반한 웹 페이지 유사도 (Web Page Similarity based on Size and Frequency of Tokens)

  • 이은주;정우성
    • 한국IT서비스학회지
    • /
    • 제11권4호
    • /
    • pp.263-275
    • /
    • 2012
  • It is becoming hard to maintain web applications because of high complexity and duplication of web pages. However, most of research about code clone is focusing on code hunks, and their target is limited to a specific language. Thus, we propose GSIM, a language-independent statistical approach to detect similar pages based on scarcity and frequency of customized tokens. The tokens, which can be obtained from pages splitted by a set of given separators, are defined as atomic elements for calculating similarity between two pages. In this paper, the domain definition for web applications and algorithms for collecting tokens, making matrics, calculating similarity are given. We also conducted experiments on open source codes for evaluation, with our GSIM tool. The results show the applicability of the proposed method and the effects of parameters such as threshold, toughness, length of tokens, on their quality and performance.

제품군의 재사용 가능한 클론 코드의 메소드 경로 통일을 위한 코드 클러스터링 방법 (A Code Clustering Technique for Unifying Method Full Path of Reusable Cloned Code Sets of a Product Family)

  • 김태영;이지현;김은미
    • 정보처리학회논문지:소프트웨어 및 데이터공학
    • /
    • 제12권1호
    • /
    • pp.1-18
    • /
    • 2023
  • 유사한 소프트웨어는 기존 산출물을 복제하고 수정하는 클론-앤-오운(clone-and-own, CAO) 방법으로 개발되곤 한다. 그러나 클론-앤-오운 방법은 복제된 제품의 수가 늘면서 유지보수를 어렵게 만들기 때문에 나쁜 프랙티스로 간주된다. 소프트웨어 제품라인 공학은 체계적인 재사용을 통해 소프트웨어 제품군을 개발하는 방법으로 클론-앤-오운 방법의 문제를 해결할 수 있다. CAO 방식으로 개발되어 온 제품패밀리를 제품라인 공학으로 마이그레이션하는 작업은 여러 소프트웨어 제품에서 클로닝된 부분들을 찾아 통합하고 재사용 가능한 자산으로 구축하는 것으로부터 시작된다. 그러나 클로닝이 디렉토리부터 코드 라인까지 다양한 수준에서 발생하고 그 과정에서 이들의 구조에 변경이 일어날 수 있어 단순하게 클로닝을 찾아내는 것만으로는 고품질의 제품라인 코드베이스를 구축하기 어렵다. 성공적인 마이그레이션을 위해서는 소스 코드들 사이의 클로닝 관계를 찾는 것 이외에도 소스 코드들의 파일 경로와 클래스 이름, 메소드 시그니처 등의 동일성을 확보는 작업이 선행되어야 한다. 이에 본 연구는 CAO 기반으로 개발된 제품들로부터 마이그레이션 대상 제품들을 선정한 후 제품들에 흩어져 있는 유사 코드 집합을 검출하여 메소드 경로의 통일이 필요한 대상을 식별하는 클러스터링 방법을 제안한다. 제안 방법의 효과를 보이기 위해 CAO 방식으로 진화해온 ApoGames 제품군에 제안 방법을 적용하여 실험을 진행하였다. 그 결과, 전처리 없이 수행된 파일의 상대 경로 기반 클러스터링 방법의 평균 정밀도는 0.91이며 식별된 공통 클러스터의 개수는 0개인 반면에 이 논문에서 제안하는 전처리와 함께 수행된 메소드 시그니처 기반 클러스터링 방법의 평균 정밀도는 0.98로 개선되었으며 식별된 공통 클러스터는 최대 15개까지 증가하였다.

Which Code Changes Should You Review First?: A Code Review Tool to Summarize and Prioritize Important Software Changes

  • Song, Myoungkyu;Kwon, Young-Woo
    • Journal of Multimedia Information System
    • /
    • 제4권4호
    • /
    • pp.255-262
    • /
    • 2017
  • In recent software development, repetitive code fragments (i.e., clones) are common due to the copy-and-paste programming practice, the framework-based development, or the reuse of same design patterns. Such similar code fragments are likely to introduce more bugs but are easily disregarded by a code reviewer or a programmer. In this paper, we present a code review tool to help code reviewers identify important code changes written by other programmers and recommend which changes need to be reviewed first. Specifically, to identify important code changes, our approach detects code clones across revisions and investigates them. Then, to help a code reviewer, our approach ranks the identified changes in accordance with several software quality metrics and statistics on those clones and changes. Furthermore, our approach allows the code reviewer to express their preferences during code review time. As a result, the code reviewer who has little knowledge of a code base can reduce his or her effort by reviewing the most significant changes that require an instant attention. To evaluate our approach, we integrated our approach with a modern IDE (e.g., Eclipse) as a plugin and then analyzed two third-party open source projects. The experimental results indicate that our approach can improve code reviewer's productivity.