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

System for comparing source code for software reuse Download PDF

Info

Publication number
KR102160544B1
KR102160544B1 KR1020180160606A KR20180160606A KR102160544B1 KR 102160544 B1 KR102160544 B1 KR 102160544B1 KR 1020180160606 A KR1020180160606 A KR 1020180160606A KR 20180160606 A KR20180160606 A KR 20180160606A KR 102160544 B1 KR102160544 B1 KR 102160544B1
Authority
KR
South Korea
Prior art keywords
file
function
list
source code
delete delete
Prior art date
Application number
KR1020180160606A
Other languages
Korean (ko)
Other versions
KR20200072711A (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

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

본 발명은 소프트웨어 재사용을 위한 소스코드 비교 시스템에 관한 것으로, 더욱 상세하게는 제1 파일 및 제2 파일에 포함된 소스코드를 각각 함수단위로 구분하여 변경 여부를 확인한다.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 to change.

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 software reuse, and more particularly, to a source code comparison system for software reuse that divides the source code of a file to be compared into function units and compares them with each other.

소프트웨어의 재사용이란, 기존의 소프트웨어에서 표준화된 공통부분과 잘 알려진 프로세스를 이용하여, 품질 및 생산성을 향상시키며 새로운 소프트웨어의 생산하는 것을 말한다. 소프트웨어의 재사용을 위해 가장 중요한 것은 기존의 소프트웨어를 구성하는 소스코드의 이해이다.Reuse of software refers to the production of new software while improving quality and productivity by using standardized common parts and well-known processes in existing software. The most important thing for reusing software is understanding 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 software undergoes frequent modifications after the initial development. In addition, in the case of open source developed by collaboration of various people, in most cases, design documents cannot be expected and source codes must be understood based on simple function introduction documents.

기능소개문서는 존재하나 설계문서가 존재하지 않는 소프트웨어를 재사용하려고 하는 경우, 전체 소스코드 분석을 통해 소프트웨어를 이해하는 것은 비용과 시간이 많이 소요된다는 문제점이 있다. When trying to reuse software that has a function introduction document but does not have a design document, there is a problem that it takes a lot of cost and time to understand the software through analysis of the entire source code.

한편, 소프트웨어 재상용을 위해 두 개의 파일을 비교해야 하는 경우, 파일 비교 프로그램을 이용하여 두 개의 파일에 대한 전체적인 차이를 비교한다. 이때, 비교는 라인단위로 이루어진다. 그 결과로 두 개의 파일을 모두 보여주면서 차이가 발생하는 라인이 어디인지에 대한 표시를 해준다. 사용자는 이를 통해 차이가 발생하는 부분이 어디인지를 알 수 있다.On the other hand, when two files need to be compared for software reuse, the overall difference between the two files is compared using a file comparison program. At this time, the comparison is made in units of lines. As a result, it displays both files and indicates where the difference occurs. This allows the user to 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, when different changes occur in different businesses, the shape will naturally change over time. In this case, the change point can be seen by comparing the source code using the existing file comparison program described above. However, it is only possible to know which line has been changed, but it is not possible to determine which function has changed or which function has changed. Therefore, there is a problem in that a user using this method has to spend a lot of time in order to check which function has been changed and which function has been changed, since he has to search before and after the changed line.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

그리고 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 a source code of the same shape is started for software reuse, but source codes that have been modified in different directions must be compared, the user can immediately check information on the changed function.

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

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

도 1은 본 발명에 따른 소스코드 비교 방법을 개략적으로 나타내는 순서도이다.
도 2는 본 발명에 따른 정규표현식을 이용하여 함수 이름을 체크하는 일 예를 나타내는 도면이다.
도 3은 본 발명의 일 실시예에 따른 소스코드 비교 시스템의 구성을 나타내는 블록도이다.
도 4는 본 발명의 일 실시예에 따른 소스코드 비교 방법을 구체적으로 나타내는 순서도이다.
도 5는 본 발명의 일 실시예에 따른 소스코드 비교 결과가 표시된 사용자 인터페이스의 일 예를 나타내는 도면이다.
1 is a flow chart schematically showing a source code comparison method according to the present invention.
2 is a diagram showing 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 flow chart specifically showing a method for comparing source codes according to an embodiment of the present invention.
5 is a diagram illustrating an example of a user interface displaying a result of comparing a source code according to an embodiment of the present invention.

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

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

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

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

이하에서는 본 발명의 실시예에 따른 소프트웨어 재사용을 위한 소스코드 비교 방법에 대해 첨부된 도면을 참고하여 구체적으로 설명하기로 한다.Hereinafter, a source code comparison method 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 flow chart schematically showing a source code comparison method according to the present invention.

먼저, 사용자는 두 개의 소스코드 파일을 비교하기 위해서 두 개의 파일을 각각 제1 파일 및 제2 파일로써 입력하여 소스코드를 비교하게 된다.First, in order to compare the two source code files, the 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 classified into function units using a regular expression (S101).

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

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

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

마지막으로, 제1 파일에 대한 리스트 및 제2 파일에 대한 리스트 중 동일한 이름을 갖는 세트끼리 비교하게 되는데, 이때 세트에서 길이 값이 변경된 내용을 상호 비교하여 그 비교 결과를 도출한다(S105).Finally, among the list for the first file and the list for the second file, sets having the same name are compared. At this time, the contents whose length values are changed are compared to 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, even if the names of the sets in each set list for the two files to be compared are the same, the functions of the functions may be different, or even if the names of the sets are different, the functions of the functions may be similar. Therefore, by separately determining the degree of similarity of functions based on a character string in the contents of each set, a comparison between sets for performing similar functions in two files can be made. In other words, by considering not only the name of the function but also the actual function, it is possible to check whether there are any changes, so that a more accurate comparison of the two files is possible.

도 2는 본 발명에 따른 정규표현식을 이용하여 함수 이름을 체크하는 일 예를 나타내는 도면이다.2 is a diagram showing 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 character strings that perform a predetermined function according to a predetermined rule with a name portion as a starting point.

앞서 설명한 S101단계에서와 같이, 정규표현식을 이용하여 함수의 이름 부분인 함수의 시작점을 찾아내고, 함수의 시작점을 찾아낸 후에 끝지점이 나올 때까지 라인단위로 잘라내서 그 내용을 저장한다. 이렇게 소스코드 파일의 처음부터 끝까지 분석이 끝나면 함수와 내용으로 이루어진 복수개의 세트들이 리스트로 생성되는 것이다As in step S101 described above, the start point of the function, which is the name part of the function, is found using a regular expression, and after finding the start point of the function, it is cut by line until the end point is reached, and the contents are stored. When the analysis from the beginning to the end of the source code file is completed, a plurality of 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 a file to be compared, the generation unit 310 generates a set list of the first file and the second file, respectively. In this case, the set list represents a list of sets consisting of the names and contents of functions as a list.

구체적으로 생성부(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 uses a regular expression in the source code included in the first file and the second file. Separate by unit. That is, the function is detected by finding the starting point and the ending point 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 of each of the first file and the second file in line units, and generates 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 part constituting each set in the list generated for each of the first file and the second file to a preset length value, and allows each set to include content having the changed length value. To update the list. In this case, the change unit 330 may change the length value of the content part by performing the SHA2 hash algorithm.

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

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

도 4는 본 발명의 일 실시예에 따른 소스코드 비교 방법을 구체적으로 나타내는 순서도이다.4 is a flow chart 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 inputted (S401), the generation unit 310 classifies the source code included in the first file and the second file into a function unit using a regular expression (S403).

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

변경부(330)는 제1 파일 및 제2 파일 각각에 대해 생성된 리스트에서 각 세트를 구성하는 내용 부분의 길이를 미리 설정된 길이값으로 변경하고(S407), 각 세트가 변경된 길이값을 갖는 내용을 포함하도록 하여 리스트를 갱신한다(S409). 여기서, 각 세트를 구성하는 내용 부분의 길이를 미리 설정된 길이값으로 변경하기 위해서 SHA2 해쉬 알고리즘을 이용할 수 있다.The change unit 330 changes the length of the content part constituting each set in the list generated for each of the first file and the second file to a preset length value (S407), and each set has 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).Thereafter, the comparison unit 350 compares the contents of the sets having the same name or function in the updated list for the first file and the second file (S411), and generates the comparison result, that is, change point information ( 413).

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

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

먼저, 파일 입력창(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, and at this time, various information on the function is displayed together, as well as contents constituting each set of the first file and the second file. Each of the length value information display windows 531a and 531b in which information on the changed length value of the portion may be displayed may be further configured. In addition, a comparison result display window 533 may be further configured to display whether the function matches or does not match according to a result of comparing contents of sets having the same name.

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

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

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

본 명세서와 도면에는 본 발명의 바람직한 실시예에 대하여 개시하였으며, 비록 특정 용어들이 사용되었으나, 이는 단지 본 발명의 기술 내용을 쉽게 설명하고 발명의 이해를 돕기 위한 일반적인 의미에서 사용된 것이지, 본 발명의 범위를 한정하고자 하는 것은 아니다. 여기에 개시된 실시예 외에도 본 발명의 기술적 사상에 바탕을 둔 다른 변형예들이 실시 가능하다는 것은 본 발명이 속하는 기술 분야에서 통상의 지식을 가진 자에게 자명한 것이다.In the present specification and drawings, a preferred embodiment of the present invention has been disclosed, and although specific terms are used, these are merely used in a general meaning to easily explain the technical content of the present invention and to aid understanding of the present invention. It is not intended to limit the scope. It is obvious to those of ordinary skill in the art that other modifications based on the technical idea 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: generator
311: function detection unit 313: function analysis unit
330: change unit 350: comparison unit
351: separation unit 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 파일에 대한 세트 리스트를 각각 생성하되, 제1 파일 및 제2파일에 포함된 소스코드에서 정규표현식을 이용하여 함수단위로 함수의 시작점과 끝지점을 찾아 함수를 검출하는 함수 검출부, 및 제1 파일 및 제2 파일 각각에 대한 처음부터 끝까지 검출된 함수들을 라인단위로 분석하여 각 함수의 이름과 내용으로 이루어진 세트의 목록을 리스트로써 생성하는 함수 분석부를 포함하는 생성부;
제1 파일 및 제2 파일 각각에 대해 생성된 세트 리스트에서 각 세트를 구성하는 내용 부분의 길이를 미리 설정된 길이값으로 변경하고, 각 세트가 변경된 길이값을 갖는 내용을 포함하도록 상기 세트 리스트를 갱신하는 변경부;
제1 파일 및 제2 파일 각각에 대해 갱신된 세트 리스트에서 동일한 이름을 갖는 세트끼리 내용을 비교하여 기능의 일치 여부를 판단하고, 상기 갱신된 세트 리스트에서 이름이 상이하지만 동일한 기능을 갖는 세트끼리 내용을 비교하여 기능의 일치 여부를 판단하고, 상기 판단 결과에 따라 변경점 정보를 생성하는 비교부; 및
상기 기능의 일치 여부를 포함하는 비교 결과 표시창과 상기 제1 파일 및 상기 제2 파일 중 하나에 독립적으로 존재하는 적어도 하나의 함수의 리스트를 포함하는 독립 함수 표시창과 상기 변경점 정보와 상기 각 세트를 구성하는 내용 부분의 변경된 길이값에 대한 정보를 표시하는 길이값 정보 표시창을 표시하는 표시부;를 포함도록 구성되는 것을 특징으로 하는 소프트웨어 재사용을 위한 소스코드 비교 시스템.
In the source code comparison system for software reuse,
By receiving the first file and the second file to be compared, each set list for the first file and the second file is generated, but by using a regular expression from the source code included in the first file and the second file A function detection unit that detects the function by finding the starting point and the ending point of the function in function units, and a set consisting of the names and contents of each function by analyzing the functions detected from the beginning to the end of each of the first and second files in line units A generation unit including a function analysis unit that generates a list of as a list;
In the set list created for each of the first file and the second file, the length of the content part constituting each set is changed to a preset length value, and the set list is updated so that each set includes contents having the changed length value. Changing part;
For each of the first file and the second file, the contents of the sets with the same name are compared in the updated set list to determine whether the functions match, and the contents of the sets having the same function although the names are different in the updated set list A comparison unit that compares the values to determine whether the functions match, and generates change point information according to the determination result; And
A comparison result display window including whether the functions match or not, an independent function display window including a list of at least one function independently existing in one of the first file and the second file, and the change point information and each set are configured. A source code comparison system for software reuse, comprising: a display unit that displays a length value information display window that displays information on the changed length value of the content part.
삭제delete 삭제delete 삭제delete 삭제delete 삭제delete 삭제delete 삭제delete 삭제delete 삭제delete 삭제delete 삭제delete
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 KR20200072711A (en) 2020-06-23
KR102160544B1 true 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
US11836486B2 (en) 2021-01-26 2023-12-05 Korea University Research And Business Foundation Method for identifying open-source software components at the source-code level

Families Citing this family (1)

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

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 (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11836486B2 (en) 2021-01-26 2023-12-05 Korea University Research And Business Foundation Method for identifying open-source software components at the source-code level

Also Published As

Publication number Publication date
KR20200072711A (en) 2020-06-23

Similar Documents

Publication Publication Date Title
US10929004B2 (en) Diagrams for structured data
US9372689B2 (en) Synchronizing comments in source code with text documents
US11294661B2 (en) Updating a code file
KR102160544B1 (en) System for comparing source code for software reuse
US20150277860A1 (en) System and method for code recommendation and share
KR102044046B1 (en) Telemetry file hash and conflict detection
US11100471B2 (en) Warning apparatus for preventing electronic mail wrong transmission, electronic mail transmission system, and program
CN106708799B (en) Text error correction method and device and terminal
KR101588027B1 (en) Method and apparatus for generating test case to support localization of software
US20210334292A1 (en) System and method for reconciliation of data in multiple systems using permutation matching
JP2017041171A (en) Test scenario generation support device and test scenario generation support method
US9336228B2 (en) Synchronization of program code between revision management applications utilizing different version-control architectures
CN112036153A (en) Work order error correction method and device, computer readable storage medium and computer equipment
CN104346035A (en) Indicating automatically corrected words
US8347223B2 (en) GUI evaluation system, method, and program for evaluating a text input component
KR102104322B1 (en) Method for comparing source code for software reuse
CN104484156B (en) The edit methods of multilingual formula, editing system and multilingual formula editors
CN110990294A (en) Method, device, equipment and storage medium for determining software defect detection rule
CN109508203B (en) Method, device and system for determining version consistency
US10209965B1 (en) In-line function synchronization
WO2015139646A1 (en) Data processing method and apparatus for unrealscript
JP7006769B2 (en) Search sentence utilization device and search sentence utilization method
US11741055B2 (en) Managing file revisions from multiple reviewers
EP4006743A1 (en) Information search system
JP2007219586A (en) Source code analysis device

Legal Events

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