linecnt
TRANSCRIPT
-
8/3/2019 LineCnt
1/14
SOFTWARE DEVELOPMENT PROJECT
Count of Lines in a File
Report By: SANDHYA KOMMINENI
Course: Software Engineering, 3526, E204
Project Dates: 1/13/2011-2/1/2011
Date Submitted: 2/1/2011
-
8/3/2019 LineCnt
2/14
Document1
May 1, 2012 Page 1 of 13
INTRODUCTION
Purpose: The purpose of the project is to open the file, count thenumber of lines in that file and count the number of commented
lines.
Mission : The mission of the project is to count the number of linesin any file.
Vision : The vision statement of the project is to count the number ofcommented lines and count the number of valid lines in a file.
SOFTWARE DEVELOPMENT PROCESS
For project I, I followed the conventional model for development of each project.
The conventional model I followed has the following phases or layers:
Planning Phase Designing Phase Coding Phase Testing Phase Post Mortem Phase
-
8/3/2019 LineCnt
3/14
Document1
May 1, 2012 Page 2 of 13
PLANNING PHASE
In the planning phase, I broke the phase into a number of divisions.
1) First Division: Write down, understand and specify the requirements.2) Second Division: Estimate the time for the process.
3) Third Division: Schedule my time as per estimation.
1) First Division
In this division, I figured out the requirements for the process, and recorded
the important requirements and specified the requirements. I looked at the
requirements and figured out does the requirements have the same specifications
components used in any of the previous process and recorded it.
2) Second DivisionIn this division, I estimated the time required by each specified requirement
and then, I estimated the time required by the process by adding up all the
estimation time for each requirement specified with risk involved with the process.
3) Third Division
In this division, I scheduled my time based on the estimated time, and
allocated the module or phase to be finished in the allocated time.
For Project:I specified the way the project to be implemented and estimated the time for
each requirement specified, e.g. implementation as countLines should be a method
and should be called by the main program. I estimated the time for developing the
main method and for countLines method. I evaluated the estimation time required
for the project by adding all the estimation time for each requirement. Then
scheduled my time based on the estimation and defined all the phases or modules
to be finished in the specified time.
-
8/3/2019 LineCnt
4/14
Document1
May 1, 2012 Page 3 of 13
Estimates/Plans
To develop this application, coding is planned to be done using
JAVA. This will generate an executable file which will display the output of the
application. The total time and program size estimated for this project is shown in
the table below.
Initial Project Time and Program Size Estimates
The initial project plan is as follows:
Description Time1) Initial Plan and Estimates 1 Day
2) Requirements 2-4 Day3) High Level Design 5-7 Days
4) Detailed Design 8-10 Days
5) Coding, Implementation and Testing 10-15 Days6) Complete Project 2 1/2 Weeks
REQUIREMENTS
Allow user to enter the file name.
Detect and report the number of line of code or the error message.
User Interface:
Display a message to enter the file name and allow user to enter the file name.
Estimated:
Time 40 Hours
Size 60 LOC
-
8/3/2019 LineCnt
5/14
Document1
May 1, 2012 Page 4 of 13
Usecase Diagram
Use Case Diagram
User
Enter File Name(s) or A Directory
Print File Name
Print Number of Lines in a file
Print Number of commented lines i
n a file
Program
Print Number of Valid Lines
-
8/3/2019 LineCnt
6/14
Document1
May 1, 2012 Page 5 of 13
DESIGN PHASE
I divided this phase in three parts:
1) Analysis2) High Level Design
3) Detail Design
1) Analysis
Here, I made the checklist of requirements for the development side. I
translated the user requirements to the development requirements.
2) High Level DesignI created the high level view of the each project.
3) Detail Design
I decomposed the High level design into smaller components which helped
in developing the code and also in estimating the lines of code the project will
have.
For Project:
In the analysis phase, I translated the requirement of countlines method that
is, it should count those lines which are not commented or non-blocked
commented. For e.g., the main method calling the countlines method, countlines
method returning the number of lines in a file or a directory, and countlines method
taking the parameters mentioned in requirements. In the High level design, I used
the data flow diagram, e.g., I created a data diagram called Main method, accept
the input from user and displays appropriate answer. In the detail design, I
decomposed the Main method into smaller components called countlines method.
After decomposing the high level design I estimated the lines of
code, based on the detail design, number of loops, branch statements and
past experience.
-
8/3/2019 LineCnt
7/14
Document1
May 1, 2012 Page 6 of 13
Context Diagram
UserUser File Scanning File()Display(# of lines in file)
High Level Diagram
+filesList()+countLines()
LineCount
LineCountfilesList
filenames
countLines
countLines
-
8/3/2019 LineCnt
8/14
Document1
May 1, 2012 Page 7 of 13
CODING PHASE
I divided the coding into two sequential steps:
1) Writing the code
2) Testing the written code
1) Writing the Code
I implemented the task or the method defined in the detail design. I coded
one method by another, e.g., I implemented the main method and then declared all
necessary function stubs with the return value.
2) Testing the written Code
After finishing the task or the part of the module, I tested the code with
different values to find out errors or defects in the coding. Recorded the defect or
error caused, errors or defects belongs to which phase, and correcting the defects or
errors.
For project:I implemented the LineCount project with the main method and with the
declaration of the countLines method with a return value. After implementing the
main method, I tested the main method, i.e., entered filename or a directory, if it is
a valid file then opens file or display the appropriate message. Then I implemented
the countLines method and declared the necessary methods. After each of the
method is coded I tested them with various values.
-
8/3/2019 LineCnt
9/14
Document1
May 1, 2012 Page 8 of 13
IMPLEMENTATION
In Implementation, I define the coding standards in java. In the
below table, I mentioned few of the standards in java like rules for naming,
Identifier type, and examples.
IDENTIFIERTYPE
RULES FOR NAMING EXAMPLES
ClassesClasses start with first letter
capitalized.
class LineCount;
class Add;
MethodsMethods should be verbs with the
first letter lower case.
countLines();
filesList();
VariablesLocal, instance and class variables
with the first letter lower case.
string str;
int count;
Constants
Constants should be written inuppercase characters separated by
underscores. Constant names may
also contain digits if appropriate,
but not as the first character.
final static int
MAXIMUM_NUM_OF_PARTIC
ANTS=10;
-
8/3/2019 LineCnt
10/14
Document1
May 1, 2012 Page 9 of 13
TESTING PHASE
I divided this phase into two parts:
1) Designing the test cases based on high level design and detail design.
2) Testing the test cases and recording it.
1) Design the test cases
I designed the test cases based on the high level design, detail design, and
requirements. I created a chart which includes the test case name, expected
outcome, observed outcome and result of the test case. This chart helped me tocheck the code for verifying the correction of project and the created project is
correct.
2) Testing the test cases
I tested the code parts with the test cases designed and recorded the outcome
of the tests. This helped me in knowing the errors or defects in the project and in
maintaining the defect log for the errors and defects in the design part.
For project:I designed the test cases from the top level to low level, i.e., high level
design to detail design, and tested the code. For example, for high level,
Is the project accepting the valid filename and reporting the messageaccordingly?
Is the main method calling the countLines method with the specifiedparameter defined?
For detail design, Is the loop in countLines executed till the end of file is reached? Is the method in countLines is called as designed in the detail design phase?
Testing, verification and validation establishes a comprehensive plan to
communicate the nature and extent of testing necessary for a thorough
evaluation of the system. The Following shows the test cases, input and
output for the test cases.
-
8/3/2019 LineCnt
11/14
Document1
May 1, 2012 Page 10 of 13
Test cases:
Enter File NameShould take the filename as input.Valid FileCheck the filename whether exists or not.
Display OutputAs per filename existence output the result
Testing:
S.NO TESTCASE DESCRIPTION EXPECTED RESULTACTU
RESU1. Run the LineCount Java Program Should not give any runtime
errors.
Pass
2. On Consolemessage will display toenter the files names or directory
names
Message should show Pleaseenter a file name with the
extension or a directory
Pass
3. Enter single file name. Content of a
file will read and returns the number of
lines in a file and returns the number of
commented lines and also number of
valid lines.
Should display the name of a
file and number of lines in a
file. Also returns the number of
commented lines and total
number of valid lines.
Pass
4. Enter multiple files with a comma
separated. For each file, it will display
the file name, opens a file, reads the
content and then returns the number of
a line in a file also returns number of
commented lines and returns total
number of valid lines.
Should display the file names
and returns the count for each
file.
Pass
5. Enter a directory name which can have
multiple files. Program will read allfiles and displays the file names and
the line count for each file.
Should display the file names
and number of lines count andnumber of commented line and
also total number of valid lines.
Pass
-
8/3/2019 LineCnt
12/14
Document1
May 1, 2012 Page 11 of 13
POST MORTEM PHASE
Based on the project, I learned the process models and implementation of the
models. The project gave the experience of developing the project with the
estimated time and lines of code. The breaking down of the requirements into
design and implementing design helped me in organizing the time and work on
each project. I also learned the risk involved in the project.
The estimated time and size to complete it was 40 hours and 60 lines of code but
actual time and size is 30 hours and 94 code lines respectively. The measured time
and code lines are close
Estimated MeasuredAnalyze:
%Error
Time 40 Hours 30 Hours 10%
Size 60 LOC 101 LOC 15%
Actual Project Time and Program Size vs. Estimates
countLines Method
countLines method is a software application which will
allow user to enter a file name opens the file name and reads the number of line of
code in the file and display the filename and number of line of code in the file
specified.
A comment in JAVAbegins with either // or /*. A line comment
beginning with // ends at the end of the line. A block comment beginning with/* ends with */. A block commentmay span more than one line.
-
8/3/2019 LineCnt
13/14
Document1
May 1, 2012 Page 12 of 13
APENDICES
Time Log
Time taken in planning, requirements, and analysis and design phases are listed below:
Date Start time Stop time Elapsed time Phase Description
1/14 1:00 pm 3:30 pm 100 mins PlanningInitial
estimations
1/15 11:00 am 2:00 pm 100 mins Requirements Specification
1/16 1:00 pm 5:00 pm 185 mins DesignImplementingSpecification
1/17 9:00 am 2:00 pm 165 mins DesignImplementingSpecification
1/18 2:00 pm 4:00 pm 105 mins CodeImplementation
of Design
Components
1/19 9: 00 am 2:00 pm 150mins Code
Implementation
of Design
Components
1/21 1:00 am 3: 45 pm 115 mins Code, test
Checking and
correcting thecode
1/22 10:00 am 2:00 pm 105 mins Code, testChecking andcorrecting the
code
1/24 9:00 am 4:00 pm 165 mins TestChecked for
test cases
1/26 11:00 am 5:00 pm 150 mins TestChecked for
test cases
1/28 11.00 am 3.00 pm 100 mins TestChecked for
test cases
1/29 11.00 am 2.00 pm 95 mins Test Checked fortest cases
1/30 10.00 am 2.00 pm 115 minsPostmortem
analysisSummarizing
1/31 12.00 am 5.00 pm 105 minsPostmortem
analysisSummarizing
Time Log
-
8/3/2019 LineCnt
14/14
Document1
May 1, 2012 Page 13 of 13
Defect Log
Date Start timeStop
timeDefect type
Phase defect
was
identified
Phase
defect was
removed
Description
1/18 1:00 pm 2:00 pm Missing design Design DesignVariable
declaration
missed
1/20 2:25 pm 4:10 pm Logic Error Code Code While loop
1/23 1:25 pm 3:10 pm Logic Error Code Code Semicolonmissed
1/25 2:00 pm 2:30pm Printing error Test CodeWas printing
junk value
1/27 1.00 pm 2.30 pmMisunderstood
RequirementsTest Code
Wrong
statement
Defect Log