Change search
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
Diverge - Investigating the Consequences of Bad Comments
KTH, School of Electrical Engineering and Computer Science (EECS).
KTH, School of Electrical Engineering and Computer Science (EECS).
2019 (English)Independent thesis Basic level (degree of Bachelor), 10 credits / 15 HE creditsStudent thesisAlternative title
När kommentarer och kod divergerar - konsekvenser av dåliga kodkommentarer (Swedish)
Abstract [en]

In large software development projects the majority of code comments are written at the beginning of the project and tend to not be updated when the code is rewritten. This commonly results in code with incorrect comments or no comments at all. This study intends to answer whether incorrect comments can mislead programmers and if well written comments assist programmers ininterpreting new code. Furthermore, the attitudes towards code comments are investigated. The research questions were answered with data from forms andc ode tests run on 35 engineering students. For the code tests eye trackers were used to provide a clear picture of how much the participants read the code and the associated comments. A majority of the test subjects agreed that comments are important whilst 8% considered comments to be unnecessary. 50% of the test subjects expressed positive feelings towards writing comments. The data from the eyetracker showed that the test subjects read comments and code equally. Thes tudy found that incorrect comments in many cases lead to misconceptions. Correct comments were shown to assist the programmer if the code contained library functions that the programmer was not familiar with. Regarding correct comments versus no comments at all there was no difference in readability if the code did not contain any library functions.

Abstract [sv]

I stora mjukvaruprojekt skrivs majoriteten av kodkommentarerna i början av projektets livscykel och tenderar att med tiden att sluta uppdateras när koden skrivs om. Detta kan resultera i såväl okommenterad kod som felaktiga kommentarer. Denna studie avser att besvara frågeställningen om huruvida felaktiga kommentarer kan leda till att programmerare missförstår koden samt om korrekta kommentarer kan assistera programmerare vid tolkning av skriven kod. Vidare undersöktes attityder kring kodkommentarer. Frågeställningarna besvarades med data från formulär och kodtester utförda på 35 ingenjörsstudenter. Vid kodtesterna användes eye trackers för att skapa en tydlig bild av i vilken utsträckning testpersonerna läste koden och kommentarerna.

En majoritet av deltagarna ansåg att kodkommentarer är viktiga, 8% ansåg kommentarer vara oviktiga och resten ställde sig neutrala. 50% av deltagarna uttryckte positiva känslor till att skriva kommentarer. Från eye trackern kunde det påvisas att deltagarna läste kommentarer i liknande utsträckning som de läste kod. Studien fann att felaktiga kommentarer i många fall leder till missförstånd. Korrekta kommentarer visades vara till hjälp då programmerare stötte på biblioteksfunktioner de inte var bekanta med. Det var däremot ingen skillnad mellan korrekta kommentarer och inga kommentarer för de kodexempel som ej innehöll biblioteksfunktioner.

Place, publisher, year, edition, pages
2019.
Series
TRITA-EECS-EX ; 2019:322
National Category
Computer and Information Sciences
Identifiers
URN: urn:nbn:se:kth:diva-255047OAI: oai:DiVA.org:kth-255047DiVA, id: diva2:1337809
Subject / course
Computer and Systems Sciences
Supervisors
Examiners
Available from: 2019-07-29 Created: 2019-07-17 Last updated: 2019-07-29Bibliographically approved

Open Access in DiVA

fulltext(1954 kB)15 downloads
File information
File name FULLTEXT01.pdfFile size 1954 kBChecksum SHA-512
ad8ab47589c2a442b51766b6c5d53bbc2c0f5259c642379738989205bf7cf6efadc3d9ba8868b685b1ef68eecb3031524bb4d51084739300e80b9dd8ba9ceca6
Type fulltextMimetype application/pdf

By organisation
School of Electrical Engineering and Computer Science (EECS)
Computer and Information Sciences

Search outside of DiVA

GoogleGoogle Scholar
Total: 15 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: 68 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