Comment Extractor

21
Comment Extractor Ethan Chan Tianqiu Tem Wang Juliana Wong

description

Comment Extractor. Ethan Chan Tianqiu Tem Wang Juliana Wong. Introduction (1). What do high level software tools provide? abstract level understanding specific knowledge focus After using these tools, programmers eventually have to touch source code. Abstract Level. Text Level. - PowerPoint PPT Presentation

Transcript of Comment Extractor

Page 1: Comment Extractor

Comment Extractor

Ethan ChanTianqiu Tem WangJuliana Wong

Page 2: Comment Extractor

2

Introduction (1)What do high level software tools provide?

abstract level understanding

specific knowledge

focus

After using these tools, programmers eventually have to touch source code

Abstract Level

Text Level

Page 3: Comment Extractor

3

Introduction (2)

Comment explanatory text embedded in program source

helps human readers understand program source code

the most useful thing at code level

Page 4: Comment Extractor

4

Motivation (1)Comments are localized

Expression of interest

Expression declaration

Comments associated with expression

Comments relating to the expression are found only in one place

The same expression used elsewhere

Page 5: Comment Extractor

5

Motivation (2)Searching for comments

is a tedious job

interrupts original work flow

Page 6: Comment Extractor

6

Motivation (3)Sometimes Expression of interest is far away

Expression of interest

Expression Declaration

Comments associated with Expression

Possibly a gap of

a lot of files!

Page 7: Comment Extractor

7

Motivation (4)Examples:

Grep

too many incorrect results

Javadoc

format must be specific

needs to know belonging class

More in DEMO later on…

Page 8: Comment Extractor

8

Claim

Programmers shouldn’tstop the workflowdo any extra work to find comments.

Need a tooldeals with these problems extracts comments automatically.

Page 9: Comment Extractor

9

Solution

Comment Extractor A plug-in for JEdit (an open source java editor)

Extracts comments from 4 types of CO

Returns comments by Intelli-Selection

user’s selection

cursor’s location

Page 10: Comment Extractor

10

What the icons mean

Variable comment

Type comment

Java predefined type comment

Function comment

No comment

Page 11: Comment Extractor

11

DEMO – Introduction to the GUI

This is the first level. Each level always shows the respective type and variable comments

This is the class (for members) or return type (for methods)

This is the detailed view pane for the selected comment above

This is the second level, showing comments relating to function openPrintWriter()

Allow going back and forth with various comment trees

Freezes comment extraction

The selected express that is of interest

Page 12: Comment Extractor

12

DEMO

Page 13: Comment Extractor

13

DEMO – Complex process finding comments from Inherited ClassesNeed to knowwhich classhas isInt()’scomment

Type

BasicType

IntType BooleanType

PointerType ….

isInt() isReal()

isInt() isReal() isInt() isReal()

isInt() isReal()isInt() isReal()

….

Page 14: Comment Extractor

14

Where is m?170 lines up, we find it’s declaration

Where is Machine class?

1 out of 61 files, we find it’s declaration

Where is method emitLoad?200 lines down, we find two overloaded declarations

Which emitLoad method is correct?Need to know what parameter (sto, tmp) types are!

Give up?

DEMO – Finding outthe usual way

Page 15: Comment Extractor

15

Where is m?170 lines up, we find it’s declaration

Open JavaDoc on Machine class

Find emitLoad documentationNeed to know what parameter (sto, tmp) types are!

Not all comments are JavaDoc style, so are not seen!

DEMO – Finding outthe JavaDoc way

Page 16: Comment Extractor

16

DEMO – Finding outthe grep way

Assuming there are few uses of the text “emitLoad”, where is emitLoad?

Need to weed out emitLoad declarationsMuch faster, only because not repeated declaration

Still need to know which overloaded method (still need to find out sto and tmp!)

Still need to open files and read commentsHard to go back to original position if not created in separate process

Page 17: Comment Extractor

17

DEMO – Finding outthe Comment Extractor way

Page 18: Comment Extractor

18

LimitationsThis tool won’t be helpful if

No comments

Bad comments

Comments not associated with a CO

a plugin currently only for JEdit

works only for Java

While loop

Page 19: Comment Extractor

19

Lessons Learned (1)

Didn’t have CE to develop CE difficult to understand JEdit’s massive source code

Unintentional benefits i.e. warping files

Page 20: Comment Extractor

20

Lessons Learned (2)Modular design allowed easy integration of unanticipated changes

User Interaction (GUI)

Functionality

Comment Extractor

Comment Hunter Location Searcher

JEdit

GUI

JEdit plugin interface

Page 21: Comment Extractor

21

Any comments? (no pun intended)

We’ll help you extract it!

Comment Extractor