General Style Guidelines
Students in CSE 390C 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. For every
subsequent assignment, students are expected to also follow the style
guidelines of all previous assignments. The provided linter on assignments
will make complaints that you don't necessarily have to fix. Always refer
to this page to see what will actually be checked for each assignment.
- Homework 8
- Homework 7
- Functions that override virtual functions should use the override keyword.
- Private members that need to be inherited by derived classes should be made protected.
- Multiple inheritance should never be used.
- Base class destructors should always be made virtual.
- Homework 6
- Thrown errors should contain helpful error messages.
- Homework 5
- Homework 4
- Operator overloads should be made non-members when possible.
- Homework 3
- Make class member functions const if they do not modify the calling object.
- Comments for structs and classes should be included and describe purpose and usage.
- Do not #include anything in the header file that is not needed for the compilation of that
header file. #includes that are just needed for the definition file should go there.
- Do not define member functions in the header file.
- Homework 2
- Use const reference parameters if the parameter is not
modified in the function.
- Comments for function definitions are not required and
should only be included to explain how the function works (implementation
details). Do not copy the function prototype comment over to the definition.
- Use header guards in header files
- User-defined #includes should come after C++ library #includes
- Do not have using directives in header files (homework 2 only)
- Homework 1
- Use proper indentation to indicate program structure.
- Follow C++ naming conventions (using camel case or underscore for
names).
- A complete program should start with commented function prototypes,
then main, then uncommented function definitions.
- Localize variables as much as possible.
- Use reference parameters only when they are required.
- Provide descriptive comments for function prototypes describing
purpose, parameters, and return value (if any).
- Return 0 from main when the program finishes successfully.