CiteExportLink to record
Permanent link

Direct link
Cite
Citation style
  • apa
  • ieee
  • modern-language-association-8th-edition
  • vancouver
  • Other style
More styles
Language
  • de-DE
  • en-GB
  • en-US
  • fi-FI
  • nn-NO
  • nn-NB
  • sv-SE
  • Other locale
More languages
Output format
  • html
  • text
  • asciidoc
  • rtf
Code analysis: Uncovering hidden problems in a codebase by commits to a version control system
Jönköping University, School of Engineering, JTH, Computer Science and Informatics.
Jönköping University, School of Engineering, JTH, Computer Science and Informatics.
2019 (English)Independent thesis Basic level (degree of Bachelor), 10 credits / 15 HE creditsStudent thesisAlternative title
Kod analys : Avslöja gömda problem i en kodbas med commits till ett versionhanteringssystem (Swedish)
Abstract [sv]

Syfte – Startpunkten för den här studien var att identifiera effektiva och ineffektiva delar av en kodbas som kan leda till förbättringar av koden. Detta utfördes på förfrågan av ett företag. För att stödja begärandet utnyttjades en bok av författaren Adam Tornhill. Han diskuterar flera metoder (också kallade analysmetoder) som används för att lokalisera och analysera platser i kod där effektivitet och ineffektivitet föreligger. De använder alla diverse variabler för det här syftet. En webbapplikation utvecklades för att upptäcka den här varianten av kod med hjälp av dessa variabler. Det spekulerades att det kan saknas samband mellan variablerna som kan upptäckas. Detta skulle ge mer insikt i hur verksam och overksam kod kan urskiljas och evalueras, utöver den insikt Adam Tornhills metoder understöder.

Det vetenskapliga syftet och bidraget var därför att särskilja potentiella korrelationer mellan analysmetoderna. En frågeställning härleddes från detta syfte:

● Finns det korrelation hos variabler bland befintliga analysmetoder och i sådant fall, vilka är det?

Metod – För att svara på frågeställningen var en noggrannare granskning av variablerna nödvändig för att utvärdera vilka som hade potentiella relationer. Efter det hämtades kvantitativa data av de valda variablerna från 7 open source projekter. Data erhölls från git commit historik från 2 år tillbaka. Informationen presenteras i form av grafer som examinerades för mönster och kontext bland de analysmetoder som var i fokus. Statistiska formler (som Pearsons korrelationskoefficient) utnyttjades i syfte att beräkna exakt korrelation för variablerna. Signifikansnivå sattes på 0,001 och ett p-värde kalkylerades. För de projekt med p-värde mindre än signifikansnivå beräknades även ett median och medelvärde med  deras olika korrelationskoefficienten.

Resultat – I slutet påträffades två stycken variabler som undersöktes genom grafer för samband. Utredningen visade ett tydligt mönster som indikerar att när fler personer arbetar på en fil kommer också antalet logiska kopplingar att öka för korresponderande fil. För de olika korrelationsvärden visade det sig att 6 av de 7 projekten hade ett p-värde mindre än den satta signifikansnivån 0,001 som innebär att 6 koefficienter är mycket statistiskt signifikanta. Det var bara för 5 av de 6 projekten med godkänd signifikans som positiv korrelation uppmättes. Medelvärdet för de 6 projekten med p-värde mindre än signifikansnivån var 0.41 och medianvärdet 0.63 vilket indikerar en positiv korrelation mellan antal författare och logiska kopplingar

Implikationer – I projekt där många personer jobbar på en fil borde försiktighetsåtgärder erfordras med avseende till logiska kopplingar. Vissa förhindrande medel kanske kan etableras för att vägleda andra att minska, eller i alla fall inte onödigt ackumulera, logiska kopplingar när åtskilliga personer inträder på en fil.

Begränsningar – Bara två analysmetoder och deras två variabler undersöktes för korrelation och det kan finnas fler variabler som kan ha korrelation. De 7 projekten som det utvanns data från var alla från open source och därför kanske inte resultatet stämmer för closed source projekt.

Abstract [en]

Purpose – The starting point of this study was to locate efficient and inefficient code in a codebase to improve upon it, as a request from a company. To help with their request a book was used by author Adam Tornhill who has made several methods (also called analysis methods) for this purpose. They all use different variables that locate problems in the code. A web application was developed to use these variables. It was speculated that relationships between the variables may be missing which could improve the analysis methods and in turn uncover efficient and inefficient code better.

The main scientific purpose and contribution was therefore to discover associations between the specific variables presented by Adam Tornhill. A question derived from this purpose:  

● Are there correlations with variables among existing analysis methods and in that case, what are they?

Method – To answer the question posed, a closer look on the variables was needed to see which ones had a potential connection. After that empirical data of the chosen variables was gathered in the form of quantitative data from 7 open source projects from two years back. This was done by fetching commits from git, called commit history, and presenting the data in a suitable way in form of graphs. In the end the graphs were reviewed to detect possible patterns and then statistical formulas (Pearson's correlation coefficient) were used to calculate the exact correlation between the variables. A significance level was set at 0,001 and then p-value calculated. Median and mean value of the correlation coefficients of projects with p-value less than the significance level were also calculated.

Findings – Two variables were inspected in the end, number of authors and number of logical couplings for the same file, and were made into a new analysis method with a graph. Through the graph analysis the methods seem to vary together. The graph shows a clear pattern that as more people work a module the more logical couplings will increase. For 6 out of 7 of the projects analyzed, the p-value was less than the significance level set from the beginning, meaning 6 coefficients were highly statistically significant. It was only for five out of these 6 that a positive coefficient was calculated. For the 6 projects with p-value less than significance the mean correlation coefficient was 0.41 and median 0.63, which both indicate a positive correlation between number of authors and number of logical couplings.

Implications – Projects that have several people working on a module should watch out for logical couplings on that same module. Perhaps preventative measures can be made to ensure that people watch out for these logical couplings as more people start working on a module. Limitations – Only two analysis methods and their variables were inspected for further determination of a correlation, and there could be more correlations that are missing. Furthermore, the 7 projects that were used as data were open source and therefore the result from this study may not be the same as for closed source projects.

Place, publisher, year, edition, pages
2019. , p. 45
Keywords [en]
Hotspots, correlations, Sum of Coupling, Authors, Adam Tornhill.
Keywords [sv]
Hotspots, korrelationer, Sum Of Coupling, Authors, Adam Tornhill.
National Category
Computer Systems
Identifiers
URN: urn:nbn:se:hj:diva-42716ISRN: JU-JTH-DTA-1-20190065OAI: oai:DiVA.org:hj-42716DiVA, id: diva2:1281823
External cooperation
Divid AB
Subject / course
JTH, Computer Engineering
Supervisors
Examiners
Available from: 2019-01-25 Created: 2019-01-23 Last updated: 2019-01-25Bibliographically approved

Open Access in DiVA

Kod analys(1963 kB)355 downloads
File information
File name FULLTEXT01.pdfFile size 1963 kBChecksum SHA-512
6023c70b63286ea0a0af1bc71115c7c9aa67ada7b63c2ac6282af3080d99b04ef18ba6c2f6e80754ba6610dc05d371359c18d857fa3a60e8946dba3b5c3a69d2
Type fulltextMimetype application/pdf

Search in DiVA

By author/editor
Reijo, KenKåhre, Martin
By organisation
JTH, Computer Science and Informatics
Computer Systems

Search outside of DiVA

GoogleGoogle Scholar
Total: 355 downloads
The number of downloads is the sum of all downloads of full texts. It may include eg previous versions that are now no longer available

urn-nbn

Altmetric score

urn-nbn
Total: 595 hits
CiteExportLink to record
Permanent link

Direct link
Cite
Citation style
  • apa
  • ieee
  • modern-language-association-8th-edition
  • vancouver
  • Other style
More styles
Language
  • de-DE
  • en-GB
  • en-US
  • fi-FI
  • nn-NO
  • nn-NB
  • sv-SE
  • Other locale
More languages
Output format
  • html
  • text
  • asciidoc
  • rtf