General Style Deductions

Students in CSE143X are expected to demonstrate good programming style in their homework solutions. Every homework 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 homework assignments and often 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 will not be graded as "-0". Homework assignments are listed in reverse order because once a style issue is included for one homework, it is included for all future homeworks. 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 one of the TAs to explain any of these style categories.

  • Homework 1: Critters
    • commenting errors:
      • class header missing or doesn't describe both student and program
    • readability errors:
      • lines over 100 characters
      • not following Java naming conventions (e.g., not using camel case, not using uppercase letters and word-separating underscores for constants)
      • method header missing or does not adequately describe what the method does
      • inconsistent or nonexistent spacing within expressions (we suggest one space on either side of an operator)
      • bad indentation
      • some method or constructor does not have a blank line before it
    • control structure errors:
      • bad use of if/else (e.g., empty branch, unnecessary tests, redundant branches that can be combined with logical or)
      • bad use of loops (e.g., 1 to 1 loops, including an unnecessary check before a loop that repeats the loop test)
    • method errors:
      • unused parameters or return value or passing a constant as a parameter
      • calling an inappropriate version of a method when a better alternative exists (e.g., calling System.out.println("") instead of System.out.println())
    • class design errors:
  • note: "e.g." should be read as "for example" and "i.e." should be read as "in other words"

    In general, once a class has been discussed, it is available for use by students. For example, the String class and the Arrays class were covered in the CSE142 course, so it is reasonable to assume that you can use most methods from those classes without asking permission. Student 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 don't give advice to students about which constructs to use. You have to use your best judgement to decide and you might lose style points if you make a poor choice. In addition, there are some constructs that you are not allowed to use, as described in the next paragraph.

    Java has grown to be a complex language with many features. We don't have time to teach all of these features in CSE143. 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. It is not bad style to use these features, but we want to have a level playing field for all students. For any one of these features, we prefer that either everyone in the class knows about it and can use it or nobody is allowed to use it. The following features should not be used in CSE143 homework or exam solutions:


    Many students find themselves wondering, "What is that feature you are describing?" If you don't recognize it, then you're unlikely to use it, so the best answer is, "Something that we have decided not to teach you in this class so that we will be able to focus on the really important concepts you need to learn."