KR20200072711A - System for comparing source code for software reuse - Google Patents

System for comparing source code for software reuse Download PDF

Info

Publication number
KR20200072711A
KR20200072711A KR1020180160606A KR20180160606A KR20200072711A KR 20200072711 A KR20200072711 A KR 20200072711A KR 1020180160606 A KR1020180160606 A KR 1020180160606A KR 20180160606 A KR20180160606 A KR 20180160606A KR 20200072711 A KR20200072711 A KR 20200072711A
Authority
KR
South Korea
Prior art keywords
file
source code
function
comparison system
software reuse
Prior art date
Application number
KR1020180160606A
Other languages
Korean (ko)
Other versions
KR102160544B1 (en
Inventor
김종화
Original Assignee
한화시스템 주식회사
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 한화시스템 주식회사 filed Critical 한화시스템 주식회사
Priority to KR1020180160606A priority Critical patent/KR102160544B1/en
Publication of KR20200072711A publication Critical patent/KR20200072711A/en
Application granted granted Critical
Publication of KR102160544B1 publication Critical patent/KR102160544B1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/36Software reuse

Abstract

The present invention relates to a source code comparison system for software reuse. More specifically, source codes included in a first file and a second file are classified into function units to determine whether there is a change. The source code comparison system for software reuse comprises a generation part, and a change part.

Description

소프트웨어 재사용을 위한 소스코드 비교 시스템{SYSTEM FOR COMPARING SOURCE CODE FOR SOFTWARE REUSE}Source code comparison system for software reuse {SYSTEM FOR COMPARING SOURCE CODE FOR SOFTWARE REUSE}

본 발명은 소프트웨어 재사용을 위한 소스코드 비교 시스템에 관한 것으로, 보다 상세하게는 비교하고자 하는 파일의 소스코드를 함수단위로 구분하여 상호 비교할 수 있도록 하는 소프트웨어 재사용을 위한 소스코드 비교 시스템에 관한 것이다.The present invention relates to a source code comparison system for reusing software, and more particularly, to a source code comparison system for reusing software that allows the source codes of files to be compared to be divided into function units and mutually compared.

소프트웨어의 재사용이란, 기존의 소프트웨어에서 표준화된 공통부분과 잘 알려진 프로세스를 이용하여, 품질 및 생산성을 향상시키며 새로운 소프트웨어의 생산하는 것을 말한다. 소프트웨어의 재사용을 위해 가장 중요한 것은 기존의 소프트웨어를 구성하는 소스코드의 이해이다.Reuse of software refers to the production of new software by improving the quality and productivity by using common parts and well-known processes standardized in existing software. The most important thing for reuse of software is to understand the source code that composes the existing software.

소스코드의 설계문서가 있는 경우는 소스코드의 이해가 어렵지 않을 것이나, 일반적으로 소프트웨어는 최초 개발된 후 빈번한 수정을 거치므로 설계문서와 소스코드가 일치하지 않는 경우가 많다. 또한, 다양한 사람들의 협업에 의해 개발되는 오픈 소스의 경우, 설계문서를 기대할 수 없고 간단한 기능소개문서를 기초로 소스코드를 이해하여야 하는 경우가 대다수이다.If there is a design document of the source code, it will not be difficult to understand the source code, but in general, the design document and the source code are often inconsistent because the software undergoes frequent modifications after the initial development. In addition, in the case of open source developed by the collaboration of various people, design documents cannot be expected, and in most cases, it is necessary to understand the source code based on a simple function introduction document.

기능소개문서는 존재하나 설계문서가 존재하지 않는 소프트웨어를 재사용하려고 하는 경우, 전체 소스코드 분석을 통해 소프트웨어를 이해하는 것은 비용과 시간이 많이 소요된다는 문제점이 있다. If you want to reuse software that has a functional introduction document but no design document, understanding the software through full source code analysis has a problem that it takes a lot of time and money.

한편, 소프트웨어 재상용을 위해 두 개의 파일을 비교해야 하는 경우, 파일 비교 프로그램을 이용하여 두 개의 파일에 대한 전체적인 차이를 비교한다. 이때, 비교는 라인단위로 이루어진다. 그 결과로 두 개의 파일을 모두 보여주면서 차이가 발생하는 라인이 어디인지에 대한 표시를 해준다. 사용자는 이를 통해 차이가 발생하는 부분이 어디인지를 알 수 있다.On the other hand, if two files need to be compared for software re-use, the overall difference between the two files is compared using a file comparison program. At this time, the comparison is made on a line-by-line basis. As a result, both files are shown, showing where the difference line is. Through this, the user can know where the difference occurs.

하나의 소프트웨어를 다양한 사업에서 재사용하게 되면서 각가의 사업마다 소프트웨어 소스코드는 따로 관리가 되는데, 이 경우 서로 다른 사업에서 서로 다른 변경이 발생하게 되면 시간이 가면서 형상은 당연히 달라지게 된다. 이 경우, 앞서 설명한 기존의 파일 비교 프로그램을 이용하여 소스코드를 비교하면 변경점을 알 수 있다. 그러나, 어느 라인이 변경되었다는 정도만을 알 수 있을 뿐, 어떤 함수가 변경되었는지, 어느 기능이 변경되었는지를 확인할 수는 없다. 그렇기 때문에 이 방식을 사용하는 사용자는 어떤 함수가 변경되었는지, 어느 기능이 변경되었는지를 확인하기 위해서는 변경된 라인의 앞뒤를 직접 찾아봐야만 하기때문에 많은 시간을 소요해야 한다는 문제점이 있다.As one software is reused in various businesses, the software source code is managed separately for each business. In this case, if different changes occur in different businesses, the shape will naturally change over time. In this case, if you compare the source code using the existing file comparison program described above, you can see the change. However, only the degree to which the line has been changed can be known, and it is not possible to confirm which function has been changed and which function has been changed. Therefore, the user who uses this method has a problem in that it takes a lot of time because it has to directly search for the front and back of the changed line to check which function has been changed and which function has been changed.

따라서, 소프트웨어 재사용을 위해 복수개의 파일을 비교해야 하는 경우, 사용자가 변경된 함수에 대한 정보를 바로 확인할 수 있도록 하는 기술이 개발될 필요가 있다.Therefore, when it is necessary to compare a plurality of files for software reuse, it is necessary to develop a technology that allows a user to immediately check information about a changed function.

따라서, 본 발명은 상기한 바와 같은 문제점을 해결하기 위하여 제안된 것으로, 소프트웨어 재사용을 위해 같은 형상의 소스코드로 시작했지만 서로 다른 방향으로 수정되어 온 소스코드를 비교해야 하는 경우, 사용자가 변경된 함수에 대한 정보를 바로 확인할 수 있도록 하는 소프트웨어 재사용을 위한 소스코드 비교 시스템을 제공함에 있다.Therefore, the present invention has been proposed to solve the above-described problems, and when the source code having the same shape has been started for software reuse, but the source code that has been modified in different directions needs to be compared, the user may use the changed function. It is to provide a source code comparison system for reuse of software that allows users to immediately check the information.

또한, 본 발명은 사용자가 어떤 함수가 변경되었는지, 어느 기능이 변경되었는지 등을 확인하기 위해서 변경된 라인의 앞뒤를 직접 찾아볼 필요가 없도록 함으로써 소스코드를 비교하는데 소요되는 시간을 감소시킬 수 있도록 하는 소프트웨어 재사용을 위한 소스코드 비교 시스템을 제공함에 있다.In addition, the present invention allows the user to reduce the time required to compare the source code by not having to directly search for the front and back of the changed line in order to check which function has been changed, which function has been changed, and the like. It is to provide a source code comparison system for reuse.

본 발명의 목적은 이상에서 언급한 것으로 제한되지 않으며, 언급되지 않은 또 다른 목적들은 아래의 기재로부터 본 발명이 속하는 기술 분야의 통상의 지식을 가진 자에게 명확히 이해될 수 있을 것이다.The objects of the present invention are not limited to those mentioned above, and other objects not mentioned will be clearly understood by those skilled in the art from the following description.

상기와 같은 목적을 달성하기 위한 본 발명에 따른 소프트웨어 재사용을 위한 소스코드 비교 시스템은, 제1 파일 및 제2 파일을 입력받는 생성부; 상기 생성부에서 입력받은 제1 파일 및 제2 파일에 포함된 소스코드를 각각 함수단위로 구분하여 변경 여부를 확인하는 변경부를 포함하도록 구성될 수 있다.The source code comparison system for software reuse according to the present invention for achieving the above object includes: a generation unit that receives first and second files; The source code included in the first file and the second file input from the generation unit may be divided into function units, and may be configured to include a change unit for checking whether or not the change is made.

여기서, 상기 제1 파일 및 제2 파일에 포함된 소스코드는, 정규표현식을 기반으로 각각 함수단위로 구분될 수 있다.Here, the source codes included in the first file and the second file may be divided into functional units based on regular expressions.

그리고 상기 비교부는, 상기 확인 결과, 변경이 발생한 함수를 리스트로 관리하도록 구성될 수 있다.In addition, the comparison unit may be configured to manage a function in which a change has occurred as a result of the check as a list.

또한, 본 발명에 따른 소프트웨어 재사용을 위한 소스코드 비교 시스템은, 제1 파일 및 제2 파일에 포함된 소스코드를 함수단위로 구분하여 함수를 검출하는 생성부; 상기 검출된 함수에서 동일한 이름을 갖는 함수의 내용을 비교하여 변경여부를 판단하는 비교부를 포함하도록 구성될 수 있다.In addition, the source code comparison system for software reuse according to the present invention includes: a generator configured to detect functions by dividing source codes included in the first file and the second file into function units; It may be configured to include a comparison unit for comparing the contents of the function having the same name in the detected function to determine whether or not the change.

그리고 상기 제1 파일 및 제2 파일에 포함된 소스코드는, 정규표현식을 기반으로 각각 함수단위로 구분될 수 있다.In addition, the source codes included in the first file and the second file may be divided into functional units based on regular expressions.

그리고 상기 비교부는, 상기 확인 결과, 변경이 발생한 함수를 리스트로 관리하도록 구성될 수 있다.In addition, the comparison unit may be configured to manage a function in which a change has occurred as a result of the check as a list.

또한, 본 발명에 따른 소프트웨어 재사용을 위한 소스코드 비교 시스템은, 제1 파일 및 제2 파일에 포함된 소스코드를 함수단위로 구분하여 함수를 검출하는 함수 검출부; 상기 검출된 적어도 하나 이상의 함수를 함수의 이름과 내용을 포함하는 세트의 형태로 하여 리스트로 각각 생성하는 함수 분석부; 및 상기 생성된 리스트에서 동일한 이름을 갖는 함수의 내용을 비교하여 변경 여부를 판단하는 비교부를 포함하도록 구성될 수 있다.In addition, the source code comparison system for software reuse according to the present invention includes: a function detection unit for detecting functions by dividing source codes included in the first file and the second file into function units; A function analysis unit generating each of the detected at least one function as a list in the form of a set including the name and content of the function; And it may be configured to include a comparison unit for determining whether to change by comparing the contents of the function having the same name in the generated list.

그리고 상기 제1 파일 및 제2 파일에 포함된 소스코드는, 정규표현식을 기반으로 각각 함수단위로 구분될 수 있다.In addition, the source codes included in the first file and the second file may be divided into functional units based on regular expressions.

그리고 상기 내용은, SHA2 해쉬 알고리즘을 이용하여 길이 값이 미리 정해진 길이값으로 변경될 수 있다.In addition, the above content may be changed to a predetermined length value using a SHA2 hash algorithm.

또한, 본 발명에 따른 소프트웨어 재사용을 위한 소스코드 비교 시스템은, 제1 파일 및 제2 파일에 포함된 소스코드를 함수단위로 구분하여 함수를 검출하는 함수 검출부; 상기 검출된 적어도 하나 이상의 함수를 함수의 이름과 내용을 포함하는 세트의 형태로 하여 리스트로 각각 생성하는 함수 분석부; 상기 내용의 길이값을 미리 설정된 길이값으로 변경하여 상기 각각 생성된 리스트를 갱신하는 변경부; 상기 갱신된 리스트에서 동일한 이름을 갖는 함수의 내용을 비교하여 변경 여부를 판단하는 비교부를 포함하도록 구성될 수 있다.In addition, the source code comparison system for software reuse according to the present invention includes: a function detection unit for detecting functions by dividing source codes included in the first file and the second file into function units; A function analysis unit generating each of the detected at least one function as a list in the form of a set including the name and content of the function; A changing unit that changes the length value of the contents to a preset length value and updates the generated list; It may be configured to include a comparator that compares the contents of a function having the same name in the updated list to determine whether to change it.

여기서, 상기 제1 파일 및 제2 파일에 포함된 소스코드는, 정규표현식을 기반으로 각각 함수단위로 구분될 수 있다.Here, the source codes included in the first file and the second file may be divided into functional units based on regular expressions.

그리고 SHA2 해쉬 알고리즘을 이용하여 길이 값이 미리 정해진 길이값으로 변경될 수 있다.In addition, the length value may be changed to a predetermined length value using the SHA2 hash algorithm.

본 발명에 의하면, 소프트웨어 재사용을 위해 같은 형상의 소스코드로 시작했지만 서로 다른 방향으로 수정되어 온 소스코드를 비교해야 하는 경우, 사용자가 변경된 함수에 대한 정보를 바로 확인할 수 있다.According to the present invention, when starting with the same form of source code for software reuse but need to compare the source code that has been modified in different directions, the user can immediately check information about the changed function.

또한, 본 발명에 의하면, 사용자가 어떤 함수가 변경되었는지, 어느 기능이 변경되었는지 등을 확인하기 위해서 변경된 라인의 앞뒤를 직접 찾아볼 필요가 없도록 함으로써 소스코드를 비교하는데 소요되는 시간을 감소시킬 수 있다.In addition, according to the present invention, it is possible to reduce the time required to compare the source code by not requiring the user to directly search for the front and back of the changed line in order to check which function has been changed, which function has been changed, and the like. .

본 발명의 효과는 이상에서 언급한 것으로 제한되지 않으며, 언급되지 않은 또다른 효과들은 아래의 기재로부터 본 발명이 속하는 기술 분야의 통상의 지식을 가진 자에게 명확히 이해될 수 있을 것이다.The effects of the present invention are not limited to those mentioned above, and other effects not mentioned will be clearly understood by those skilled in the art from the following description.

도 1은 본 발명에 따른 소스코드 비교 방법을 개략적으로 나타내는 순서도이다.
도 2는 본 발명에 따른 정규표현식을 이용하여 함수 이름을 체크하는 일 예를 나타내는 도면이다.
도 3은 본 발명의 일 실시예에 따른 소스코드 비교 시스템의 구성을 나타내는 블록도이다.
도 4는 본 발명의 일 실시예에 따른 소스코드 비교 방법을 구체적으로 나타내는 순서도이다.
도 5는 본 발명의 일 실시예에 따른 소스코드 비교 결과가 표시된 사용자 인터페이스의 일 예를 나타내는 도면이다.
1 is a flowchart schematically showing a method for comparing source codes according to the present invention.
2 is a diagram illustrating an example of checking a function name using a regular expression according to the present invention.
3 is a block diagram showing the configuration of a source code comparison system according to an embodiment of the present invention.
4 is a flowchart specifically showing a method of comparing source codes according to an embodiment of the present invention.
5 is a diagram illustrating an example of a user interface in which source code comparison results are displayed according to an embodiment of the present invention.

본 발명의 목적 및 효과, 그리고 그것들을 달성하기 위한 기술적 구성들은 첨부되는 도면과 함께 상세하게 후술되어 있는 실시예들을 참조하면 명확해질 것이다. 본 발명을 설명함에 있어서 공지 기능 또는 구성에 대한 구체적인 설명이 본 발명의 요지를 불필요하게 흐릴 수 있다고 판단되는 경우에는 그 상세한 설명을 생략할 것이다. 그리고 후술되는 용어들은 본 발명에서의 기증을 고려하여 정의된 용어들로서 이는 사용자, 운용자의 의도 또는 관례 등에 따라 달라질 수 있다. The objectives and effects of the present invention, and technical configurations for achieving them, will be clarified with reference to embodiments described below in detail together with the accompanying drawings. In describing the present invention, when it is determined that a detailed description of known functions or configurations may unnecessarily obscure the subject matter of the present invention, the detailed description will be omitted. In addition, terms to be described later are terms defined in consideration of donations in the present invention, which may vary according to a user's or operator's intention or practice.

그러나, 본 발명은 이하에서 개시되는 실시예들에 한정되는 것이 아니라 서로 다른 다양한 형태로 구현될 수 있다. 단지 본 실시예들은 본 발명의 개시가 완전하도록 하고, 본 발명이 속하는 기술분야에서 통상의 지식을 가진 자에게 발명의 범주를 완전하게 알려주기 위해 제공되는 것이며, 본 발명은 청구항의 범주에 의해 정의될 뿐이다. 그러므로 그 정의는 본 명세서 전반에 걸친 내용을 토대로 내려져야 할 것이다. However, the present invention is not limited to the embodiments disclosed below, but may be implemented in various different forms. Only the present examples are provided to make the disclosure of the present invention complete, and to fully inform the person of ordinary skill in the art to which the present invention pertains, the scope of the invention being defined by the scope of the claims. It just works. Therefore, the definition should be made based on the contents throughout this specification.

한편, 명세서 전체에서, 어떤 부분이 다른 부분과 "연결"되어 있다고 할 때, 이는 "직접적으로 연결"되어 있는 경우뿐 아니라, 그 중간에 다른 부재를 사이에 두고 "간접적으로 연결"되어 있는 경우도 포함한다. 또한 어떤 부분이 어떤 구성요소를 "포함"한다고 할 때, 이는 특별히 반대되는 기재가 없는 한 다른 구성요소를 제외하는 것이 아니라 다른 구성요소를 더 구비할 수 있다는 것을 의미한다.On the other hand, in the entire specification, when a part is "connected" with another part, it is not only "directly connected" but also "indirectly connected" with another member in between. Includes. Also, when a part “includes” a certain component, this means that other components may be further provided instead of excluding other components, unless otherwise stated.

본 발명은 같은 형상의 소스코드로 시작했지만 서로 다른 방향으로 수정되어 온 소스코드를 비교하는 경우, 그 소스코드 파일에서 함수 단위로 구분 및 분석하여 변경점을 확인하고, 어떤 함수가 변경되었는지, 어느 기능에 대한 것인지를 바로 확인할 수 있도록 하기 위한 것이다.When the present invention starts with the same shape of source code, but compares the source codes that have been modified in different directions, the source code file is divided and analyzed in units of functions to identify changes, which functions are changed, and which functions It is to be able to immediately check whether it is for the.

이하에서는 본 발명의 실시예에 따른 소프트웨어 재사용을 위한 소스코드 비교 방법에 대해 첨부된 도면을 참고하여 구체적으로 설명하기로 한다.Hereinafter, a method of comparing source codes for software reuse according to an embodiment of the present invention will be described in detail with reference to the accompanying drawings.

도 1은 본 발명에 따른 소스코드 비교 방법을 개략적으로 나타내는 순서도이다.1 is a flowchart schematically showing a method for comparing source codes according to the present invention.

먼저, 사용자는 두 개의 소스코드 파일을 비교하기 위해서 두 개의 파일을 각각 제1 파일 및 제2 파일로써 입력하여 소스코드를 비교하게 된다.First, in order to compare two source code files, a user inputs two files as a first file and a second file, respectively, and compares the source code.

입력된 제1 파일 및 제2 파일에 포함된 소스코드에서 정규표현식을 이용하여 함수단위로 구분한다(S101). The source codes included in the input first file and the second file are divided into function units using regular expressions (S101).

그 결과는 함수의 이름과 내용으로 이루어진 세트 형식으로 표현될 수 있으며, 각 파일에 대한 모든 세트는 사용자가 확인할 수 있도록 그 목록이 리스트로써 각각 표시될 수 있다.The result can be expressed in the form of a set consisting of the name and contents of the function, and the list of each set for each file can be displayed as a list for the user to check.

이후, 리스트에 포함된 각 세트의 내용 부분에 SHA2 해쉬 알고리즘을 수행하여 각 내용 부분의 길이 값을 변경한다(S103). Thereafter, the SHA2 hash algorithm is performed on the content portion of each set included in the list to change the length value of each content portion (S103).

비록, 리스트에서 동일한 이름을 갖는 함수의 내용을 비교하여, 일치 또는 불일치 여부를 확인할 수 있기는 하지만, 그 내용의 크기는 무한정으로 커질 수 있기 때문에 SHA2 해쉬 알고리즘을 이용하여 내용 부분의 실제 길이 값에 관계없이 미리 정해진 길이의 값으로 길이 값을 변경하는 것이다.Although it is possible to check whether there is a match or mismatch by comparing the contents of a function with the same name in the list, the size of the contents can be increased indefinitely, so the SHA2 hash algorithm is used to determine the actual length of the contents part. Regardless, the length value is changed to a predetermined length value.

마지막으로, 제1 파일에 대한 리스트 및 제2 파일에 대한 리스트 중 동일한 이름을 갖는 세트끼리 비교하게 되는데, 이때 세트에서 길이 값이 변경된 내용을 상호 비교하여 그 비교 결과를 도출한다(S105).Lastly, a set having the same name among the lists for the first file and the list for the second file is compared. At this time, the contents of which the length value is changed in the set are compared with each other to derive the comparison result (S105).

이로써, 사용자는 제1 파일 및 제2 파일 간 변경점이 있는지 여부는 물론, 어떤 함수가 변경되었는지, 어떤 기능이 변경되었는지 여부를 신속하게 확인할 수 있다.Accordingly, the user can quickly check whether there is a change point between the first file and the second file, as well as which function has been changed and which function has been changed.

한편, 비교하고자 하는 두 파일에 대한 각각의 세트 리스트에서 세트의 이름이 서로 동일하다 하더라도 그 함수의 기능이 상이할 수도 있고, 또는 세트의 이름이 서로 상이하다 하더라도 그 함수의 기능이 유사할 수 있기 때문에, 각 세트의 내용에 포함에 문자열을 기반으로 기능의 유사 정도를 별도로 판단함으로써 두 파일에서 유사한 기능을 수행하도록 하는 세트 간의 비교가 이뤄지도록 할 수 있다. 즉, 함수의 이름 뿐만 아니라 실제적인 기능까지 고려하여 변경점이 있는 지 여부를 확인할 수 있도록 함으로써 두 파일에 대한 보다 정확한 비교가 가능하다.On the other hand, the function of the function may be different even if the name of the set is the same in each set list for the two files to be compared, or the function of the function may be similar even if the name of the set is different from each other. Therefore, by separately determining the similarity of functions based on the string in the inclusion of the contents of each set, a comparison can be made between sets that perform similar functions in two files. In other words, it is possible to compare the two files more accurately by making it possible to check whether there are any changes by considering not only the function name but also the actual function.

도 2는 본 발명에 따른 정규표현식을 이용하여 함수 이름을 체크하는 일 예를 나타내는 도면이다.2 is a diagram illustrating an example of checking a function name using a regular expression according to the present invention.

도 2를 참조하면, 소스코드를 구성하는 각 함수는 이름 부분을 시작점으로 하여 정해진 규칙에 따라 정해진 기능을 수행하도록 하는 문자열이 조합으로 구성된다.Referring to FIG. 2, each function constituting the source code is composed of a combination of strings that perform a predetermined function according to a predetermined rule using a name portion as a starting point.

앞서 설명한 S101단계에서와 같이, 정규표현식을 이용하여 함수의 이름 부분인 함수의 시작점을 찾아내고, 함수의 시작점을 찾아낸 후에 끝지점이 나올 때까지 라인단위로 잘라내서 그 내용을 저장한다. 이렇게 소스코드 파일의 처음부터 끝까지 분석이 끝나면 함수와 내용으로 이루어진 복수개의 세트들이 리스트로 생성되는 것이다As in the step S101 described above, using the regular expression, the starting point of the function, which is the name part of the function, is found, and after finding the starting point of the function, it is cut in line units until the end point is found and stored. When analysis is finished from the beginning to the end of the source code file, multiple sets of functions and contents are created as a list.

도 3은 본 발명의 일 실시예에 따른 소스코드 비교 시스템의 구성을 나타내는 블록도이다.3 is a block diagram showing the configuration of a source code comparison system according to an embodiment of the present invention.

도 3을 참조하면, 소스코드를 비교하기 위한 소스코드 비교 시스템은 생성부(310), 변경부(330) 및 비교부(350)을 포함한다.Referring to FIG. 3, a source code comparison system for comparing source codes includes a generation unit 310, a change unit 330, and a comparison unit 350.

생성부(310)는 비교하고자 하는 파일로써 제1 파일 및 제2 파일이 입력되면, 제1 파일 및 제2 파일에 대한 세트 리스트를 각각 생성한다. 이때, 세트 리스트는 함수의 이름 및 내용으로 구성된 세트의 목록을 리스트로써 나타낸 것이다.When the first file and the second file are input as the files to be compared, the generation unit 310 generates a set list for the first file and the second file, respectively. At this time, the set list is a list showing a list of sets consisting of the function name and contents.

구체적으로 생성부(310)는 함수 검출부(311) 및 함수 분석부(313)를 더 포함하며, 함수 검출부(311)는 제1 파일 및 제2 파일에 포함된 소스코드에서 정규표현식을 이용하여 함수단위로 구분한다. 즉, 제1 파일 및 제2 파일에 포함된 소스코드에서 함수의 시작점과 끝지점을 찾아냄으로써 함수를 검출하는 것이다.Specifically, the generation unit 310 further includes a function detection unit 311 and a function analysis unit 313, and the function detection unit 311 functions by using regular expressions in source codes included in the first file and the second file. It is divided into units. That is, the function is detected by finding the start and end points of the function in the source code included in the first file and the second file.

이후, 함수 분석부(313)가 제1 파일 및 제2 파일 각각에 대한 처음부터 끝까지 검출된 함수들을 라인단위로 분석하여 각 함수의 이름과 내용으로 이루어진 세트의 목록을 리스트로써 생성한다.Thereafter, the function analysis unit 313 analyzes the functions detected from the beginning to the end for each of the first file and the second file in line units to generate a list of sets consisting of the names and contents of each function as a list.

변경부(330)는 제1 파일 및 제2 파일 각각에 대해 생성된 리스트에서 각 세트를 구성하는 내용 부분의 길이를 미리 설정된 길이값으로 변경하고, 각 세트가 변경된 길이값을 갖는 내용을 포함하도록 하여 리스트를 갱신한다. 이때, 변경부(330)는 SHA2 해쉬 알고리즘을 수행함으로써 내용 부분의 길이 값을 변경할 수 있다.The change unit 330 changes the length of the content parts constituting each set from the list generated for each of the first file and the second file to a preset length value, and to include the content of each set having the changed length value. To update the list. At this time, the change unit 330 may change the length value of the content part by performing the SHA2 hash algorithm.

비교부(350)는 제1 파일 및 제2 파일에 대해 갱신된 리스트에서 동일한 이름 또는 기능을 갖는 세트끼리 상호 비교하고, 그 비교 결과를 도출한다. 즉, 변경점 정보를 생성한다.The comparator 350 compares sets with the same name or function in the updated list for the first file and the second file, and derives the result of the comparison. That is, change point information is generated.

비교부(350)는 판단부(351)를 포함하며, 동일한 이름 또는 기능을 갖는 세트끼리 상호 비교한 결과, 이름 또는 기능의 일치 여부를 판단한다. 이때, 판단부(351)는 일치 또는 불일치 여부 뿐만 아니라, 비교 대상이 없는 독립적인 함수들까지도 판단할 수 있다.The comparison unit 350 includes a determination unit 351, and as a result of comparing the sets having the same name or function with each other, determines whether the names or functions match. At this time, the determination unit 351 can determine not only whether the match or disagreement, but also independent functions without comparison targets.

도 4는 본 발명의 일 실시예에 따른 소스코드 비교 방법을 구체적으로 나타내는 순서도이다.4 is a flowchart specifically showing a method of comparing source codes according to an embodiment of the present invention.

먼저, 생성부(310)는 제1 파일 및 제2 파일이 입력되면(S401), 제1 파일 및 제2 파일에 포함된 소스코드에서 정규표현식을 이용하여 함수단위로 구분한다(S403).First, when the first file and the second file are input (S401 ), the generation unit 310 classifies them into function units using regular expressions in source codes included in the first and second files (S403 ).

이후, 생생부(310)는 제1 파일 및 제2 파일 각각에 대해 각 함수의 이름과 내용으로 이루어진 세트의 목록을 리스트로써 생성한다(S405).Thereafter, the vivid unit 310 generates a list of a set of names and contents of each function as a list for each of the first file and the second file (S405).

변경부(330)는 제1 파일 및 제2 파일 각각에 대해 생성된 리스트에서 각 세트를 구성하는 내용 부분의 길이를 미리 설정된 길이값으로 변경하고(S407), 각 세트가 변경된 길이값을 갖는 내용을 포함하도록 하여 리스트를 갱신한다(S409). 여기서, 각 세트를 구성하는 내용 부분의 길이를 미리 설정된 길이값으로 변경하기 위해서 SHA2 해쉬 알고리즘을 이용할 수 있다.The change unit 330 changes the length of the content portion constituting each set from the list generated for each of the first file and the second file to a preset length value (S407), and the content of each set having a changed length value The list is updated to include (S409). Here, the SHA2 hash algorithm can be used to change the length of the content part constituting each set to a preset length value.

이후, 비교부(350)는 제1 파일 및 제2 파일에 대해 갱신된 리스트에서 동일한 이름 또는 기능을 갖는 세트끼리 서로 내용 부분을 비교하고(S411), 그 비교 결과 즉, 변경점 정보를 생성한다(413).Subsequently, the comparison unit 350 compares the content portions with each other having the same name or function in the updated list for the first file and the second file (S411), and generates comparison results, that is, change point information ( 413).

도 5는 본 발명의 일 실시예에 따른 소스코드 비교 결과가 표시된 사용자 인터페이스의 일 예를 나타내는 도면으로써, 앞서 설명한 본 발명의 일 실시예에 따른 소스코드 비교 방법을 통해 도출된 비교 결과를 표시한 일 예이다.FIG. 5 is a diagram showing an example of a user interface in which source code comparison results are displayed according to an embodiment of the present invention, and displaying comparison results derived through a source code comparison method according to an embodiment of the present invention described above It is an example.

도 5를 참조하면, 사용자 인터페이스는 파일 입력창(510), 변경정보 표시창(530) 및 독립 함수 표시창(550)으로 구성되어 소스코드 비교 결과가 표시된다.Referring to FIG. 5, the user interface is composed of a file input window 510, a change information display window 530, and an independent function display window 550 to display source code comparison results.

먼저, 파일 입력창(510)은 비교하고자 하는 두 개의 파일인 제1 파일(Base) 및 제2 파일(New)을 사용자가 선택하여 입력할 수 있도록 구성된다.First, the file input window 510 is configured to allow a user to select and input two files to be compared, a first file (Base) and a second file (New).

변경정보 표시창(530)은 제1 파일 및 제2 파일의 각 세트 리스트가 표시되도록 구성되는데, 이때, 함수에 대한 다양한 정보가 함께 표시됨은 물론 제1 파일 및 제2 파일의 각 세트를 구성하는 내용 부분의 변경된 길이값에 대한 정보가 표시될 수 있는 길이값 정보 표시창(531a, 531b)이 각각 더 구성될 수 있다. 또한, 함수의 이름이 동일한 세트들의 내용을 비교한 결과에 따라 일치 또는 불일치 여부가 표시될 수 있는 비교 결과 표시창(533)이 더 구성될 수 있다.The change information display window 530 is configured to display a list of each set of the first file and the second file. At this time, various pieces of information on the function are displayed together, and the contents constituting each set of the first file and the second file The length value information display windows 531a and 531b in which information on the changed length value of the part may be displayed may be further configured, respectively. In addition, a comparison result display window 533 may be further configured to display whether a match or disagreement is displayed according to a result of comparing the contents of sets having the same function name.

한편, 도 5에는 도시되지 않았지만, 사용자는 세트 리스트에서 세트를 선택하여 각 세트에 대한 구체적인 정보는 물론, 변경점 정보를 확인할 수 있다.Meanwhile, although not shown in FIG. 5, the user can select a set from a set list and check detailed information as well as change point information for each set.

독립 함수 표시창(550)는 비교 대상이 없는 함수들이 표시되며, 즉, 제1 파일 및 제2 파일에 독립적으로 존재하는 함수들의 리스트가 각각 표시된다.In the independent function display window 550, functions without comparison are displayed, that is, a list of functions independently existing in the first file and the second file is respectively displayed.

따라서, 본 발명은 비교하고자 하는 파일의 소스코드에서 함수단위로 구분하여 사용자가 변경된 함수에 대한 정보를 빠르게 확인할 수 있도록 한다.Accordingly, the present invention is divided into function units in the source code of the file to be compared, so that the user can quickly check information about the changed function.

본 명세서와 도면에는 본 발명의 바람직한 실시예에 대하여 개시하였으며, 비록 특정 용어들이 사용되었으나, 이는 단지 본 발명의 기술 내용을 쉽게 설명하고 발명의 이해를 돕기 위한 일반적인 의미에서 사용된 것이지, 본 발명의 범위를 한정하고자 하는 것은 아니다. 여기에 개시된 실시예 외에도 본 발명의 기술적 사상에 바탕을 둔 다른 변형예들이 실시 가능하다는 것은 본 발명이 속하는 기술 분야에서 통상의 지식을 가진 자에게 자명한 것이다.In the present specification and drawings, preferred embodiments of the present invention have been disclosed, and although specific terms are used, they are merely used in a general sense to easily describe the technical contents of the present invention and to understand the present invention. It is not intended to limit the scope. It is apparent to those skilled in the art to which the present invention pertains that other modifications based on the technical spirit of the present invention can be implemented in addition to the embodiments disclosed herein.

300: 소스코드 비교 시스템 310: 생성부
311: 함수 검출부 313: 함수 분석부
330: 변경부 350: 비교부
351: 분리부 500: 사용자 인터페이스
510: 파일 입력창 530: 변경정보 표시창
531a: 길이값 정보 표시창 531b: 길이값 정보 표시창
533: 550: 독립 함수 표시창
300: source code comparison system 310: generation unit
311: function detection unit 313: function analysis unit
330: change section 350: comparison section
351: separation 500: user interface
510: File input window 530: Change information display window
531a: Length value information display window 531b: Length value information display window
533: 550: Independent function display

Claims (12)

소프트웨어 재사용을 위한 소스코드 비교 시스템에 있어서,
제1 파일 및 제2 파일을 입력받는 생성부;
상기 생성부에서 입력받은 제1 파일 및 제2 파일에 포함된 소스코드를 각각 함수단위로 구분하여 변경 여부를 확인하는 변경부를 포함하도록 구성되는 것을 특징으로 하는 소프트웨어 재사용을 위한 소스코드 비교 시스템.
In the source code comparison system for software reuse,
A generation unit that receives the first file and the second file;
A source code comparison system for software reuse, characterized in that the source code included in the first file and the second file input from the generation unit is configured to include a change unit to determine whether or not to change them by dividing them into function units.
제1항에 있어서,
상기 제1 파일 및 제2 파일에 포함된 소스코드는,
정규표현식을 기반으로 각각 함수단위로 구분되는 것을 특징으로 하는 소프트웨어 재사용을 위한 소스코드 비교 시스템.
According to claim 1,
Source code included in the first file and the second file,
Source code comparison system for software reuse, characterized by being divided into functional units based on regular expressions.
제1항에 있어서, 상기 비교부는,
상기 확인 결과, 변경이 발생한 함수를 리스트로 관리하는 것을 특징으로 하는 소프트웨어 재사용을 위한 소스코드 비교 시스템.
The method of claim 1, wherein the comparison unit,
As a result of the check, the source code comparison system for software reuse, characterized in that a function that manages a change is managed as a list.
소프트웨어 재사용을 위한 소스코드 비교 시스템에 있어서,
제1 파일 및 제2 파일에 포함된 소스코드를 함수단위로 구분하여 함수를 검출하는 생성부;
상기 검출된 함수에서 동일한 이름을 갖는 함수의 내용을 비교하여 변경여부를 판단하는 비교부를 포함하는 것을 특징으로 하는 소프트웨어 재사용을 위한 소스코드 비교 시스템.
In the source code comparison system for software reuse,
A generator configured to detect functions by dividing source codes included in the first file and the second file into function units;
Source code comparison system for software reuse, characterized in that it comprises a comparison unit for determining whether to change by comparing the contents of the function having the same name in the detected function.
제4항에 있어서,
상기 제1 파일 및 제2 파일에 포함된 소스코드는,
정규표현식을 기반으로 각각 함수단위로 구분되는 것을 특징으로 하는 소프트웨어 재사용을 위한 소스코드 비교 시스템.
According to claim 4,
Source code included in the first file and the second file,
Source code comparison system for software reuse, characterized by being divided into functional units based on regular expressions.
제4항에 있어서, 상기 비교부는,
상기 확인 결과, 변경이 발생한 함수를 리스트로 관리하는 것을 특징으로 하는 소프트웨어 재사용을 위한 소스코드 비교 시스템.
The method of claim 4, wherein the comparison unit,
As a result of the check, the source code comparison system for software reuse, characterized in that a function that manages a change is managed as a list.
소프트웨어 재사용을 위한 소스코드 비교 시스템에 있어서,
제1 파일 및 제2 파일에 포함된 소스코드를 함수단위로 구분하여 함수를 검출하는 함수 검출부;
상기 검출된 적어도 하나 이상의 함수를 함수의 이름과 내용을 포함하는 세트의 형태로 하여 리스트로 각각 생성하는 함수 분석부; 및
상기 생성된 리스트에서 동일한 이름을 갖는 함수의 내용을 비교하여 변경 여부를 판단하는 비교부를 포함하는 것을 특징으로 하는 소프트웨어 재사용을 위한 소스코드 비교 시스템.
In the source code comparison system for software reuse,
A function detection unit for detecting functions by dividing source codes included in the first file and the second file into function units;
A function analysis unit generating each of the detected at least one function as a list in the form of a set including the name and content of the function; And
Source code comparison system for software reuse, characterized in that it comprises a comparison unit for determining whether to change by comparing the contents of the function having the same name in the generated list.
제7항에 있어서,
상기 제1 파일 및 제2 파일에 포함된 소스코드는,
정규표현식을 기반으로 각각 함수단위로 구분되는 것을 특징으로 하는 소프트웨어 재사용을 위한 소스코드 비교 시스템.
The method of claim 7,
Source code included in the first file and the second file,
Source code comparison system for software reuse, characterized by being divided into functional units based on regular expressions.
제7항에 있어서,
상기 내용은,
SHA2 해쉬 알고리즘을 이용하여 길이 값이 미리 정해진 길이값으로 변경되는 것을 특징으로 하는 소프트웨어 재사용을 위한 소스코드 비교 시스템.
The method of claim 7,
The above is,
Source code comparison system for software reuse, characterized in that the length value is changed to a predetermined length value using a SHA2 hash algorithm.
소프트웨어 재사용을 위한 소스코드 비교 시스템에 있어서,
제1 파일 및 제2 파일에 포함된 소스코드를 함수단위로 구분하여 함수를 검출하는 함수 검출부;
상기 검출된 적어도 하나 이상의 함수를 함수의 이름과 내용을 포함하는 세트의 형태로 하여 리스트로 각각 생성하는 함수 분석부;
상기 내용의 길이값을 미리 설정된 길이값으로 변경하여 상기 각각 생성된 리스트를 갱신하는 변경부;
상기 갱신된 리스트에서 동일한 이름을 갖는 함수의 내용을 비교하여 변경 여부를 판단하는 비교부를 포함하는 것을 특징으로 하는 소프트웨어 재사용을 위한 소스코드 비교 시스템.
In the source code comparison system for software reuse,
A function detection unit for detecting functions by dividing source codes included in the first file and the second file into function units;
A function analysis unit generating each of the detected at least one function as a list in the form of a set including the name and content of the function;
A change unit that changes the length value of the content to a preset length value and updates the generated list;
Source code comparison system for software reuse, characterized in that it comprises a comparison unit for determining whether to change by comparing the contents of the function having the same name in the updated list.
제10항에 있어서,
상기 제1 파일 및 제2 파일에 포함된 소스코드는,
정규표현식을 기반으로 각각 함수단위로 구분되는 것을 특징으로 하는 소프트웨어 재사용을 위한 소스코드 비교 시스템.
The method of claim 10,
Source code included in the first file and the second file,
Source code comparison system for software reuse, characterized by being divided into functional units based on regular expressions.
제10항에 있어서,
SHA2 해쉬 알고리즘을 이용하여 길이 값이 미리 정해진 길이값으로 변경되는 것을 특징으로 하는 소프트웨어 재사용을 위한 소스코드 비교 시스템.
The method of claim 10,
Source code comparison system for software reuse, characterized in that the length value is changed to a predetermined length value using a SHA2 hash algorithm.
KR1020180160606A 2018-12-13 2018-12-13 System for comparing source code for software reuse KR102160544B1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
KR1020180160606A KR102160544B1 (en) 2018-12-13 2018-12-13 System for comparing source code for software reuse

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
KR1020180160606A KR102160544B1 (en) 2018-12-13 2018-12-13 System for comparing source code for software reuse

Publications (2)

Publication Number Publication Date
KR20200072711A true KR20200072711A (en) 2020-06-23
KR102160544B1 KR102160544B1 (en) 2020-09-28

Family

ID=71138277

Family Applications (1)

Application Number Title Priority Date Filing Date
KR1020180160606A KR102160544B1 (en) 2018-12-13 2018-12-13 System for comparing source code for software reuse

Country Status (1)

Country Link
KR (1) KR102160544B1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112465599A (en) * 2020-12-04 2021-03-09 车智互联(北京)科技有限公司 Order processing method, order processing system and computing equipment

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR102476358B1 (en) 2021-01-26 2022-12-08 고려대학교 산학협력단 Method for identifying open-source software components at the source-code level

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101780233B1 (en) * 2016-04-26 2017-09-21 고려대학교 산학협력단 Apparatus and method for deteting code cloning of software

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101780233B1 (en) * 2016-04-26 2017-09-21 고려대학교 산학협력단 Apparatus and method for deteting code cloning of software

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
Fabio Calefato et al, "Function Clone Detection in Web Applications: A Semiautomated Approach", Journal of Web Engineering, Vol. 3, No.1(2004.05.)* *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112465599A (en) * 2020-12-04 2021-03-09 车智互联(北京)科技有限公司 Order processing method, order processing system and computing equipment
CN112465599B (en) * 2020-12-04 2023-11-07 车智互联(北京)科技有限公司 Order processing method, order processing system and computing equipment

Also Published As

Publication number Publication date
KR102160544B1 (en) 2020-09-28

Similar Documents

Publication Publication Date Title
US10169036B2 (en) Synchronizing comments in source code with text documents
US10216727B2 (en) Visually differentiating strings for testing
US10929004B2 (en) Diagrams for structured data
CN106708799B (en) Text error correction method and device and terminal
KR102044046B1 (en) Telemetry file hash and conflict detection
US11481440B2 (en) System and method for processing metadata to determine an object sequence
KR20140001951A (en) Intelligent code differencing using code clone detection
KR102160544B1 (en) System for comparing source code for software reuse
KR101588027B1 (en) Method and apparatus for generating test case to support localization of software
US20210149857A1 (en) Data pipeline branching
US9336228B2 (en) Synchronization of program code between revision management applications utilizing different version-control architectures
US20190235846A1 (en) Continuous delivery pipeline segment models
KR102104322B1 (en) Method for comparing source code for software reuse
Yoshida et al. Proactive clone recommendation system for extract method refactoring
CN104346035A (en) Indicating automatically corrected words
CN112308727A (en) Insurance claim settlement service processing method and device
US20170308391A1 (en) Information processing apparatus, information processing method, and recording medium
WO2017201475A1 (en) Systems and methods for non-disruptive continuous software delivery
Kirinuki et al. Splitting commits via past code changes
CN104484156B (en) The edit methods of multilingual formula, editing system and multilingual formula editors
WO2015139646A1 (en) Data processing method and apparatus for unrealscript
CN111158842A (en) Operation flow detection method, device and storage medium
US11741055B2 (en) Managing file revisions from multiple reviewers
US11567758B2 (en) Configuration properties management for software
KR102046925B1 (en) System and method of patent infringement judgment

Legal Events

Date Code Title Description
E701 Decision to grant or registration of patent right
GRNT Written decision to grant