Code Quality Measurement : A method to calculate SSI ( Shipped Source Instruction) for XSL (Extensible Stylesheet Language)
Original Publication Date: 2005-Aug-02
Included in the Prior Art Database: 2005-Aug-02
One of the widely accepted metrics for source codes such as java or C is the number of Lines of Code (LOC). Developers are measured by the number of LOC shipped to production, or called as SSI (Source Shipped Instruction). In some older programming languages, this can easily be implemented due to their nature, i.e. 1 line of code is indicated by the semi-colon sign ";". Therefore, we can simply count the number of semicolons in the file. However, this is not the case for XSL files. There is a lack of metrics definition and calculation tool for XSL. Currently the only way of calculating the effort is by doing it manually: a.By calculating the number of lines in the file. This approach is sometimes questionable, as developers can just separate one line of logic to different line. On the other hand, depending on the programming style of the developer, he or she may combine more than 1 line of logic in 1 physical line in the program file, thus his or her effort is not fairly calculated. b.By calculating the number of open tags ("<"), divided by two. However, this approach will not take into account self-contained elements. Thus, this approach is not accurate. In summary, currently there isn't any clear definition of a Line Of Code (LOC) for XSL files. In addition to that, there isn't metrics / performance indicator, nor tools to calculate SSI for XSL files.
Code Quality Measurement : A method to calculate SSI ( Shipped Source Instruction ) for XSL (Extensible Stylesheet Language )
The core idea of this invention is to define logical definition of one line of code of a XSL file. Given this definition, this invention discloses the way to calculate the Shipped Source Instruction (SSI) of an XSL file.
In principal, an XSL file is an XML file. Consider Program C and Program D below. Both programs represent 1 logical unit of code. Each of them is one element. Therefore, we are defining that 1 element = 1 Line of Code (LOC) in XSL file.
Due to the nature of an XSL file, which is basically an XML file, therefore any XML parser will be able to read the file and construct XML Document(s) from a XSL file. Since each XML Document is similar to a tree, thus we can traverse the tree to caluculate how many elements they contain . The number of elements is the number of LOC, thus it is the SSI.
The advantages of using this approach, compared to the current manual approaches are the following :
- Although an element is written into a number of rows in the XSL file, it will still be regarded as 1 line of code, thus developers will not gain from doing so. Note: consider sample depicted in Program C.
- Comments are automatically not counted into account, providing more accurate number . - Self-contained elements are taken into account, which provides more accurate calculation, as well.
- Due to the nature of this approach, much information can be obtained as the tree is being traversed. Thus, more code analysis can be built into this tool in future. For...