<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta>
      <journal-title-group>
        <journal-title>A Preliminary Empirical Exploration of Quality Measurement for JavaScript Solutions •</journal-title>
      </journal-title-group>
      <issn pub-type="ppub">1613-0073</issn>
    </journal-meta>
    <article-meta>
      <title-group>
        <article-title>A Preliminary Empirical Exploration of Quality  Measurement for JavaScript Solutions</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>DAVID KOSTANJEVEC</string-name>
          <email>kostanjevec.david@gmail.com</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>MAJA PUŠNIK</string-name>
          <email>maja.pusnik@uni-mb.si</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>MARJAN HERIČKO</string-name>
          <email>marjan.hericko@um.si</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>BOŠTJAN ŠUMAK</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>GORDANA RAKIĆ and ZORAN BUDIMAC</institution>
        </aff>
      </contrib-group>
      <pub-date>
        <year>2017</year>
      </pub-date>
      <volume>6</volume>
      <issue>5</issue>
      <fpage>11</fpage>
      <lpage>13</lpage>
      <abstract>
        <p>Contrary to the increasing popularity of JavaScript programming language in the field of web application development, the numerical expression of evidence about the quality of solutions developed in this language is still not reliable. Based on the preliminary literature review, which is the main subject of this paper, this area has not yet been fully explored. Measurement is done by application of general and object-oriented metrics, which can reflect only general characteristics of the solution, while the specifics related to the programming language are not expressible by existing metrics. Due to the popularity of the language and the increasing number of JavaScript projects, the idea is to determine appropriate metrics and approach to measurement for their application in practice. Finally, the measurement approach will be implemented in the SSQSA Framework to enable its application. The preliminary research presented in this paper was conducted during a student course of Empirical research methods at the University of Maribor and therefore is limited in number of included papers, depth of research, and analysis of its contents, which restricts us to preliminary conclusion only, but places the foundation and justifies the described forthcoming research. Categories and Subject Descriptors: H.0. [Information Systems]: General; D.2.8 [Software Engineering]: Metrics Complexity measures; Product metrics; D.2.9. [Software Engineering]: Management - Software quality assurance (SQA) Additional Key Words and Phrases: software metrics, quality metrics, JavaScript, software analysis, JavaScript analysis JavaScript is an increasingly popular programming language that is dynamically interpreted and has a simple syntax. The Angel List Job Posting (USA) Agency recorded 30.6% jobs as JavaScript oriented in 2016 (Chen 2017). Popularity however brings a lot of changes and innovations in the development of web applications and services. JavaScript was primarily used only for client-side functionalities and was running in a browser. However, it is now running on the servers as well (Capan 2013). Applications and services are written using the JavaScript language and executed on the Node.js platform, a relatively new technology which is continually evolving. JavaScript is also becoming the main programming language for developing hybrid mobile applications using frameworks such as Cordova, Phonegap, Titanium, Facebook's React Native, etc. (ValueCoders 2017). Today Node.js is one of the most innovative solutions for building servers and web/mobile applications. The field is growing rapidly with the valuable contributions of other developers and technological giants (Abhishek 2015). Node.js also provides a platform for publishing third party packages that are available through the Node Packet Manager (NPM) public repository. At the time of writing, there are more than 540,000 packages, which can be simply installed, managed, and updated through package management (B. Pfretzschner in L. B. Othmane 2016) and (E. Wittern, P. Suter 2016). Today, there are many solutions based on Node.JS framework that constantly evolving. The most well-known Node.js frameworks are Express.js, Hapi.js, Socket.io, Mojito, Mean.js, Sails.js, Koa and others (Noeticsunil 2017). Following all frameworks as well as their success in terms of quality is</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1 INTRODUCTION</title>
      <p>
        very difficult, as new Node.js frames are constantly appearing
        <xref ref-type="bibr" rid="ref1">(Abhishek 2015)</xref>
        ,
        <xref ref-type="bibr" rid="ref10">(Noeticsunil 2017)</xref>
        .
Because of the large number and how fast different frameworks are being developed, and updated, it
would be necessary to have appropriate tools enabling for analysis and comparison of these
frameworks in terms of different quality dimensions. The analysis should include benchmarking
criteria for (1) the framework, (2) what the framework is intended for, and (3) quality of the software
developed on the framework. The quality of the developed projects would be tested by using
JavaScript software metrics that are still not precisely defined.
      </p>
      <p>
        The overall goal of this research is to establish and to apply an appropriate measurement to
monitor quality of applications written using the JavaScript programming language. Upon the
establishment of an measurement approach, the SSQSA Framework
        <xref ref-type="bibr" rid="ref7">(Gordana Rakić 2015)</xref>
        could be
exploited to measure JavaScript solutions according to it. Existing frameworks so far extract different
metrics for measuring quality of solutions written in different languages, including JavaScript, but
with no processing of extracted numbers that would provide the user with useful information about
the quality of the analyzed solution. In order to employ an analytic technique to generate a certain
information about the quality of a JavaScript solution, we have to define which of extracted metrics
we will take into account and how they measure the quality attributes in JavaScript solutions as well
as provide quantitative data about the quality variables or factors.
      </p>
      <p>Following described goals, we conducted a preliminary research to identify software metrics
potentially appropriate for assessing the quality of JavaScript solutions. The goal of this paper is to
review approaches for measuring complexity and other quality attributes applied to JavaScript
solutions, in order to select applicable metrics. Based on the literature review, we tried to identify
metrics comparable to classic OO metrics that are, according to the existing literature, used to
measure quality attributes of JavaScript solutions. In the following sections, we first describe the
review approach. Next, results of the review are presented and discussed, where we focus on the
selection of the metrics and evaluate their suitability to the specified purpose. Finally, the last two
sections provide limitations of this preliminary research and conclusions with the plans for future
work.</p>
    </sec>
    <sec id="sec-2">
      <title>2 REVIEW APPROACH</title>
      <p>Within the overall examination, several research questions will stand in the foreground as guidelines
for further research:
1. Which existing software metrics are appropriate for measuring the quality of JavaScript
solutions?
2. What are the shortcomings of the existing JavaScript metrics?
3. What JavaScript metrics already exists and what are their reference values?
4. Is it possible to extend the existing set of JavaScript metrics for comprehensive software
quality measurement of JavaScript based solutions?
5. What tools for static analysis of JavaScript code already exists and which metrics do the
support?</p>
      <p>Guided by these research questions, preliminary research was focused on determination of the
current situation in measuring the quality of JavaScript solutions. Specific research questions that
should be answered by this preliminary literature review are:
1. Which software metrics have been used in existing literature for measuring the quality of</p>
      <p>JavaScript solutions?
2. Are these metrics appropriate to measure the quality of JavaScript solutions?</p>
      <p>Following databases of scientific papers were used for searching of relevant literature: (1) Web of
Science, (2) Science Direct and (3) IEEE Xplore Digital Library. The search was focused on research
published in the past 5 years (from 2012 to 2017) in the field of computer science and informatics. The</p>
      <p>A Preliminary Empirical Exploration of Quality Measurement for JavaScript Solutions • 6:3
13 papers were found and included in this preliminary research, addressing listed general
questions, without a specific selection criterion. However, the preliminary research in this paper is not
a systematic literature review and focuses on discovery of software metrics applied on JavaScript
solutions and exploration of their usability. Other research questions will be addressed in more depth
in future work.</p>
    </sec>
    <sec id="sec-3">
      <title>3 REVIEW RESULTS</title>
      <p>
        Authors in
        <xref ref-type="bibr" rid="ref14">(Y. Ko, H. Lee, J. Dolby 2015)</xref>
        present a new approach for analyzing large JavaScript
applications with static analysis. The research describes their tool and focuses on the analysis of
products written in the JavaScript programming language.
      </p>
      <p>
        The authors in
        <xref ref-type="bibr" rid="ref11 ref9">(S. Mirshokraie, A. Mesbah 2013)</xref>
        focused on the JavaScript programming
language and proposed a set of mutations that are specific to web applications. They suggest a
technique that complements the static and dynamic analysis of the program to guide the process of
generating mutations, on sections of the program code, where there is a greater likelihood of errors or
could affect the output of the program. The paper presents the MUTANDIS tool and gives an
assessment of effectiveness
        <xref ref-type="bibr" rid="ref11 ref9">(S. Mirshokraie, A. Mesbah 2013)</xref>
        .
      </p>
      <p>
        Similarly, the paper
        <xref ref-type="bibr" rid="ref12 ref3 ref6 ref8">(S. Rostami, L. Eshkevari, D. Mazinanian 2016)</xref>
        presents the JSDeodorant
tool, a plug-in for Eclipse. The tool allows us to observe classes in JavaScript, it can identify the
divergence between modules and utilities when examining objects in a program code. The main
purpose of the paper is the presentation of the techniques, provided by the JSDeodorant tool, the
comparison of the tool with the more familiar tool JSClassFinder, and the quantitative and
qualitative evaluation of the results to recognize their limitations and possibilities for future
improvements
        <xref ref-type="bibr" rid="ref12 ref3 ref6 ref8">(S. Rostami, L. Eshkevari, D. Mazinanian 2016)</xref>
        . The authors in
        <xref ref-type="bibr" rid="ref11 ref9">(Mesbah 2013)</xref>
        present
the JSNOSE tool that uses the technique of detecting bad programming patterns. The tool compares
the program code with a set of 13 samples of JavaScript to find "smelly" parts of the code. Parts of bad
code can have a poor effect on the whole project, maintenance or understanding. The JSNOSE tool in
the paper is also tested on eleven web applications
        <xref ref-type="bibr" rid="ref11 ref9">(Mesbah 2013)</xref>
        . By increasing the use of JavaScript
frameworks for web applications, there is an increasing demand for the quality of the written code
including fast maintenance, reliability and speed.
      </p>
      <p>
        Based on the preliminary literature review, we concluded that there are already several metrics
defined, mostly connected to object-oriented paradigm and all of them are not completely suitable for
JavaScript program code. However, JavaScript metrics were included in a research conducted by
        <xref ref-type="bibr" rid="ref2">(Alberto S. Nuñez-Varela, Héctor G. Pérez-Gonzalez, Francisco E. Martínez-Perez 2017)</xref>
        , where a total
of 190 different metrics was identified for the object-oriented paradigm. The most common metrics
and total occurrences of specific metric, are presented in the Table II for programming languages
Java, AspectJ, C++, C, C#, Jak, Ada, COBOL, Pharo, PHP, Python, Ruby, as well as for JavaScript.
Metric
Weighted Methods per Class (WMC)
Coupling Between Objects (CBO)
Lack of Cohesion in Methods (LCOM)
Depth of Inheritance Tree (DIT)
Lines of Code (LOC)
Number of Children (NOC)
Response for a Class (RFC)
Number of Methods (NOM)
Cyclomatic Complexity (V(G))
Number of Attributes (NOA)
Fan-out (FANOUT)
Fan-in (FANIN),
Number of Public Methods (NOPM)
Lines of Comments (LCOMM)
Afferent Couplings (Ca),
Efferent Couplings (Ce)
Lack of Cohesion in Methods 2 (LCOM2)
      </p>
      <p>
        All listed metrics (Table II) however cannot be applied to JavaScript program code. According to
the research
        <xref ref-type="bibr" rid="ref12 ref3 ref8">(L. H. Silva, D. Hovadick, M. T. Valente, A. Bergel, N. Anquetil 2016)</xref>
        , which presents the
JSClassFinder tool, only few metrics are suitable. The mentioned tool creates a structure model from
the program code and is object-oriented, enabling visualization of the code (UML class diagram) and
presenting information about classes, methods, attributes, deductions, and relationships. Metrics
obtained with the tool and suitable for JavaSript measurement according to
        <xref ref-type="bibr" rid="ref12 ref3 ref8">(L. H. Silva, D. Hovadick,
M. T. Valente, A. Bergel, N. Anquetil 2016)</xref>
        are the following:
1. Number of classes,
2. Number of method,
3. Number of attributes,
4. Number of subclasses,
5. Depth of inheritance tree.
      </p>
      <p>The selected five metrics are not enough for comprehensive measuring of JavaScript solution
quality or complexity; therefore, extended research will be conducted, focusing on additional research
questions.</p>
    </sec>
    <sec id="sec-4">
      <title>4 LIMITATIONS AND THREATS TO VALIDITY</title>
      <p>This research has limitations that have to be identified and discussed. Since the research was
conducted by students within the course Empirical research methods it is not complete and other
papers of existing research must be taken into consideration. Furthermore, this is only a preliminary
research from the empirical perspective. After comprehensive empirical research, confirmed
conclusions have to be challenged in practical application to examine real usability of selected metrics
and discover their weaknesses. Final conclusions should lead to answers to the research questions.
Several metrics have been identified and are already commonly used for software quality
measurement; however most of them are reportedly not suitable for JavaScript source code
measurements. A set of metrics dedicated to measuring the quality of JavaScript solutions must be
defined and evaluated. The preliminary research in this paper is an initial effort to examine the field
of JavaScript metrics, providing basic insight into the research field.</p>
      <p>The future work will include a systematic literature review of the field, practical examination of
selected metrics and tools and definition of metrics suitable for JavaScript program code
measurement in terms of quality and complexity according to defined research questions. Extended
formation of appropriate measurements for JavaScript source code will be implemented by integrating
them with the SSQSA Framework.
This joint work is enabled by bilateral project “Multidimensional quality control for e-business
applications” between Serbia and Slovenia (2016-2017). Furthermore, the two authors from
University of Novi Sad were partially supported by the Ministry of Education, Science, and
Technological development, Republic of Serbia, through project no. OI 174023. The authors
acknowledge the financial support from the Slovenian Research Agency (research core funding No.
(J5-8230).</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          <string-name>
            <surname>Abhishek</surname>
          </string-name>
          .
          <year>2015</year>
          .
          <article-title>“10 Best Node</article-title>
          .js Frameworks For Developers.” https://www.devsaran.com/blog/10-best
          <article-title>-nodejs-frameworksdevelopers.</article-title>
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          <string-name>
            <given-names>Alberto S.</given-names>
            <surname>Nuñez-Varela</surname>
          </string-name>
          , Héctor G.
          <string-name>
            <surname>Pérez-Gonzalez</surname>
          </string-name>
          , Francisco E. Martínez-Perez, Carlos Soubervielle-Montalvo.
          <year>2017</year>
          . “
          <article-title>Source Code Metrics: A Systematic Mapping Study</article-title>
          .”
          <source>The Journal of Systems and Software</source>
          <volume>128</volume>
          :
          <fpage>164</fpage>
          -
          <lpage>97</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          <string-name>
            <given-names>B.</given-names>
            <surname>Pfretzschner</surname>
          </string-name>
          in L. B.
          <string-name>
            <surname>Othmane</surname>
          </string-name>
          .
          <year>2016</year>
          . “
          <article-title>Dependency-Based Attacks on Node</article-title>
          .
          <source>js.” IEEE Cybersecurity Development: 66.</source>
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          <string-name>
            <surname>Capan</surname>
          </string-name>
          , Tomislav.
          <year>2013</year>
          .
          <article-title>“Why The Hell Would I Use Node.js? A Case-by-Case Tutorial</article-title>
          .” Toptal. https://www.toptal.com/nodejs/why
          <article-title>-the-hell-would-i-use-node-js.</article-title>
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          <string-name>
            <surname>Chen</surname>
          </string-name>
          ,
          <string-name>
            <surname>Yi-Jirr</surname>
          </string-name>
          .
          <year>2017</year>
          .
          <article-title>“What Programming Language Should a Beginner Learn in 2017?” Codmentor community</article-title>
          . https://www.codementor.io/codementorteam/beginner
          <article-title>-programming-language-job-salary-community-7s26wmbm6.</article-title>
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          <string-name>
            <given-names>E.</given-names>
            <surname>Wittern</surname>
          </string-name>
          , P. Suter, in S. Rajagopalan.
          <year>2016</year>
          .
          <article-title>“A Look at the Dynamics of the JavaScript Package Ecosystem</article-title>
          .”
          <source>In IEEE/ACM 13th Working Conference on Mining Software Repositories</source>
          ,
          <fpage>351</fpage>
          -
          <lpage>61</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          <string-name>
            <given-names>Gordana</given-names>
            <surname>Rakić</surname>
          </string-name>
          .
          <year>2015</year>
          .
          <article-title>SSQSA: Set of Software Quality Static Analysers, Extendable and Adaptable Frameworkfor Input Language Independent Static Analysis “SSQSA Ontology Metrics Front-End1</article-title>
          .” University of Novi Sad.
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          <string-name>
            <given-names>L. H.</given-names>
            <surname>Silva</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Hovadick</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M. T.</given-names>
            <surname>Valente</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Bergel</surname>
          </string-name>
          , N. Anquetil, in
          <string-name>
            <surname>A</surname>
          </string-name>
          . Etien.
          <year>2016</year>
          . “
          <article-title>JSClassFinder: A Tool to Detect Class-like Structures in JavaScript”</article-title>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          <string-name>
            <surname>Mesbah</surname>
            ,
            <given-names>A. M.</given-names>
          </string-name>
          <string-name>
            <surname>Fard</surname>
            <given-names>A.</given-names>
          </string-name>
          <year>2013</year>
          . “JSNOSE:
          <string-name>
            <surname>Detecting JavaScript Code Smells</surname>
          </string-name>
          .”
          <source>In IEEE 13th International Working Conference on Source Code Analysis and Manipulation (SCAM)</source>
          ,
          <fpage>116</fpage>
          -
          <lpage>25</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          <string-name>
            <surname>Noeticsunil</surname>
          </string-name>
          .
          <year>2017</year>
          . “Node.js Frameworks:
          <article-title>The 10 Best for Web and Apps Development</article-title>
          .” http://noeticforce.com
          <article-title>/best-nodejsframeworks-for-web-and-app-development.</article-title>
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          <string-name>
            <given-names>S.</given-names>
            <surname>Mirshokraie</surname>
          </string-name>
          ,
          <string-name>
            <surname>A</surname>
          </string-name>
          . Mesbah, in K. Pattabiraman.
          <year>2013</year>
          . “
          <article-title>Efficient JavaScript Mutation Testing</article-title>
          .”
          <source>In Verification and Validation 2013 IEEE Sixth International Conference on Software Testing</source>
          ,
          <fpage>74</fpage>
          -
          <lpage>83</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          <string-name>
            <given-names>S.</given-names>
            <surname>Rostami</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L.</given-names>
            <surname>Eshkevari</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Mazinanian</surname>
          </string-name>
          ,
          <string-name>
            <given-names>N.</given-names>
            <surname>Tsantalis</surname>
          </string-name>
          .
          <year>2016</year>
          . “Detecting Function Constructors in JavaScript.”
          <source>In IEEE International Conference on Software Maintenance and Evolution (ICSME)</source>
          ,
          <fpage>488</fpage>
          -
          <lpage>492</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          <string-name>
            <surname>ValueCoders.</surname>
          </string-name>
          <year>2017</year>
          .
          <article-title>“9 Top JavaScript Frameworks For Mobile App Development.” Valuecoders -Expert Remote Teams for your Web &amp; Mobile Needs</article-title>
          . https://www.valuecoders.com/blog/technology-and
          <article-title>-apps/top-javascript-frameworks-for-mobile-appdevelopment/.</article-title>
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          <string-name>
            <given-names>Y.</given-names>
            <surname>Ko</surname>
          </string-name>
          ,
          <string-name>
            <given-names>H.</given-names>
            <surname>Lee</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Dolby</surname>
          </string-name>
          , in S. Ryu.
          <year>2015</year>
          . “
          <article-title>Practically Tunable Static Analysis Framework for Large-Scale JavaScript Applications</article-title>
          .”
          <source>30th IEEE/ACM International Conference on Automated Software Engineering (ASE)</source>
          :
          <fpage>541</fpage>
          -
          <lpage>51</lpage>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>