software engineering
MCS 5103 - Software Engineering January 30, 2017
Software_Development_Assignment_2_201701.Docx
Page 1 of 5
Assignment:
Enhancement to Software Development Assignment #1.
ORIGINAL REQUIREMENTS: Develop a software application that will do the following:
Allow user to enter a file name, either by command line, prompt, or menu.
Open specified file. If multiple files are specified or a directory is specified (not required, but a nice optional feature), the program operates on each file in sequence.
For Each File:
“Advanced” software developers: read each line in the file into a linked-list with one line in each “node” of the list.
Count the total number of Lines of Code, “LOC”, contained in the file.
Report the name of the file.
Report the total number of LOC contained in the file.
Close the input file.
ADDITIONAL NEW/CHANGED REQUIREMENTS – Add the following functionality to a new function –
countFuncLOC();:
You MUST use one of “starter” program files provided (.c, .cpp or .java) as your basis for SD2. You will be making your
modifications for the SD2 project to another developer’s SD1 implementation. You should change the original code as little
as possible to avoid the risk of making too many changes to “working” code.
Count the Function LOC:
Count the number of LOC contained in each function in the file.
For each function in the file:
Report the name of the function.
Report the number of LOC contained in the function.
The main program performs the following operations:
Prompt the user for file name input
Open the file
Invoke the Function LOC counting function
Report of the File Name and file LOC count, each function name and the corresponding function LOC
Close the file
BOTH the Function LOC and File LOC counting functionality shall be performed by a function called “countFuncLOC”.
countFuncLOC receives a pointer to a valid open file and a pointer to a table for function data as passed parameters, and
returns the integer number of LOC in the file.
You must use the following “countFuncLOC” function prototype/definition:
int countFuncLOC (FILE *filePointer, FUNCDATA *funcDataPtr); /* C-language function prototype */
int countFuncLOC (ifstream &file, FUNCDATA *funcDataPtr); // C++ function prototype
int countFuncLOC (File file, List functionDataList) // Java method definition
int countFuncLOC (String fileName, List functionDataList) // Alternative Java method definition
countFuncLOC will “absorb” the countLOC functionality.
The Function LOC data shall be stored in a table defined in the main program and accessed by countFuncLOC() through a
pointer to the table.
All user input/output interaction functionality shall be performed by the main program; countFuncLOC shall have no direct
user interface.
The program shall be written in C, C++ or Java.
MCS 5103 - Software Engineering January 30, 2017
Software_Development_Assignment_2_201701.Docx
Page 2 of 5
SUGGESTED DATA STRUCTURES
C / C++
An appropriate “typedef” should be used to define a data type for the Function LOC data, such as:
typedef struct
{
int funcLOC;
char funcName[MAX_NAME_SIZE]; /* See note below… */
} FUNCDATA;
* Note regarding funcName[] array: it is acceptable to define a constant array size with a “reasonable” MAX
size for the function name (20 to 30 characters for a function name SHOULD be sufficient…)
IF YOU PREFER, you may use a pointer to a string in the FUNCDATA structure and use dynamic memory
allocation as needed rather than a fixed function name length.
The table for the Function LOC data can be a fixed array as follows:
FUNCDATA funcDataTable[MAX_FUNCTIONS]; /* See note below… */
* Note regarding funcDataTable[] array: it is acceptable to define a constant array size with a “reasonable”
MAX size for the number of functions in a file (10 to 20 functions in a file SHOULD be sufficient…)
IF YOU PREFER, you may use dynamic memory allocation as needed rather than a fixed data table size.
JAVA
As Java is an object oriented language, here’s one example of a data structure you might consider using to store the
“function” (method ) information:
public class FunctionData
{
String functionName = null;
int functionLOC = 0;
}
Using this object to store an individual function’s LOC, you can then use a List to store FunctionData objects as your
program encounters new functions to count the LOC for. Here’s an example:
public List<FunctionData> functionDataList = new ArrayList<FunctionDataList>();
Alternatively, you may consider using an Array “primitive” to store FunctionData object, or even a HashMap. Be sure to
change your “int countFuncLoc(File file, List funcDataList)” function call accordingly if you choose to use something other
than a List.
MCS 5103 - Software Engineering January 30, 2017
Software_Development_Assignment_2_201701.Docx
Page 3 of 5
Additional Information:
A “Line of Code”, LOC, is defined for our exercise as a non-blank, non-comment line. A line containing any printable (i.e.:
non-“white space” character such as space, tab, etc.) that is NOT in a comment is counted as LOC.
A comment in C/C++-language begins with either “//” or “/*”. A line comment beginning with “//” ends at the end of the
line. A block comment beginning with “/*” ends with “*/”.
* A block comment may begin on a line that is also counted as LOC.
* A block comment may span more than one line.
A function in C-language has the basic form:
optional_additional_modifiers function_return_type function_name (type argument, additional arguments )
{
function body
}
example:
signed int loc_counter ( file * fileptr)
{
body …
}
The first line (‘signed int loc_counter (…)’ in the example above) and opening brace (if it is on a line by itself, as in the
example above) in the function definition DO COUNT as Function LOC.
Note that the program must not mistake a function prototype as the beginning of the function itself:
function_return_type optional_additional_modifiers function_name (type argument, additional arguments );
The program is not a compiler and does not need to recognize valid lines of code in a particular programming language.
MCS 5103 - Software Engineering January 30, 2017
Software_Development_Assignment_2_201701.Docx
Page 4 of 5
Process Requirements:
BEFORE YOU BEGIN:
Estimate the TOTAL time (actual working time in hours or minutes, not “calendar” time) that it will take you to complete the project (time measured from the time you begin this estimation until you have a complete, properly
functioning program.)
Estimate the total number of lines of code (LOC) of your completed program.
USE the Project Estimates form provided in the Project Log Template to facilitate these estimates.
AS YOU WORK:
Log the ACTUAL time (actual working time, not “calendar” time) that you spend working on the project INCLUDING:
Analysis
Design
Coding
COMPILING
Testing
Project Retrospective Analysis: Any POST project analysis, wrap-up, documentation, etc.
Log any defects that you encounter as you proceed INCLUDING (but not limited to):
Incomplete, incorrect, misunderstood or missing requirements
Incorrect design or missing design
Logic errors
Typo’s and syntax errors in source code
WHEN YOU’RE DONE:
Record the ACTUAL time it took to develop the program.
Record the ACTUAL number of LOC in the program.
Analyze/Summarize your experience (“Retrospective Analysis”):
Analysis of Estimates vs. Actual (Time and LOC)
What went right
What went wrong
Writing Guidelines:
Project Reports are subject to the “LTU Banned Error List for Writing”
(http://www.ltu.edu/arts_sciences/humanities_ss_comm/writing_tools.asp#tab3) and the associated policy:
“A paper with one of the errors listed loses half a letter grade (e.g., from B to B-). Additional errors of the same
category (e.g., three sentence fragments) will not lower the grade further, but additional errors in other categories
will (one-half letter grade per category).”
Additional reference for further guidance: http://www.ltu.edu/arts_sciences/humanities_ss_comm/writing_tools.asp#tab1
MCS 5103 - Software Engineering January 30, 2017
Software_Development_Assignment_2_201701.Docx
Page 5 of 5
Deliverables: - Students are expected to submit their own original work
You MUST use the project templates provided to you on Blackboard under
“Assignments Projects Project Templates and Supporting Resources”
Project Report – use “TEMPLATE – Software Project Report”
Estimate and Actual of TOTAL time to develop the program (INCLUDING planning, preparation, documentation, debug and test, and retrospective analysis time.)
Estimate and Actual of TOTAL size (in LOC) of the program
Planning – come up with a schedule of when you will complete the various phases of this assignment
Documentation/Summary description of all associated software development process steps performed (requirements, design, test cases & results, etc.)
Project Retrospective analysis/summary
Name this file “SD2_ProjectReport_[username]”
The Report should contain references to all additional supporting documents. ALL documents submitted should contain
author identification and should indicate to what assignment they pertain.
Project Estimation, Time Logs, Defect Logs – use “TEMPLATE – Project estimation, Time Log, Defect Log”
This is where you do your time/size estimation
Track time spent in each phase
Track defects and time spent fixing them
Name this file “SD2_EstimatesTimeDefectLogs_[username]”
Testing – use “TEMPLATE – Test Use Case Scenarios and Logs”
This is where you document how you will test your code
Describe what test scenarios you will use
Record outcome of executing these tests
Name this file “SD2_TestingLogs_[username]”
Software:
Source code
Executable program (.exe, .jar)
Software Project files (example: if MS Visual Studio is used, include the ENTIRE project folder containing all project files – such as .vcxproj. Note that the project files usually contain the source code and executable in the various
subdirectories.)
[User Story: As a project reviewer, I want to be able to recompile/re-build the submitted project, so that I can
overcome run-time errors and other problems associated with incompatible versions of the development tools between
the developer’s development tools and my own, thereby allowing me to run the submitted project on my own
computer.]
Assignment Submission:
Assignment deliverables must be submitted in the appropriate “Assignments” area on Blackboard by the BEGINNING of class on the due date.
All executable programs must be in the form of .EXE, .JAR or .HTML files.
“ZIP” the collection of all files into a single file using WinZip or RAR format.
Name the ZIP file SD2_UserName.zip (or .rar) [UserName meaning your Banner UserName - example: SD2_bsweet]
Assignment Date: January 31, 2017 @ 5:45pm
Due Date: February 9, 2017 @ 5:45pm – 1.2 weeks