Pretty minimal, and merely common-sense. They are:
-
For any code file that you have written or modified,
your full name must go in a /** ... */ "header comment" at the top
of each code file (# comment for a Makefile).
The StudentID# is not requested on code
submissions---while it is required on hardcopy
submissions and exams.
-
Instructor-provided files that you do not modify may
be left as-is.
-
Any source other than instructor(s) must be acknowledged
in the header comment.
-
Lines shall fit within 150 columns, except for the occasional
jawbreaker namespace-qualified templated iterator operator application...
-
Indentation shall be consistent.
Use a 3-5 space indent.
-
Files should not contain tabs---they are non-portable.
(You can set most IDEs to convert indent tabs to 3 or 4 spaces.)
-
Long interior blocks shall have a comment on the closing "}" identifying
keyword(s) on the line with the corresponding "{".
-
Insofar as Scala has no primitive types, and as Scala/Java do not follow
the C++ conventions of reverting to lowercase to distinguish library-provided
types from user-defined ones, we can almost-uniformly follow the usual OOP
convention of: Uppercase for types, lowercase for method and variable names.
Guidelines that are not mandated:
-
The Java "camelHumpCase" convention is preferred in Scala---but there are
exceptions.
-
Braces { } highly recommended.
AOK to put opening "{" at the ends of lines, with the
closing "}" lining up with the start of that line, and to use
the "} else {" and "} else if {" convention.
[Text and KWR do this, which helps 40-line examples fit on
one screen, but can make longer dense code look crowded.]
-
Alternatively, line the braces up vertically, with lots
of blank lines outside them too.
-
No special letter-syntax is recommended to distinguish class fields from other
properties---in particular, no need to preface fields with an underscore
or use a "Hungarian" prefix or suffix "f" for fields.
(\emph{Except for:} private class arguments in Scala use initial _ .)
-
Quoting Prof. Kennedy: "Scala has MANY ways to express identical concepts. Pick one
and be consistent."
When in doubt, follow Scala's own naming
conventions, but these strike me as pretty natural and non-intrusive.