Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I am currently writing my Master's Thesis on maintainability of a web application. I found some methods like the "Maintainability Index" by Coleman et.al. or the "Software Maintainability Index" by Muthanna et.al. For both of them one needs to calculate the cyclomatic complexity. So my question is:

Is it possible to measure the cyclomatic complexity of a web application?

In my opinion there are three parts to a web application:

  1. Server code (PHP, C#, Python, Perl, etc.)
  2. Client code (JavaScript)
  3. HTML (links and forms as operators, GET-parameters and form fields as operands!?)

What do you think? Is there another point of view on the complexity of web application? Did I miss something?

share|improve this question
1  
CSS. JSON or XML (for AJAX communication between client and server) –  James McLeod Sep 12 '12 at 10:43
6  
What about data access and database structure and code (stored procedures)? –  Oded Sep 12 '12 at 10:47
    
@James McLeod So in CSS what would be operators and what would be operands? JSON and XML are probably operands for client and server functions, or what do you think? –  Dominik G Sep 12 '12 at 10:48
    
Yes for CSS, isn't the JSON/XML is dynamically generated by the JavaScript? How would that be measured? Similarly, would you measure what's stored in the DB? –  StuperUser Sep 12 '12 at 10:48
    
Database would be a good point I totally forgot about. –  Dominik G Sep 12 '12 at 10:49

1 Answer 1

Cyclomatic complexity is one of the multiple measurements of code complexity. For example, in Visual Studio, the maintainability index depends on:

  • Cyclomatic complexity,
  • Depth of inheritance,
  • Class coupling,
  • Lines of IL code (IL code being the source code compiled to Intermediary Language which is then JIT-compiled).

Every of those measurements, as well as other complexity measurements, work somehow, but are never the absolute indication that the source code has complexity issues. Some measurements, as LOC, are known to be totally meaningless and misleading; others, like cyclomatic complexity, are slightly better, but still have issues.

This is due to the fact that:

  • It is too complicated for a computer program to know how really complex the source code would be perceived by a developer.

    For example, I often noticed a huge drop of maintainability index when refactoring the code from procedural-style to functional-style through LINQ, transforming a block of highly unreadable source code into a single chaining expression which was extremely explicit.

    Another example would be the reflection of programming patterns on the metrics. Often, by introducing programming patterns into your code, you will make it less complex for a developer (assuming this developer is familiar with those patterns), but the maintainability index will drop.

  • Source code can have different forms.

    Measuring cyclomatic complexity or depth of inheritance or class coupling is very limited for a web application, because, as you said, the existence of HTML/CSS, JavaScript, etc., and, as noted in the comments, the existence of database access.

    This limitation doesn't exist only for web apps. In desktop applications, for example, what about the complexity of the UI layout (XAML code in Windows applications)? What about the generated code? Or database access?

share|improve this answer
    
I know that no model is complete nor is any of the models I found wrong, but still they can give hints. I am just curious about how GUI and seperate client and server code can be measured. I also use the AFOTEC survey to get some subjective values. –  Dominik G Sep 12 '12 at 12:13

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.