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 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
- 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.