針對一般程式使用內插法來產生偵測動畫
Abstract
一般而言,程式設計師在撰寫程式時,常會需要使用或維護別人所寫的程式碼,此時就會遇到理解程式碼的問題。雖然閱讀相關的設計文件可以幫助了解程式的運作,但有可能會遇到文件過期的問題,所以通常程式設計師會先閱讀完設計文件然後在除錯模式下於程式中插入中斷點,然後藉觀察中斷點之間變數的變化以及呼叫過的函式路徑,來了解程式運作的方式以及原理。
目前大部分的程式設計師還是使用文字介面的除錯器,但如果遇到複雜而龐大的資料結構,難免還是需要用紙筆或者是其他的程式來幫助了解此資料結構。雖然近年來有不少軟體視覺化的工具可以使用圖形來視覺化軟體內的資料,這些圖形被稱為視覺化隱喻(Visualize Metaphor(VM)),但是這些工具在幫助理解程式碼時的效益多寡是以應用領域而定,通常不具備普遍性。除了實用上還是有不少的限制之外,只有少數的軟體視覺化工具有提供動畫功能,如ANIMAL[1]、PlanAni[2]、JEDAS[3]、Jeliot3[4]、POLKA[5]、TANGO[6]、XTANGO[7];這些研究雛形軟體工具都有幾個特點,就是他們都擁有特定的VM、只能針對特定的程式碼演示動畫、或需要撰寫額外複雜的程式碼幫助動畫的進行。所以大部分只適用於教學用途。因此我們提出了一個建構在xDIVA[8]的動畫子系統,能夠以動畫呈現出中斷點與中斷點之間程式的動態行為,能讓使用者在追溯程式碼時能夠更快速的了解程式運作的方式。
為什麼需要建構在xDIVA上呢?主要是因為使用者可以在xDIVA上根據基本形狀的VM組合出更為複雜的VM而且不需要撰寫程式碼就可以完成這些步驟,而且xDIVA裡也有針對各種不同的資料結構所設計的排列方式(layout),而使用者完全不需要撰寫額外的程式碼來輔助動畫的進行。在程式的進行過程中layout會不斷的排列所有的VM,藉由著這些位置的改變以及VM本身的改變構成一段有意義的動畫,可讓使用者省去在紙上或腦海中推演程式進行的步驟,輕鬆的達成理解程式碼的目的。
Generally speaking, a programmer usually needs to use or maintain the code which is written by someone else. Before he/she is capable of modifying the code, he/she must understand the program. Several entities can help understanding a program. For example, a design document, if available, can greatly help the understanding of a program. However, a design document might be out of date or inconsistent to the code. Tracing the source code is often used as a last resort. It is common to trace a program by debugger. The programmers set break points inside the program and then execute the program in debug mode to observe the change of variable values in order to understand how does the program work. Most debuggers nowadays are textual and numerical based. It is inadequate when a program comprises of complicated data structures. In these years, several software visualization researches have been proposed to visualize software by the graphics, which are called visualize metaphors (VM). However, these research tools are typically limited to specific application domains, without generality. Tools that provide animation capability include ANIMAL[1], PlanAni[2], JEDAS[3], Jeliot3[4], POLKA[5], TANGO[6], and XTANGO[7]. These prototype software tools typically limit their visualization power to fixed problem domains such as education. Some requires writing extra code for the animation. In this thesis, we proposed an animation subsystem in xDIVA[8]. It can display the program dynamic behavior between the break points by animation so that a program can be understood in a more efficient manner. In our method, users do not need to write the extra code for animation. After a layout automatically arranges the VMs in a new break point, our approach computes the differences in VM’s positions and properties so that an interpolation between the two key frames at two break points can be constructed. An animation is then made from such an interpolation.
Generally speaking, a programmer usually needs to use or maintain the code which is written by someone else. Before he/she is capable of modifying the code, he/she must understand the program. Several entities can help understanding a program. For example, a design document, if available, can greatly help the understanding of a program. However, a design document might be out of date or inconsistent to the code. Tracing the source code is often used as a last resort. It is common to trace a program by debugger. The programmers set break points inside the program and then execute the program in debug mode to observe the change of variable values in order to understand how does the program work. Most debuggers nowadays are textual and numerical based. It is inadequate when a program comprises of complicated data structures. In these years, several software visualization researches have been proposed to visualize software by the graphics, which are called visualize metaphors (VM). However, these research tools are typically limited to specific application domains, without generality. Tools that provide animation capability include ANIMAL[1], PlanAni[2], JEDAS[3], Jeliot3[4], POLKA[5], TANGO[6], and XTANGO[7]. These prototype software tools typically limit their visualization power to fixed problem domains such as education. Some requires writing extra code for the animation. In this thesis, we proposed an animation subsystem in xDIVA[8]. It can display the program dynamic behavior between the break points by animation so that a program can be understood in a more efficient manner. In our method, users do not need to write the extra code for animation. After a layout automatically arranges the VMs in a new break point, our approach computes the differences in VM’s positions and properties so that an interpolation between the two key frames at two break points can be constructed. An animation is then made from such an interpolation.
Description
Keywords
軟體視覺化, 視覺化隱喻, software visualization, visualize metaphors