SlideShare a Scribd company logo
Global Mutable State
Analysis in Spring MVC
Applications
Formal Methods @ UCF

John L. Singleton
University of Central Florida
The Problem: Global Mutable State
• Web applications make extensive use of a form of Global
Mutable State called “session.”
• The behavior of session closely resembles global variables,
which are widely considered a form of code smell.
• But more importantly, the use of global variables increase
module coupling.

Formal Methods @ UCF
Goal: Investigate Use of Global Mutable
State in Spring-Based Web Applications
• Test Hypothesis:

“The use of global mutable state leads to tighter coupling and
therefore results in lower program reliability.”
• Static Analysis Question:
Which program executions may be influenced by the modification
of a given GMS variable.

Formal Methods @ UCF
Approach: Static Analysis of SpringBased Web Applications
• Since Verily already has support for static checking, the tool
was built within Verily.
• Verily internally leverages ANTLR to handle parsing and AST
building.
• Build data sets for finding problematic uses of GMS and making
specific recommendations about use of GMS in web
applications.

Formal Methods @ UCF
Analysis Method
Our tool performed 4 types of graph analysis:
•
•
•
•

Module
Variable
Behavior (read/write >=0)
Behavior (read/write > 0 – must use the value)

Additionally, we generated plot data for computing metrics we
define in this presentation.
Module Example
• Large Squares represent modules.
• “Points” represent use of a single GMS
variable.

• Multiple arrows leaving a point implies
multiple usages within a module.
• Arrows point to module in which the variable
is modified

Formal Methods @ UCF

Shared Issues Application
Variable Example
• Variable analysis gives more specific
information about the use of variables.
• Line number, module, etc.
• Useful for interpreting the other two types of
behavior analysis.
• These networks are huge and hard to
display in slides.
ELTabique Application

Formal Methods @ UCF
Behavior Example (with single writes)
• Behavior analysis makes it easy to visualize
application GMS behavior.
• Possible to quickly classify the type of
behavior being used for a specific GMS
variable.
• With writes shows variables that are only
written to but never read.

NCLodger Application

Formal Methods @ UCF
Behavior Example (w/o single writes)
• Same type of analysis as other type of
Behavior analysis.
• Excludes GMS variables that are written to
but never used again.

MivProject Application

Formal Methods @ UCF
Results

Formal Methods @ UCF
Network Classification
Analysis revealed several different
types of networks.
• These networks appear to recur
in application designs.
• Each subnetwork represents the
behavior over a GMS variable.

Formal Methods @ UCF
Type 1: Ideal GMS Usage
• The ideal usage of GMS
is such that there exists
exactly one universal
sink in a subgraph.
• Lowest amount of cross
module coupling.
• (Verily’s GMS recipe
enforces this check)

Formal Methods @ UCF
Type 2: Less Ideal GMS Usage
• This type of network has
multiple sinks and
multiple reads within the
network.
• Multiple Reads, Multiple
Writes

Formal Methods @ UCF
Type 3: Least Ideal GMS Usage
• This type of network has
many different write
operations compared to
the number of reads.
• This results in the
highest form of coupling
since it crosses the most
number of modules.
• High Writes, Low Reads

Formal Methods @ UCF
Quantifying GMS Use
We define two sets for analyzing these networks:

Formal Methods @ UCF
Quantifying GMS Use: GMC
We then calculate Global Mutable Coupling as a measure of
GMS use:

Formal Methods @ UCF
Quantifying GMS Use: Network Impact

Formal Methods @ UCF
Example: The Ideal Case
• For both networks, GMC = 1 and are therefore
ideal.
• Note that we don’t consider more “readers” to
increase the value of GMC.

Formal Methods @ UCF
Example: Less Ideal Cases
• GMC = 16, which shows a high degree of
coupling impact.
• Modifications in 4 different program points
influence the network in two difference places.

Formal Methods @ UCF
Example: Less Ideal Cases
• GMC = 49, which shows a very high degree of
coupling impact.
• This application is coupled across 7 possible
modules.

Formal Methods @ UCF
Case Studies

Formal Methods @ UCF
Source Data
To inform our analysis, we randomly pulled projects off of Github that made use
of Spring MVC and Global Mutable State

There are approximately 184,000 such projects available for analysis.

Our analysis was based on the following projects:
•
•
•
•
•

MivProject
TwitterApp
SharedIssues
NCLodger
EITabique

Formal Methods @ UCF
GMS Analysis: MivProject
Read/Write + Network Size
(GMI Value Inside Circle)
5
4.5
4

[CELLRANGE]

3.5

Reads

3
2.5
2

[CELLRANGE]

[CELLRANGE] [CELLRANGE]

1
[CELLRANGE] [CELLRANGE]

[CELLRANGE] [CELLRANGE]

1.5
[CELLRANGE]

0.5
0
-2

-1

0

1

2

3

4

Writes

Formal Methods @ UCF

5

6

7

8

9
GMS Analysis: MivProject

Formal Methods @ UCF
GMS Analysis: SOEN387
Read/Write + Network Size
(GMI Value Inside Circle)
14

12

[CELLRANGE]

10

Reads

8

[CELLRANGE]
[CELLRANGE]

6

[CELLRANGE]

4

2
[CELLRANGE]

0
-2

-1

0

1

2

3

4

Writes

Formal Methods @ UCF

5

6

7

8

9
GMS Analysis: SOEN387

Formal Methods @ UCF
Other Findings

Formal Methods @ UCF
Many Usages of GMS are to Deliver
Information to Other Tiers

Formal Methods @ UCF
The Use of Session in Web Applications
Can Be Quite Complex

Formal Methods @ UCF
And Even Beautiful…

Formal Methods @ UCF
Thank You
• To learn more about Verily:
• http://goverily.org

• More about Formal Methods @ UCF:
• http://www.eecs.ucf.edu/~leavens/formal-methods-lab/

Formal Methods @ UCF

More Related Content

PPTX
Beyond Strong Consistency
ODP
Consistency in Distributed Systems
PDF
Consistency in Distributed Systems, Part 2
PPT
CAP, PACELC, and Determinism
PDF
Lightning talk: highly scalable databases and the PACELC theorem
PPTX
Varshneya samdarshi lmu_symposium_2016
PPTX
Anguiano varshneya lmu_symposium_2015
PPTX
Southwick anguiano lmu-symposium_presentation_20140329
Beyond Strong Consistency
Consistency in Distributed Systems
Consistency in Distributed Systems, Part 2
CAP, PACELC, and Determinism
Lightning talk: highly scalable databases and the PACELC theorem
Varshneya samdarshi lmu_symposium_2016
Anguiano varshneya lmu_symposium_2015
Southwick anguiano lmu-symposium_presentation_20140329

What's hot (10)

DOCX
Process synchronization
PPTX
Reactiveness All The Way - SW Architecture 2015 Conference
PPTX
Southwick britain gr_nsight_cmsi402-presentation_20140508
PPTX
Dahlquist so calsysbio_20140131
PPTX
Real time operating systems (rtos) concepts 7
PDF
Email2git: Extending cregit to Link Review Emails to Commits
PDF
API Performance testing with Gatling
PDF
Abstract
PDF
Beyond Fault Tolerance with Actor Programming
PDF
Clonal Plasticity & Operator Placement
Process synchronization
Reactiveness All The Way - SW Architecture 2015 Conference
Southwick britain gr_nsight_cmsi402-presentation_20140508
Dahlquist so calsysbio_20140131
Real time operating systems (rtos) concepts 7
Email2git: Extending cregit to Link Review Emails to Commits
API Performance testing with Gatling
Abstract
Beyond Fault Tolerance with Actor Programming
Clonal Plasticity & Operator Placement
Ad

Similar to Global Mutable State Analysis in Spring MVC Applications (14)

PDF
4 (uml basic)
PDF
SP1: Exploratory Network Analysis with Gephi
PPTX
FAIR Computational Workflows
PDF
Introduction à Scala - Michel Schinz - January 2010
PDF
Gephi icwsm-tutorial
PDF
Study and development of methods and tools for testing, validation and verif...
PDF
Quality Assurance. Quality Assurance Approach. White Box
PPTX
Financial Networks IV. Analyzing and Visualizing Exposures
PPTX
Enso presented at Microsoft Research/CSW summer 2012
PDF
Quantitative functional change impact analysis in activity diagrams a cosmi...
PPTX
The Use of Static Code Analysis When Teaching or Developing Open-Source Software
PDF
Funtional Reactive Programming with Examples in Scala + GWT
PPTX
Uml
PPTX
Uml
4 (uml basic)
SP1: Exploratory Network Analysis with Gephi
FAIR Computational Workflows
Introduction à Scala - Michel Schinz - January 2010
Gephi icwsm-tutorial
Study and development of methods and tools for testing, validation and verif...
Quality Assurance. Quality Assurance Approach. White Box
Financial Networks IV. Analyzing and Visualizing Exposures
Enso presented at Microsoft Research/CSW summer 2012
Quantitative functional change impact analysis in activity diagrams a cosmi...
The Use of Static Code Analysis When Teaching or Developing Open-Source Software
Funtional Reactive Programming with Examples in Scala + GWT
Uml
Uml
Ad

Recently uploaded (20)

PPTX
MYSQL Presentation for SQL database connectivity
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
Encapsulation theory and applications.pdf
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Approach and Philosophy of On baking technology
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Electronic commerce courselecture one. Pdf
PDF
Empathic Computing: Creating Shared Understanding
PDF
A comparative analysis of optical character recognition models for extracting...
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PPTX
Big Data Technologies - Introduction.pptx
PPTX
Cloud computing and distributed systems.
DOCX
The AUB Centre for AI in Media Proposal.docx
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Machine learning based COVID-19 study performance prediction
MYSQL Presentation for SQL database connectivity
NewMind AI Weekly Chronicles - August'25-Week II
Encapsulation theory and applications.pdf
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Spectral efficient network and resource selection model in 5G networks
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Approach and Philosophy of On baking technology
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Electronic commerce courselecture one. Pdf
Empathic Computing: Creating Shared Understanding
A comparative analysis of optical character recognition models for extracting...
Network Security Unit 5.pdf for BCA BBA.
Assigned Numbers - 2025 - Bluetooth® Document
Big Data Technologies - Introduction.pptx
Cloud computing and distributed systems.
The AUB Centre for AI in Media Proposal.docx
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
gpt5_lecture_notes_comprehensive_20250812015547.pdf
Dropbox Q2 2025 Financial Results & Investor Presentation
Machine learning based COVID-19 study performance prediction

Global Mutable State Analysis in Spring MVC Applications

  • 1. Global Mutable State Analysis in Spring MVC Applications Formal Methods @ UCF John L. Singleton University of Central Florida
  • 2. The Problem: Global Mutable State • Web applications make extensive use of a form of Global Mutable State called “session.” • The behavior of session closely resembles global variables, which are widely considered a form of code smell. • But more importantly, the use of global variables increase module coupling. Formal Methods @ UCF
  • 3. Goal: Investigate Use of Global Mutable State in Spring-Based Web Applications • Test Hypothesis: “The use of global mutable state leads to tighter coupling and therefore results in lower program reliability.” • Static Analysis Question: Which program executions may be influenced by the modification of a given GMS variable. Formal Methods @ UCF
  • 4. Approach: Static Analysis of SpringBased Web Applications • Since Verily already has support for static checking, the tool was built within Verily. • Verily internally leverages ANTLR to handle parsing and AST building. • Build data sets for finding problematic uses of GMS and making specific recommendations about use of GMS in web applications. Formal Methods @ UCF
  • 5. Analysis Method Our tool performed 4 types of graph analysis: • • • • Module Variable Behavior (read/write >=0) Behavior (read/write > 0 – must use the value) Additionally, we generated plot data for computing metrics we define in this presentation.
  • 6. Module Example • Large Squares represent modules. • “Points” represent use of a single GMS variable. • Multiple arrows leaving a point implies multiple usages within a module. • Arrows point to module in which the variable is modified Formal Methods @ UCF Shared Issues Application
  • 7. Variable Example • Variable analysis gives more specific information about the use of variables. • Line number, module, etc. • Useful for interpreting the other two types of behavior analysis. • These networks are huge and hard to display in slides. ELTabique Application Formal Methods @ UCF
  • 8. Behavior Example (with single writes) • Behavior analysis makes it easy to visualize application GMS behavior. • Possible to quickly classify the type of behavior being used for a specific GMS variable. • With writes shows variables that are only written to but never read. NCLodger Application Formal Methods @ UCF
  • 9. Behavior Example (w/o single writes) • Same type of analysis as other type of Behavior analysis. • Excludes GMS variables that are written to but never used again. MivProject Application Formal Methods @ UCF
  • 11. Network Classification Analysis revealed several different types of networks. • These networks appear to recur in application designs. • Each subnetwork represents the behavior over a GMS variable. Formal Methods @ UCF
  • 12. Type 1: Ideal GMS Usage • The ideal usage of GMS is such that there exists exactly one universal sink in a subgraph. • Lowest amount of cross module coupling. • (Verily’s GMS recipe enforces this check) Formal Methods @ UCF
  • 13. Type 2: Less Ideal GMS Usage • This type of network has multiple sinks and multiple reads within the network. • Multiple Reads, Multiple Writes Formal Methods @ UCF
  • 14. Type 3: Least Ideal GMS Usage • This type of network has many different write operations compared to the number of reads. • This results in the highest form of coupling since it crosses the most number of modules. • High Writes, Low Reads Formal Methods @ UCF
  • 15. Quantifying GMS Use We define two sets for analyzing these networks: Formal Methods @ UCF
  • 16. Quantifying GMS Use: GMC We then calculate Global Mutable Coupling as a measure of GMS use: Formal Methods @ UCF
  • 17. Quantifying GMS Use: Network Impact Formal Methods @ UCF
  • 18. Example: The Ideal Case • For both networks, GMC = 1 and are therefore ideal. • Note that we don’t consider more “readers” to increase the value of GMC. Formal Methods @ UCF
  • 19. Example: Less Ideal Cases • GMC = 16, which shows a high degree of coupling impact. • Modifications in 4 different program points influence the network in two difference places. Formal Methods @ UCF
  • 20. Example: Less Ideal Cases • GMC = 49, which shows a very high degree of coupling impact. • This application is coupled across 7 possible modules. Formal Methods @ UCF
  • 22. Source Data To inform our analysis, we randomly pulled projects off of Github that made use of Spring MVC and Global Mutable State There are approximately 184,000 such projects available for analysis. Our analysis was based on the following projects: • • • • • MivProject TwitterApp SharedIssues NCLodger EITabique Formal Methods @ UCF
  • 23. GMS Analysis: MivProject Read/Write + Network Size (GMI Value Inside Circle) 5 4.5 4 [CELLRANGE] 3.5 Reads 3 2.5 2 [CELLRANGE] [CELLRANGE] [CELLRANGE] 1 [CELLRANGE] [CELLRANGE] [CELLRANGE] [CELLRANGE] 1.5 [CELLRANGE] 0.5 0 -2 -1 0 1 2 3 4 Writes Formal Methods @ UCF 5 6 7 8 9
  • 25. GMS Analysis: SOEN387 Read/Write + Network Size (GMI Value Inside Circle) 14 12 [CELLRANGE] 10 Reads 8 [CELLRANGE] [CELLRANGE] 6 [CELLRANGE] 4 2 [CELLRANGE] 0 -2 -1 0 1 2 3 4 Writes Formal Methods @ UCF 5 6 7 8 9
  • 28. Many Usages of GMS are to Deliver Information to Other Tiers Formal Methods @ UCF
  • 29. The Use of Session in Web Applications Can Be Quite Complex Formal Methods @ UCF
  • 31. Thank You • To learn more about Verily: • http://goverily.org • More about Formal Methods @ UCF: • http://www.eecs.ucf.edu/~leavens/formal-methods-lab/ Formal Methods @ UCF