CSE 142
- index.shtml"> images/home_icon.png" class="sidebaricon" alt="main" /> Main Page
- syllabus.pdf"> images/syllabus_icon.png" class="sidebaricon" alt="syllabus" /> Syllabus
Coursework
- calendar.shtml">images/lectures_icon.png" class="sidebaricon" alt="lectures" /> Calendar handouts.shtml">images/diff_icon.png" alt="handouts" width="16" height="16" class="sidebaricon" /> Handouts -->
- homework.shtml">images/homework_icon.png" class="sidebaricon" alt="assignments" /> Assignments
- sections.shtml">images/lab_info_icon.png" class="sidebaricon" alt="sections" /> Sections
- labs.shtml">images/labs_icon.png" class="sidebaricon" alt="labs" /> Labs
- textbook.shtml">images/textbook_icon.png" class="sidebaricon" alt="textbook" /> Textbook
- working_at_home.shtml">images/working_at_home_icon.png" class="sidebaricon" alt="working at home" /> Java Software
- exams.shtml">images/exams_icon.png" class="sidebaricon" alt="exams" /> Exams python.shtml">images/python_icon.gif" class="sidebaricon" alt="python" /> Python --> jgrasp.shtml">images/jgrasp_icon.gif" class="sidebaricon" alt="jGRASP Tutorial" /> jGRASP Tutorial -->
Getting Help
- staff.shtml">images/staff_icon.png" class="sidebaricon" alt="staff" /> Course Staff
- "> images/lab_schedule_icon.png" class="sidebaricon" alt="lab schedule" /> TA IPL Schedule
- message_board.shtml">images/message_board_icon.png" class="sidebaricon" alt="message board" /> Message Board
- images/practiceit.png" class="sidebaricon" alt="icon" /> Practice-It! practicum.shtml">images/labs_icon.png" class="sidebaricon" alt="icon" /> Practicum -->
Check Scores
- ">images/myuw_icon.png" class="sidebaricon" alt="myuw" /> Canvas
- gradeit.shtml">images/gradeit_icon.png" class="sidebaricon" alt="grade-it" /> Grade Sheets
- regrade.shtml">images/survey_icon.gif" alt="regrade" width="32" height="32" class="sidebaricon" /> Regrade Policy
- /grades/gradenator.html">images/calculator_icon.png" class="sidebaricon" alt="gradenator" /> Grade Calculator
Other
-
images/cool_links_icon.png" class="sidebaricon" alt="cs cool stuff" /> CS Cool Stuff-->
- explore.shtml">images/python_icon.gif" alt="explore" class="sidebaricon" /> Exploration Sessions
- honors.shtml">images/atom.png" alt="honors" width="24" height="24" class="sidebaricon" /> Honors Seminar
- links.shtml">images/links_icon.png" class="sidebaricon" alt="links" /> Links faq.shtml">images/faq_icon.png" class="sidebaricon" alt="FAQ" /> FAQ -->
General Style Deductions
Students in CSE142 are expected to demonstrate good programming style in their programming assignment solutions. Every programming assignment will describe specific style requirements and expectations that students should keep in mind when writing their solutions. This page lists general style issues that are likely to be relevant to multiple assignments. This list includes common style mistakes but does not list every possible style mistake.
TAs provide feedback on graded programming assignments and sometimes give a "-0" warning to indicate a style issue that is not being penalized but might be in a future assignment. The list below indicates general style issues that may not be graded as "-0". Programming assignments are listed in reverse order because once a style issue is included for one programming assignment, it is included for all future assignments. The list is not meant to be exhaustive, although it includes the most common style issues. Students should not ask about the details of style grading on the message board, but can ask their TA or a TA at the IPL to explain any of these style categories.
note: in the below list, "e.g." should be read as "for example" and "i.e." should be read as "in other words"
- control structure issues:
- bad use of
if/else
(e.g., empty branch, unnecessary tests, redundant branches that can be combined with logical or)
- bad use of
- class design issues:
- initializing non-
final
data fields outside of a constructor - non-
private
data fields
- initializing non-
- method issues:
- unnecessary return from a method
- data structure issues:
- extra data structures that aren't necessary
- bad usage of arrays (e.g., funky/incorrect indexing/usage)
- no new style issues
- control structure issues:
- including code in a loop that should be executed once either before or after the loop
- method issues:
- trivial methods
- miscellaneous issues:
- unnecessarily inefficient code (e.g., constructing a new object on every iteration of a loop when it could have been constructed once before the loop or including an unnecessary test in a conditional)
- using
\t
instead of individual spaces to align output
- commenting issues:
- method header does not describe the action/behavior of the method
- method header does not describe the purpose of each parameter or
does not describe the meaning of the return value of a non-
void
method
- readability issues:
- lines over 100 characters
- nondescriptive variable names
- control structure issues:
- using incorrect
if/else
structure - failing to factor out redundant code in
if/else
structures
- using incorrect
- method issues:
- do-all methods (i.e. methods that contain most or all of the work that should be done in
main
)
- do-all methods (i.e. methods that contain most or all of the work that should be done in
- miscellaneous issues:
- incorrect use of type (e.g.,
double
instead ofint
,int
instead ofboolean
,String
instead ofchar
for a value known to be exactly one character) - using
\n
withprint/println
or to produce more than one line of output with a singleprintf
- not combining
print/print
orprint/println
statements when possible - using
print/println/printf
with the empty string (""
) - constructing more than one
Scanner
for console input
- incorrect use of type (e.g.,
- readability issues:
- not following Java naming conventions (e.g., not using camel case, not using uppercase letters and word-separating underscores for constants)
- not including a blank line between methods
- long lines
- method issues:
- unused parameters or passing a constant as a parameter
- readability issues:
- method header comment missing or does not adequately describe what the method does
- bad indentation
- control structure issues:
- bad use of loops (e.g., 1 to 1 loops, including an unnecessary check before a loop that repeats the loop test)
- method issues:
- nondescriptive method names
- class design issues:
- incorrect constant declaration (e.g., not
final
, notstatic
)
- incorrect constant declaration (e.g., not
- commenting issues:
- class header missing or doesn't describe both student and program
- readability issues:
- no indentation
- miscellaneous issues:
- use of
\n
or advanced material (see below)
- use of
- In general, once a class has been discussed, it is available for use by students. (For example, once the String class is introduced, you may assume that you can call any of the available String methods in future programming assignments without asking permission.)
-
Unless otherwise specified, language features should not be used before they
have been introduced in lecture (e.g. you should not use
if
statements in any assignment until you have seen them in class). - Students should realize, however, that saying that you are not forbidden from using a certain construct is not the same thing as saying that it is a good idea to use a certain construct. We generally don't give advice to students about which constructs to use; you should use your best judgment to decide. (Though if a particular assignment states that you are required to use a construct, you should do so.) In addition, there are some constructs that you are NEVER allowed to use, as described below.
-
Java has grown to be a complex language with many features, and we don't have
time to teach all of these features in CSE142. We have a general rule that
students should not use "advanced" material that we have not covered in
class. In addition, we have identified several Java features that we do not
want students to use at all. It is not bad style to use these features, but we want
to have a level playing field for all students. Since we don't teach these features
in the class, we do not allow them to be used to avoid giving an advantage to students
who have learned about the features on their own.
The following features should NEVER be used in a CSE142 programming assignment or exam solution (unless otherwise specified by the assignment or problem):
break
,continue
, orreturn
from a void method- the
System.exit
method - the
switch
statement try/catch
- annotations
- the
<>
operator - the
var
keyword - Java 8 functional features (e.g., lambdas, streams, method references)
- the
toCharArray
,join
, andmatches
methods ofString
- the
StringBuilder
,StringBuffer
,StringJoiner
,StringTokenizer
classes - the methods
Arrays.fill
,Arrays.asList
,Arrays.copyOf
,Arrays.copyOfRange
, andArrays.sort
- multi-dimensional arrays
- the
toArray
andclone
methods ofArrayList
- the methods
Collections.copy
andCollections.sort
(Don't worry if you are not familiar with one of the features listed above. You can simply think of these as Java features we have chosen not to teach in this class so that we can focus on other important concepts instead.)