Assignment Marking Criteria Analysis Your analysis documentation must meet the following criteria: All program inputs, processing, and outputs. Each input and output must be given a name and description Processing should include a description and details about formulas used. Documentation should be grammatically correct with no spelling errors. Design Your activity diagrams must meet the following criteria: Must be neat and professional looking. Diagram flow must be vertical (for the most part), rather than horizontal. Symbol notation must be clear and concise following the standards set out by your instructor. Diagrams must illustrate the proper logic of the program. Standards Your code must meet the following criteria: Naming Conventions All identifiers (names) must be descriptive. Reading the name should give the person an idea of what data is for. Rules specific to each identifier type: Class Identifiers Must have the first letter of each word capitalized. public class HelloWorld Variable and Method Identifiers The first word in a name is always lowercase, all subsequent words have the first letter in uppercase. int countofitemsincustomertable; public static int getcustomercount();
Constants The entire name is in uppercase. double TAX_RATE = 4.5; Block Styles In Java, blocks of code are represented by the braces '' and ''. There are two standards: End of Line Method The '' which starts the block is placed on the end of the statement line. public static void main(string[] args) Next Line Method The '' which starts the block is placed on the line after the statement. public static void main(string[] args) The next line method is the preferred method for new programmers, as it makes keeping track of blocks much easier when the brackets are aligned. Indenting Code Not all statements start on the left side of the editor window. Code is indented, or moved to the right so related items can be kept together. Indenting code helps improve readability as it is easy to see what code belongs to what block. The rules for indenting are: Classes Class declarations are always made on the far left of the edit window in BlueJ (not indented at all). The opening brace of a class block starts in the leftmost column on a new line. All code in the class block is indented one tab (usually 3-4 spaces). The closing brace of a class is always on a line by itself in the leftmost column. public class HelloWorld // statements within the class
Method Method declarations are always indented inside the class they belong to. The opening brace is on a new line, directly under the first character of the line above. The code inside the method block is indented. The closing brace is on a new line and must align with the opening brace of this block. public class HelloWorld public static void main(string[] args) // statements within the method All Other Block Opening brace is on a new line, directly under the first character of the line above. All code in that block is indented to the right. The closing brace is on a new line, and must align with the opening brace of the block. public class HelloWorld public static void main(string[] args) int radius = 4; if (radius == 4) // statements within the block Spacing The use of whitespace (blank lines) also helps improve readability. The standards for whitespace are as follows: If the program has import statements, there are no blank lines between each one 1. import java.util.; 2. import java.awt.; A blank line (line 3) must be placed before the first Javadoc block defining the class if there are import statements. If there are none, the Javadoc block starts on the first line 1. import java.util.; 2. import java.awt.; 3. 4. /
5. Class Documentation 6. / There are no blank lines between a Javadoc comment and the class or method it defines. 1. import java.util.; 2. import java.awt.; 3. 4. / 5. Class Documentation 6. / 7. public class ClassName 8. 9. 10. Leave a blank line (line 16) before a Javadoc comment describing a method, expect if its the first method in the class. 1. import java.util.; 2. import java.awt.; 3. 4. / 5. Class Documentation 6. / 7. public class ClassName 8. 9. / 10. Method Documentation 11. / 12. public void firstmethod() 13. 14. 15. 16. 17. / 18. Method Documentation 19. / 20. public void secondmethod() 21. 22. 23. 24. If there are multiple closing braces (lines 8-9) following one another on two or more lines, then there are no blank lines between the closing braces 1. if (expression) 2. 3. for (expression) 4. 5. if (expression) 6. 7.
8. 9. 10. When commenting, make sure there is a blank line (line 3) before the comment. The blank line is not needed when the comment is the first line of a block. 1. // comment for first statement 2. statement 3. 4. // comment for second statement 5. statement When commenting, do not place any blank lines between the comment and the line of code its describing. Right way: // comment for statement statement / comment for statement / statement Wrong way: // comment for statement statement / comment for statement / statement Place a blank line (line 4) after local variable declarations before the first line of code in a method. 1. public static void main(string[] args) 2. 3. int localvariable; 4. 5. // method statements here 6. Documentation
Class Documentation Sample Each of your classes must contain documentation at the beginning of the code. The following code is the template your method documentation must follow. / ClassName: Program description. @author Your Name @version Version_number Assignment: #Assignment_number Course: ADEV-1000 Section: Section_number Date Created: Date_created Last Updated: Date_Last_updated / Example: / MarkCalculator: calculates the final mark for a single student. @author Joe Shmoe @version 1.0 Assignment: #1 Course: ADEV-1000 Section: 1 Date Created: 1.17.2012 Last Updated: 1.19.2012 / Code Commenting The code throughout your classes must be commented. The amount, format and detail of your commenting will be outlined to you by your instructor. Method Documentation Sample Each of your methods must be documented above the method signature. The following code is the template your method documentation must follow: / Description of what the method does @param parametername Description of what the parameter is used for in the method. @param...
@return Description of what the method will return to where it was invoked. / Example: / Merges two arrays into a single array. @param bottomarray Array to be added to the beginning of the new array. @param toparray Array to be added to the end of the new array. @return An array containing data from two merged arrays. / Note If the method does not have parameters defined in is signature, you will omit the @param from the documentation for the method. If the method does not return a value (void method) you will omit the @return from the documentation for the method. Testing Test Plan Provided For assignments where a test plan is provided, test plans must include the following: All tests must be completed and indicate whether they passed for failed. Failed tests must include the result and a description of why the test failed. Failed tests that are fixed, must include documentation of how they were fixed. Test Plan Created By You For assignments where the test plan is created by you, the test plan must include the following: All possible tests must be documented in the plan. All tests must be completed and indicate whether they passed for failed. Failed tests must include the result and a description of why the test failed. Failed tests that are fixed, must include documentation of how they were fixed. Execution During the execution of your program, the following criteria must be met: All classes must compile. The program must not generate a runtime error. Must meet all assignment requirements.
The assignment must produce accurate results. The program must accurately represent the sample output provided to you. Assignment Submission When submitting your assignments, you must meet the following criteria: Ensure all required files are submitted. Ensure required files are submitted in the requested format. Ensure assignments are submitted to the proper LEARN Dropbox. Assignments must be submitted by the date specified in the LEARN Dropbox. Failure to submit an assignment before this date will result in a mark of zero.