CN103324513A - Program annotation method and device - Google Patents
Program annotation method and device Download PDFInfo
- Publication number
- CN103324513A CN103324513A CN2013102182705A CN201310218270A CN103324513A CN 103324513 A CN103324513 A CN 103324513A CN 2013102182705 A CN2013102182705 A CN 2013102182705A CN 201310218270 A CN201310218270 A CN 201310218270A CN 103324513 A CN103324513 A CN 103324513A
- Authority
- CN
- China
- Prior art keywords
- file
- program code
- multimedia
- code
- program
- Prior art date
- Legal status (The legal status 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 status listed.)
- Granted
Links
Images
Landscapes
- User Interface Of Digital Computer (AREA)
Abstract
Description
技术领域technical field
本发明涉及计算机领域,尤其涉及一种程序注释方法和装置。The invention relates to the field of computers, in particular to a method and device for program annotation.
背景技术Background technique
现有技术中,为了便于程序维护人员理解程序代码并对其进行维护,程序员在编写程序代码的过程中,采用文字注释方法对程序代码进行注释,但这种注释方法常常过于简略,程序维护人员难以理解,或者过于繁多,程序维护人员需要耗费大量的时间去阅读,从而降低了程序维护人员的维护效率。In the prior art, in order to make it easier for program maintenance personnel to understand the program code and maintain it, programmers use text annotations to annotate the program code during the process of writing the program code, but this annotation method is often too simple, and the program maintenance It is difficult for personnel to understand, or there are too many, program maintainers need to spend a lot of time to read, thus reducing the maintenance efficiency of program maintainers.
发明内容Contents of the invention
本发明提供一种程序注释方法和装置,用于解决现有技术中对程序代码进行文字注释,难以提高程序维护人员的维护效率的问题。The present invention provides a program annotation method and device, which are used to solve the problem in the prior art that it is difficult to improve the maintenance efficiency of program maintenance personnel by text annotation of program codes.
本发明的第一个方面是提供一种程序注释方法,包括:The first aspect of the present invention provides a method for program annotation, including:
获取与程序代码对应的多媒体注释文件;Obtain a multimedia annotation file corresponding to the program code;
建立所述多媒体注释文件与所述程序代码之间的关联关系。An association relationship between the multimedia annotation file and the program code is established.
本发明的另一个方面是提供一种程序注释装置,包括:Another aspect of the present invention is to provide a program annotation device, comprising:
获取模块,用于获取与程序代码对应的多媒体注释文件;An acquisition module, configured to acquire a multimedia annotation file corresponding to the program code;
建立模块,用于建立所述多媒体注释文件与所述程序代码之间的关联关系。The establishment module is used to establish the association relationship between the multimedia annotation file and the program code.
本发明中,通过采用多媒体注释文件对程序代码进行注释,以使程序维护人员能够根据与程序代码对应的多媒体注释文件,快速理解程序代码,提高了程序维护人员的维护效率。In the present invention, the program code is annotated by using the multimedia annotation file, so that the program maintenance personnel can quickly understand the program code according to the multimedia annotation file corresponding to the program code, and the maintenance efficiency of the program maintenance personnel is improved.
附图说明Description of drawings
图1为本发明提供的程序注释方法一个实施例的流程图;Fig. 1 is a flowchart of an embodiment of the program annotation method provided by the present invention;
图2为本发明提供的程序注释方法又一个实施例的流程图;Fig. 2 is a flowchart of another embodiment of the program annotation method provided by the present invention;
图3为本发明提供的程序注释方法另一个实施例的流程图;Fig. 3 is a flow chart of another embodiment of the program annotation method provided by the present invention;
图4为本发明提供的程序注释装置一个实施例的结构示意图。Fig. 4 is a schematic structural diagram of an embodiment of a program annotation device provided by the present invention.
具体实施方式Detailed ways
为使本发明实施例的目的、技术方案和优点更加清楚,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments It is a part of embodiments of the present invention, but not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the protection scope of the present invention.
图1为本发明提供的程序注释方法一个实施例的流程图,如图1所示,包括:Fig. 1 is a flowchart of an embodiment of the program annotation method provided by the present invention, as shown in Fig. 1, including:
101、获取与程序代码对应的多媒体注释文件。101. Acquire a multimedia annotation file corresponding to the program code.
其中,多媒体注释文件可以包括:程序员针对程序代码录制的讲解视频,程序代码的运行过程和运行结果,代码段的运行过程和运行结果,程序代码的编写过程,与程序代码相关的背景知识,或者使程序维护人员与程序员进行语音连线或视频连线的软件等。其中,讲解视频可以包括:程序员的讲解内容以及程序员在讲解过程中使用的辅助动作或辅助设备等。Wherein, the multimedia annotation file may include: the explanation video recorded by the programmer for the program code, the running process and running result of the program code, the running process and running result of the code segment, the writing process of the program code, the background knowledge related to the program code, Or software that enables program maintenance personnel to conduct voice or video connections with programmers. Wherein, the explaining video may include: the explaining content of the programmer and the auxiliary actions or auxiliary equipment used by the programmer during the explaining process.
多媒体注释文件可以采用音频、视频、动画、静态图片、文字、压缩包、软件等携带上述内容。其中,软件可以为具体的代码,以使多媒体注释装置可以根据该代码生成可以播放或显示的音频、视频、动画、静态图片、文字等。The multimedia annotation file may use audio, video, animation, static picture, text, compressed package, software, etc. to carry the above content. Wherein, the software can be a specific code, so that the multimedia annotation device can generate audio, video, animation, still pictures, text, etc. that can be played or displayed according to the code.
本发明提供的程序注释方法可以由程序注释装置执行。程序注释装置的具体表现形式可以为多媒体注释工具(Multimedia Commenting Tool,MCT)。MCT可以是一个用于创建、修改和播放多媒体注释文件的集成开发环境(Integrated Development,IDE)插件,也可以是一个独立的工具。The program commenting method provided by the invention can be executed by a program commenting device. A specific manifestation of the program commenting device may be a multimedia commenting tool (Multimedia Commenting Tool, MCT). MCT can be an integrated development environment (Integrated Development, IDE) plug-in for creating, modifying and playing multimedia annotation files, or it can be a stand-alone tool.
102、建立多媒体注释文件与程序代码之间的关联关系。102. Establish an association relationship between the multimedia annotation file and the program code.
其中,建立多媒体注释文件与程序代码之间的关联关系的方式可以有两种:第一种是将多媒体注释文件对应的多媒体注释描述符嵌入程序代码;第二种是将多媒体注释文件保存到与程序代码的文件名一致的文件夹中。使得程序维护人员在阅读或者编辑程序代码时,可以查看对应的多媒体注释文件,快速理解程序代码。Wherein, there are two ways to establish the association relationship between the multimedia annotation file and the program code: the first is to embed the multimedia annotation descriptor corresponding to the multimedia annotation file into the program code; the second is to save the multimedia annotation file to the In the same folder as the file name of the program code. When the program maintainer reads or edits the program code, he can check the corresponding multimedia annotation file and quickly understand the program code.
步骤102具体可以包括:创建多媒体注释文件对应的多媒体注释描述符,将多媒体注释描述符嵌入程序代码。多媒体注释描述符包括:多媒体注释文件的地址和多媒体注释文件的类型。
其中,当多媒体注释文件保存在程序代码所在的文件夹内时,多媒体注释文件的地址可以为多媒体注释文件的保存路径。例如,当多媒体注释文件保存在程序代码所在文件夹内名称为“text.files”的文件夹内,且多媒体注释文件的名称为“voice code”时,多媒体注释文件的保存路径为“text.files:///voicecode”。当多媒体注释文件为网络资源时,多媒体注释文件的地址可以为多媒体注释文件对应的统一资源定位符(Uniform Resource Locator,URL),即多媒体注释文件所在的网页地址。Wherein, when the multimedia annotation file is saved in the folder where the program code is located, the address of the multimedia annotation file may be the saving path of the multimedia annotation file. For example, when the multimedia annotation file is saved in the folder named "text.files" in the folder where the program code is located, and the name of the multimedia annotation file is "voice code", the saving path of the multimedia annotation file is "text.files :///voicecode". When the multimedia annotation file is a network resource, the address of the multimedia annotation file may be a Uniform Resource Locator (URL) corresponding to the multimedia annotation file, that is, the address of the web page where the multimedia annotation file is located.
多媒体注释文件的类型可以为多媒体注释文件中音频、视频、动画、静态图片、文字或者压缩包的格式。例如,多媒体注释文件中音频的格式可以为:激光唱片(COMPACTDISK,CD)格式、MP3格式、乐器数字接口(MusicalInstrument Digital Interface,MIDI)、微软音频格式(Windows Media Audio,WMA)、即时播音系统(RealAudio)格式等。视频的格式可以为运动图像专家组(Motion Picture Experts Group,MPEG)、音频视频交错(Audio VideoInterleaved,AVI)、高级流格式(Advanced Streaming format,ASF)等。举例来说,当多媒体注释文件中包括音频和视频时,多媒体注释文件的类型可以为MP3+MPEG。The type of the multimedia annotation file may be in the format of audio, video, animation, still picture, text or compressed package in the multimedia annotation file. For example, the format of the audio in the multimedia annotation file can be: laser disc (COMPACTDISK, CD) format, MP3 format, musical instrument digital interface (MusicalInstrument Digital Interface, MIDI), Microsoft audio format (Windows Media Audio, WMA), instant broadcast system ( RealAudio) format, etc. The format of the video may be Motion Picture Experts Group (Motion Picture Experts Group, MPEG), Audio Video Interleaved (Audio Video Interleaved, AVI), Advanced Streaming format (Advanced Streaming format, ASF), etc. For example, when the multimedia annotation file includes audio and video, the type of the multimedia annotation file can be MP3+MPEG.
可选的,多媒体注释描述符中还可以包括:多媒体注释文件的标题,以便程序维护人员理解此处嵌入的多媒体注释文件的主要内容。Optionally, the multimedia annotation descriptor may further include: the title of the multimedia annotation file, so that program maintainers can understand the main content of the embedded multimedia annotation file.
可选的,程序注释装置可以将多媒体注释描述符作为对程序代码中代码部分的注释,嵌入代码部分所在位置;也可以将多媒体注释描述符作为对程序代码中文字注释的进一步注释,嵌入文字注释所在位置。多媒体注释描述符可以以“<<<”作为开始,以“>>>”作为结束,以便程序维护人员对程序代码和多媒体注释描述符进行区分。Optionally, the program annotation device can use the multimedia annotation descriptor as an annotation to the code part in the program code, and embed the location of the code portion; it can also use the multimedia annotation descriptor as a further annotation to the text annotation in the program code, and embed the text annotation location. The multimedia comment descriptor can start with "<<<" and end with ">>>", so that program maintainers can distinguish between program code and multimedia comment descriptor.
例如,当用户在MCT中打开程序代码后,用户可以将光标放置在代码部分所在位置,鼠标点击MCT的“插入”按钮,选择一个作为多媒体注释文件的视频文件,MCT就可以根据用户的操作在程序代码的显示界面中代码部分所在位置嵌入视频文件。For example, when the user opens the program code in MCT, the user can place the cursor at the location of the code part, click the "Insert" button of MCT with the mouse, and select a video file as a multimedia comment file, and MCT can insert it according to the user's operation. The video file is embedded in the position of the code part in the display interface of the program code.
又例如,当用户在MCT中打开程序代码后,用户可以将光标放置在文字注释部分所在位置,点击MCT的“插入”按钮,在出现的对话框中输入作为多媒体注释文件的视频文件的地址和类型,MCT就可以根据用户的操作在程序代码显示界面的文字注释部分所在位置插入一个包括该视频文件的地址和类型的多媒体注释描述符。For another example, after the user opens the program code in MCT, the user can place the cursor on the position of the text comment part, click the "insert" button of MCT, and in the dialog box that appears, input the address and address of the video file as the multimedia comment file type, the MCT can insert a multimedia comment descriptor including the address and type of the video file at the position of the text comment part of the program code display interface according to the user's operation.
可选地,程序注释装置可以先将多媒体注释描述符嵌入程序代码后,再对多媒体注释描述符对应的多媒体注释文件进行编辑。例如,程序员可以在开始编写程序代码时,采用程序注释装置创建多媒体注释文件和对应的多媒体注释描述符,并将多媒体注释描述符嵌入程序代码,然后开始录制程序代码的编写过程,即对多媒体注释文件进行编辑,当程序代码编写完成时,录制过程结束,得到完整的多媒体注释文件。Optionally, the program annotation device may first embed the multimedia annotation descriptor into the program code, and then edit the multimedia annotation file corresponding to the multimedia annotation descriptor. For example, when the programmer starts to write the program code, he can use the program annotation device to create a multimedia annotation file and a corresponding multimedia annotation descriptor, and embed the multimedia annotation descriptor into the program code, and then start recording the writing process of the program code, that is, to The annotation file is edited, and when the program code is written, the recording process ends and a complete multimedia annotation file is obtained.
可选地,程序注释装置还可以在播放多媒体注释文件的过程中编辑多媒体注释文件。例如,MCT可以将视频程序嵌入程序代码,运行该视频程序后能够实时生成视频内容。当用户在程序注释装置中打开程序代码,点击MCT的“播放”按钮时,MCT确定当前显示的程序代码中嵌入的视频程序,运行视频程序,生成视频内容并实时播放该视频内容。Optionally, the program annotation device can also edit the multimedia annotation file during the playback of the multimedia annotation file. For example, MCT can embed a video program into program code, and after running the video program, video content can be generated in real time. When the user opens the program code in the program annotation device and clicks the "play" button of the MCT, the MCT determines the video program embedded in the currently displayed program code, runs the video program, generates video content and plays the video content in real time.
进一步地,步骤102之后,当用户在MCT中,或者MCT所嵌入的IDE中打开程序代码,点击MCT的“播放”按钮时,MCT可以将用户的上述操作视为用户向MCT发送了第一播放请求,此时,MCT可以根据第一播放请求,确定当前显示的程序代码的文件名,获取与程序代码相关联的多媒体注释文件,并播放多媒体注释文件。具体地,可以采用Video LAN客户端(VideoLAN Client,VLC)多媒体播放器播放多媒体注释文件,VLC多媒体播放器支持多种音视频编码格式。Further, after
本实施例中,程序注释装置通过采用多媒体注释文件对程序代码进行注释,以使程序维护人员能够根据与程序代码对应的多媒体注释文件,快速理解程序代码,提高了程序维护人员的维护效率。In this embodiment, the program annotation device uses multimedia annotation files to annotate program codes, so that program maintenance personnel can quickly understand the program codes according to the multimedia annotation files corresponding to the program codes, thereby improving the maintenance efficiency of program maintenance personnel.
图2为本发明提供的程序注释方法又一个实施例的流程图,如图2所示,在图1所示实施例的基础上,若多媒体注释文件包括程序代码中至少一个代码段对应的多媒体注释子文件,获取与程序代码对应的多媒体注释文件具体可以为:Fig. 2 is a flow chart of another embodiment of the program annotation method provided by the present invention. As shown in Fig. 2, on the basis of the embodiment shown in Fig. 1, if the multimedia annotation file includes the multimedia corresponding to at least one code segment in the program code Annotate sub-files, to obtain multimedia annotation files corresponding to program codes can be:
1011、在程序代码的显示界面上,获取与程序代码中至少一个代码段对应的多媒体注释子文件,并记录操作记录文件,操作记录文件包括至少一个代码段在程序代码中的位置以及显示界面上光标在至少一个代码段对应的位置内时鼠标和/或键盘的操作。1011. On the display interface of the program code, obtain the multimedia comment sub-file corresponding to at least one code segment in the program code, and record the operation record file, the operation record file includes the position of at least one code segment in the program code and the display interface Mouse and/or keyboard operations when the cursor is in the position corresponding to at least one code segment.
其中,代码段具体可以为程序代码中的一行代码或多行代码,或者一行代码中的一个或多个字符。代码段在程序代码中的位置具体可以包括代码段在程序代码中的起始位置和终止位置。Wherein, the code segment may specifically be one line of code or multiple lines of code in the program code, or one or more characters in one line of code. The position of the code segment in the program code may specifically include a start position and an end position of the code segment in the program code.
显示界面上光标在至少一个代码段对应的位置内时鼠标的操作可以为:对代码段或代码段中的标识符进行选中、复制、粘贴、剪切或移动等操作。显示界面上光标在至少一个代码段对应的位置内时键盘的操作可以为:回车、增加或删除字符等操作。When the cursor on the display interface is in the position corresponding to at least one code segment, the operation of the mouse may be: selecting, copying, pasting, cutting or moving the code segment or the identifier in the code segment. When the cursor on the display interface is in the position corresponding to at least one code segment, the keyboard operations may be operations such as carriage return, adding or deleting characters, and the like.
可选的,操作记录文件中还可以包括光标在至少一个代码段对应的位置内时的时间。操作记录文件中还可以包括显示界面上程序代码的显示变化,程序代码的显示变化与鼠标和/或键盘的操作对应,是鼠标和/或键盘的操作的结果。Optionally, the operation record file may also include the time when the cursor is in the position corresponding to at least one code segment. The operation record file may also include the display changes of the program code on the display interface, the display changes of the program code correspond to the operation of the mouse and/or keyboard, and are the result of the operation of the mouse and/or keyboard.
相应地,建立多媒体注释文件与程序代码之间的关联关系的第二种方式具体可以包括:Correspondingly, the second way of establishing the association relationship between the multimedia annotation file and the program code may specifically include:
1021、建立多媒体注释文件、操作记录文件以及程序代码的复制文件之间的关联关系。1021. Establish an association relationship among the multimedia annotation file, the operation record file, and the copy file of the program code.
程序注释装置可以采用相同的文件名加不同的后缀来分别保存多媒体注释文件、操作记录文件以及程序代码的复制文件。例如,程序注释装置可以以文件名“voice Code”加后缀“.vcr.wav”的形式保存多媒体注释文件,以文件名“voice Code”加后缀“.vcr”的形式保存操作记录文件,以文件名“voiceCode”加后缀“.vcr.java.bak”的形式保存程序代码的复制文件。The program annotation device can use the same file name plus different suffixes to store multimedia annotation files, operation record files and copy files of program codes respectively. For example, the program annotation device can save the multimedia annotation file in the form of the file name "voice Code" plus the suffix ".vcr.wav", save the operation record file in the form of the file name "voice Code" plus the suffix ". Save the copied file of the program code in the form of the name "voiceCode" plus the suffix ".vcr.java.bak".
1022、将多媒体注释文件、操作记录文件以及程序代码的复制文件保存到与程序代码的文件名一致的文件夹中。1022. Save the multimedia annotation file, the operation record file, and the copy file of the program code in a folder whose file name is consistent with that of the program code.
例如,程序注释装置可以将程序代码的文件名设置为test.java,将多媒体注释文件、操作记录文件以及程序代码的复制文件保存到文件名为“test.java”后缀为“.files”的文件夹中。For example, the program annotation device can set the file name of the program code to test.java, and save the multimedia annotation file, the operation record file and the copy file of the program code to a file whose file name is "test.java" and the suffix is ".files". in the middle.
进一步地,1022之后,当用户在MCT,或者MCT所嵌入的集成开发环境IDE中打开程序代码,在程序代码的显示界面上,将光标移至需要查看多媒体注释子文件的代码段在程序代码中的位置,并点击MCT的“seek to line”按钮时,MCT可以将用户的上述操作视为用户向MCT发送了第二播放请求,此时,MCT可以根据第二播放请求,确定当前显示的程序代码的文件名以及光标对应代码段在程序代码中的位置,根据程序代码的文件名,获取与程序代码相关联的多媒体注释文件,并根据光标对应代码段在程序代码中的位置,获取多媒体注释文件中与代码段对应的多媒体注释子文件以及操作记录文件中与代码段对应的鼠标和/或键盘的操作,并播放多媒体注释子文件以及操作记录文件中与代码段对应的鼠标和/或键盘的操作。Further, after 1022, when the user opens the program code in the MCT, or the integrated development environment IDE embedded in the MCT, on the display interface of the program code, move the cursor to the code segment that needs to view the multimedia annotation subfile in the program code and click the "seek to line" button of the MCT, the MCT can regard the user's above operation as the user sending a second playback request to the MCT, and at this time, the MCT can determine the currently displayed program according to the second playback request According to the file name of the code and the position of the code segment corresponding to the cursor in the program code, the multimedia comment file associated with the program code is obtained according to the file name of the program code, and the multimedia comment is obtained according to the position of the code segment corresponding to the cursor in the program code The operation of the mouse and/or keyboard corresponding to the code segment in the multimedia comment sub-file and the operation record file corresponding to the code segment in the file, and play the mouse and/or keyboard corresponding to the code segment in the multimedia comment sub-file and the operation record file operation.
可选的,1022之后,当用户在MCT,或者程MCT所嵌入的集成开发环境IDE中打开程序代码,在程序代码的显示界面上,选中标识符,并点击MCT的“seek to symbol”按钮时,MCT可以将用户的上述操作视为用户向MCT发送了第三播放请求,此时,MCT可以根据第三播放请求,确定当前显示的程序代码的文件名以及标识符,根据程序代码的文件名,获取与程序代码相关联的多媒体注释文件,根据标识符对应的各代码段在程序代码中的位置,获取多媒体注释文件中与各代码段对应的多媒体注释子文件以及操作记录文件中与各代码段对应的鼠标和/或键盘的操作,并按照时间顺序依次播放多媒体注释子文件以及操作记录文件中与代码段对应的鼠标和/或键盘的操作。Optionally, after 1022, when the user opens the program code in the MCT or the integrated development environment IDE embedded in the MCT, selects the identifier on the display interface of the program code, and clicks the "seek to symbol" button of the MCT , the MCT may regard the user's above operation as the user sending a third play request to the MCT. At this time, the MCT may determine the file name and identifier of the currently displayed program code according to the third play request. According to the file name of the program code , to obtain the multimedia annotation file associated with the program code, and according to the position of each code segment corresponding to the identifier in the program code, obtain the multimedia annotation sub-file corresponding to each code segment in the multimedia annotation file and the operation log file corresponding to each code segment The operation of the mouse and/or keyboard corresponding to the segment, and the multimedia annotation sub-file and the operation of the mouse and/or keyboard corresponding to the code segment in the operation record file are played sequentially in chronological order.
其中,标识符具体可以为程序代码中的单个或多个字符、函数、变量或类等。Wherein, the identifier may specifically be a single or multiple characters, functions, variables, or classes in the program code.
本实施例中,程序注释装置通过在程序代码的显示界面上,获取程序代码中代码段对应的多媒体注释子文件,并记录操作记录文件,建立多媒体注释文件、操作记录文件与程序代码的复制文件之间的关联关系,将多媒体注释文件、操作记录文件以及程序代码的复制文件保存到与程序代码的文件名一致的文件夹中,以使程序维护人员能够根据与程序代码对应的多媒体注释文件,快速理解程序代码,提高了程序维护人员的维护效率。In this embodiment, the program annotation device obtains the multimedia annotation sub-file corresponding to the code segment in the program code on the display interface of the program code, and records the operation record file to create a copy file of the multimedia annotation file, the operation record file and the program code The relationship between the multimedia annotation files, operation record files, and program code copy files are saved in a folder consistent with the file name of the program code, so that program maintainers can use the multimedia annotation files corresponding to the program code, Quickly understand the program code and improve the maintenance efficiency of program maintainers.
图3为本发明提供的程序注释方法另一个实施例的流程图,如图3所示,在图2所示实施例的基础上,步骤102之后,还包括:Fig. 3 is a flowchart of another embodiment of the program annotation method provided by the present invention. As shown in Fig. 3, on the basis of the embodiment shown in Fig. 2, after
103、当程序代码中有代码段的增加或删除时,确定程序代码中位置发生改变的代码段,对操作记录文件中与位置发生改变的代码段对应的位置进行修改。103. When a code segment is added or deleted in the program code, determine the code segment whose position has changed in the program code, and modify the position corresponding to the code segment whose position has changed in the operation record file.
例如:在一种实施场景下,在程序代码的第i行之后新增了一行代码,导致第i行之后的代码段所在行数发生改变,程序注释装置需要对操作记录文件中与第i行之后的代码段对应的行数加1。For example: in an implementation scenario, a new line of code is added after the i-th line of the program code, resulting in a change in the number of lines where the code segment after the i-th line is located, and the program annotation device needs to compare the operation record file with the i-th line The number of lines corresponding to the following code segment is increased by 1.
在第二种实施场景下,程序代码的第j行被删去,导致第j行之后的代码段所在行数发生改变,程序注释装置需要对操作记录文件中与第j行之后的代码段对应的行数减1。In the second implementation scenario, the jth line of the program code is deleted, resulting in a change in the number of lines of the code segment after the jth line, and the program annotation device needs to correspond to the code segment after the jth line in the operation record file Subtract 1 from the number of rows.
另外,若对程序代码的第k行进行修改,则可以认为是删除第k行,并增加新的第k行,此时程序代码中各代码段的位置没有发生改变,不需要对操作记录文件进行修改。In addition, if the k-th line of the program code is modified, it can be considered as deleting the k-th line and adding a new k-th line. At this time, the position of each code segment in the program code has not changed, and there is no need to modify the operation record file. to modify.
本实施例中,当程序代码中有代码段的增加或删除时,确定程序代码中位置发生改变的代码段,对操作记录文件中与位置发生改变的代码段对应的位置进行修改,保持操作记录文件与程序代码之间的一致性,使得程序维护人员能够根据与程序代码对应的多媒体注释文件,快速理解程序代码,提高了程序维护人员的维护效率。In this embodiment, when there is an addition or deletion of a code segment in the program code, determine the code segment whose position has changed in the program code, modify the position corresponding to the code segment whose position has changed in the operation record file, and keep the operation record The consistency between the file and the program code enables the program maintenance personnel to quickly understand the program code according to the multimedia annotation file corresponding to the program code, and improves the maintenance efficiency of the program maintenance personnel.
本领域普通技术人员可以理解:实现上述各方法实施例的全部或部分步骤可以通过程序指令相关的硬件来完成。前述的程序可以存储于一计算机可读取存储介质中。该程序在执行时,执行包括上述各方法实施例的步骤;而前述的存储介质包括:ROM、RAM、磁碟或者光盘等各种可以存储程序代码的介质。Those of ordinary skill in the art can understand that all or part of the steps for implementing the above method embodiments can be completed by program instructions and related hardware. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps including the above-mentioned method embodiments; and the aforementioned storage medium includes: ROM, RAM, magnetic disk or optical disk and other various media that can store program codes.
图4为本发明提供的程序注释装置一个实施例的结构示意图,如图4所示,包括:Fig. 4 is a schematic structural diagram of an embodiment of the program annotation device provided by the present invention, as shown in Fig. 4, including:
获取模块41,用于获取与程序代码对应的多媒体注释文件;Obtaining module 41, is used for obtaining the multimedia annotation file corresponding to program code;
建立模块42,用于建立多媒体注释文件与程序代码之间的关联关系。The establishment module 42 is used to establish the association relationship between the multimedia annotation file and the program code.
可选的,建立模块42建立多媒体注释文件与程序代码之间的关联关系的第一种方式可以为,创建多媒体注释文件对应的多媒体注释描述符,将多媒体注释描述符嵌入程序代码。其中,多媒体注释描述符包括:多媒体注释文件的地址和多媒体注释文件的类型。Optionally, the first way for the establishment module 42 to establish the association between the multimedia annotation file and the program code may be to create a multimedia annotation descriptor corresponding to the multimedia annotation file, and embed the multimedia annotation descriptor into the program code. Wherein, the multimedia annotation descriptor includes: the address of the multimedia annotation file and the type of the multimedia annotation file.
进一步地,程序注释装置还可以包括:接收模块和播放模块。接收模块用于,在建立模块42建立多媒体注释文件与程序代码之间的关联关系后,接收用户的第一播放请求;播放模块用于,确定当前显示的程序代码的文件名,根据程序代码的文件名,播放与程序代码相关联的多媒体注释文件。Further, the program annotation device may further include: a receiving module and a playing module. Receiving module is used for, after setting up module 42 to set up the associative relationship between multimedia note file and program code, receives the user's first play request; File name, play the multimedia annotation file associated with the program code.
可选的,多媒体注释文件包括程序代码中至少一个代码段对应的多媒体注释子文件,对应地,获取模块41具体用于,在程序代码的显示界面上,获取与程序代码中至少一个代码段对应的多媒体注释子文件,并记录操作记录文件,操作记录文件包括至少一个代码段在程序代码中的位置以及显示界面上光标在至少一个代码段对应的位置内时鼠标和/或键盘的操作。Optionally, the multimedia annotation file includes a multimedia annotation sub-file corresponding to at least one code segment in the program code, and correspondingly, the acquisition module 41 is specifically used to acquire the subfile corresponding to at least one code segment in the program code on the display interface of the program code. The multimedia annotation sub-file, and record the operation record file, the operation record file includes the position of at least one code segment in the program code and the mouse and/or keyboard operation when the cursor is in the corresponding position of at least one code segment on the display interface.
对应的,建立模块42具体用于,建立多媒体注释文件、操作记录文件以及程序代码的复制文件之间的关联关系;将多媒体注释文件、操作记录文件以及程序代码的复制文件保存到与程序代码的文件名一致的文件夹中。Correspondingly, the establishment module 42 is specifically used to set up the association relationship between the duplicate files of the multimedia annotation file, the operation record file and the program code; the duplicate file of the multimedia annotation file, the operation record file and the program code is saved to the folder with the same file name.
进一步地,程序注释装置还可以包括:修改模块,用于当程序代码中有代码段的增加或删除时,确定程序代码中位置发生改变的代码段,对操作记录文件中与位置发生改变的代码段对应的位置进行修改。Further, the program annotation device may also include: a modification module, used to determine the code segment whose position in the program code changes when there is an addition or deletion of a code segment in the program code, and modify the code segment whose position changes in the operation record file Modify the position corresponding to the segment.
更进一步地,接收模块还可以用于在建立模块42建立多媒体注释文件与程序代码之间的关联关系后,接收用户的第二播放请求;播放模块还可以用于确定当前显示的程序代码的文件名以及光标对应代码段在程序代码中的位置,根据程序代码的文件名,获取与程序代码相关联的多媒体注释文件,根据光标对应代码段在程序代码中的位置,获取多媒体注释文件中与代码段对应的多媒体注释子文件以及操作记录文件中与代码段对应的鼠标和/或键盘的操作;播放代码段对应的多媒体注释子文件以及操作记录文件中与代码段对应的鼠标和/或键盘的操作。Furthermore, the receiving module can also be used to receive the user's second play request after the establishment module 42 establishes the association between the multimedia annotation file and the program code; the playing module can also be used to determine the file of the currently displayed program code Name and the position of the code segment corresponding to the cursor in the program code, according to the file name of the program code, obtain the multimedia comment file associated with the program code, and according to the position of the code segment corresponding to the cursor in the program code, obtain the multimedia comment file associated with the code Multimedia annotation subfile corresponding to the segment and the operation of the mouse and/or keyboard corresponding to the code segment in the operation record file; operate.
可选的,接收模块还可以用于,在建立模块42建立多媒体注释文件与程序代码之间的关联关系后,接收用户的第三播放请求;播放模块还可以用于,确定当前显示的程序代码的文件名以及标识符,根据程序代码的文件名,获取与程序代码相关联的多媒体注释文件,获取与标识符对应的各代码段在程序代码中的位置,根据标识符对应的各代码段在程序代码中的位置,获取多媒体注释文件中与各代码段对应的多媒体注释子文件,和操作记录文件中与各代码段对应的鼠标和/或键盘的操作,播放代码段对应的多媒体注释子文件,鼠标和/或键盘的操作。Optionally, the receiving module can also be used to receive the user's third play request after the establishment module 42 establishes the association between the multimedia annotation file and the program code; the play module can also be used to determine the currently displayed program code The file name and identifier of the program code, according to the file name of the program code, obtain the multimedia annotation file associated with the program code, obtain the position of each code segment corresponding to the identifier in the program code, and obtain the position of each code segment corresponding to the identifier in the program code. position in the program code, obtain the multimedia annotation subfile corresponding to each code segment in the multimedia annotation file, and the operation of the mouse and/or keyboard corresponding to each code segment in the operation record file, and play the multimedia annotation subfile corresponding to the code segment , mouse and/or keyboard actions.
本实施例中,程序注释装置通过采用多媒体注释文件对程序代码进行注释,以使程序维护人员能够根据与程序代码对应的多媒体注释文件,快速理解程序代码,提高了程序维护人员的维护效率。In this embodiment, the program annotation device uses multimedia annotation files to annotate program codes, so that program maintenance personnel can quickly understand the program codes according to the multimedia annotation files corresponding to the program codes, thereby improving the maintenance efficiency of program maintenance personnel.
最后应说明的是:以上各实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述各实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分或者全部技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的范围。Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present invention, rather than limiting them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: It is still possible to modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements for some or all of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the technical solutions of the various embodiments of the present invention. scope.
Claims (9)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310218270.5A CN103324513B (en) | 2013-06-04 | 2013-06-04 | Program annotation method and apparatus |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310218270.5A CN103324513B (en) | 2013-06-04 | 2013-06-04 | Program annotation method and apparatus |
Publications (2)
Publication Number | Publication Date |
---|---|
CN103324513A true CN103324513A (en) | 2013-09-25 |
CN103324513B CN103324513B (en) | 2016-08-10 |
Family
ID=49193278
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201310218270.5A Active CN103324513B (en) | 2013-06-04 | 2013-06-04 | Program annotation method and apparatus |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN103324513B (en) |
Cited By (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104699467A (en) * | 2013-12-04 | 2015-06-10 | 北京新媒传信科技有限公司 | Source code processing method and device |
CN105988801A (en) * | 2015-02-13 | 2016-10-05 | 腾讯科技(深圳)有限公司 | Method and device for displaying annotation information |
CN106293686A (en) * | 2015-06-25 | 2017-01-04 | 阿里巴巴集团控股有限公司 | The method and device of exhibiting pictures annotation in code text |
CN106527845A (en) * | 2016-10-11 | 2017-03-22 | 东南大学 | Voice annotation and reproduction method and device for mouse operation in text |
CN107885527A (en) * | 2016-09-27 | 2018-04-06 | 北京嘀嘀无限科技发展有限公司 | A kind of code revision method and device of test system |
CN109614083A (en) * | 2018-10-19 | 2019-04-12 | 北京大学 | An API-assisted code summary generation method based on transfer learning |
CN112559035A (en) * | 2021-01-22 | 2021-03-26 | 支付宝(杭州)信息技术有限公司 | Method and apparatus for managing notes of code text |
CN112698821A (en) * | 2021-01-12 | 2021-04-23 | 北京字节跳动网络技术有限公司 | Code labeling method, device, computer equipment, medium and system |
CN114968345A (en) * | 2022-04-06 | 2022-08-30 | 统信软件技术有限公司 | Code processing method, system, computing device and storage medium |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6041180A (en) * | 1997-04-28 | 2000-03-21 | International Business Machines Corporation | System and method for optimizing template object files |
CN1782992A (en) * | 2004-12-02 | 2006-06-07 | 国际商业机器公司 | Method and apparatus for incrementally processing program annotations |
CN102339218A (en) * | 2010-07-21 | 2012-02-01 | 阳振庭 | Program code annotating management method and device |
CN102867039A (en) * | 2012-08-31 | 2013-01-09 | 北京奇虎科技有限公司 | Adding and reading method and device of multimedia annotations |
-
2013
- 2013-06-04 CN CN201310218270.5A patent/CN103324513B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6041180A (en) * | 1997-04-28 | 2000-03-21 | International Business Machines Corporation | System and method for optimizing template object files |
CN1782992A (en) * | 2004-12-02 | 2006-06-07 | 国际商业机器公司 | Method and apparatus for incrementally processing program annotations |
CN102339218A (en) * | 2010-07-21 | 2012-02-01 | 阳振庭 | Program code annotating management method and device |
CN102867039A (en) * | 2012-08-31 | 2013-01-09 | 北京奇虎科技有限公司 | Adding and reading method and device of multimedia annotations |
Non-Patent Citations (1)
Title |
---|
周江等: "巧用UCDICT制作注释文件", 《电信技术》 * |
Cited By (13)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104699467A (en) * | 2013-12-04 | 2015-06-10 | 北京新媒传信科技有限公司 | Source code processing method and device |
CN105988801A (en) * | 2015-02-13 | 2016-10-05 | 腾讯科技(深圳)有限公司 | Method and device for displaying annotation information |
CN105988801B (en) * | 2015-02-13 | 2020-01-24 | 腾讯科技(深圳)有限公司 | Method and device for displaying annotation information |
CN106293686B (en) * | 2015-06-25 | 2019-08-02 | 阿里巴巴集团控股有限公司 | The method and device that exhibiting pictures annotate in code text |
CN106293686A (en) * | 2015-06-25 | 2017-01-04 | 阿里巴巴集团控股有限公司 | The method and device of exhibiting pictures annotation in code text |
CN107885527A (en) * | 2016-09-27 | 2018-04-06 | 北京嘀嘀无限科技发展有限公司 | A kind of code revision method and device of test system |
CN106527845A (en) * | 2016-10-11 | 2017-03-22 | 东南大学 | Voice annotation and reproduction method and device for mouse operation in text |
CN106527845B (en) * | 2016-10-11 | 2019-12-10 | 东南大学 | Method and device for carrying out voice annotation and reproducing mouse operation in text |
CN109614083A (en) * | 2018-10-19 | 2019-04-12 | 北京大学 | An API-assisted code summary generation method based on transfer learning |
CN112698821A (en) * | 2021-01-12 | 2021-04-23 | 北京字节跳动网络技术有限公司 | Code labeling method, device, computer equipment, medium and system |
CN112698821B (en) * | 2021-01-12 | 2024-03-26 | 北京字节跳动网络技术有限公司 | Code labeling method, device, computer equipment, medium and system |
CN112559035A (en) * | 2021-01-22 | 2021-03-26 | 支付宝(杭州)信息技术有限公司 | Method and apparatus for managing notes of code text |
CN114968345A (en) * | 2022-04-06 | 2022-08-30 | 统信软件技术有限公司 | Code processing method, system, computing device and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN103324513B (en) | 2016-08-10 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN103324513B (en) | Program annotation method and apparatus | |
JP7193167B2 (en) | Apparatus, system and method for recording and rendering multimedia | |
CN1152335C (en) | Authoring device and authoring method for creating multimedia files | |
JP2008518315A (en) | How to annotate a timeline file | |
JP2002351878A (en) | Digital contents reproduction device, data acquisition system, digital contents reproduction method, metadata management method, electronic watermark embedding method, program, and recording medium | |
JP2005523555A (en) | Information storage medium on which interactive content version information is recorded, its recording method and reproducing method | |
CN101379823A (en) | Content edition/generation system | |
JP2008538675A (en) | Media timeline processing infrastructure | |
KR100366760B1 (en) | A method of combining multi media files | |
WO2010028597A1 (en) | Method and system for processing electronic data | |
Canazza et al. | Accessing tape music documents on mobile devices | |
JP2007531175A (en) | Recording / reproducing apparatus, reproducing apparatus, recording / reproducing method, reproducing method, program, and recording medium | |
CN104349173A (en) | Video repeating method and device | |
JP5259780B2 (en) | Video file creation apparatus and video file creation method | |
JPWO2010073695A1 (en) | Edit information presenting apparatus, edit information presenting method, program, and recording medium | |
CN109511008B (en) | A method for supporting video and audio file content appending based on object storage | |
JP2022022205A (en) | Systems and methods for customizing video | |
CN116011415B (en) | Document annotation generation method and device, network disk and storage medium | |
JP4626483B2 (en) | Server apparatus, data processing method, program, and communication method | |
JP2010154336A (en) | Apparatus and method for processing image | |
JP2009503757A (en) | Method and apparatus for controlling reproduction of optical disc program | |
JP5180832B2 (en) | Method and apparatus for editing optical disc program | |
JP2008294968A (en) | Apparatus and method for verifying content information, and program | |
CN1855285B (en) | How to store audio-visual files and how to edit audio-visual files | |
GB2621403A (en) | Data processing apparatuses and methods |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant |