Newer
Older
labs / tiddlers / content / labs / lab01 / _Labs_01_Naming Conventions.md

The following are the naming conventions that we want you to use in {{$:/ou/parameters/Paper Code}}. The Java conventions are industry-wide conventions. The other conventions are to help you to avoid common problems with conflicting bits of software.

  • Project folders should be single-word (no spaces) and entirely lowercase.

    IDEs and build tools like Gradle often use shell commands to performs tasks on your files and shell commands can have problems with paths that contain spaces since spaces are usually treated as separators by these commands.

    We will, on occasion, use the command line to perform some actions on the project and you will have problems if your paths contain spaces.

    Also remember that Java is case-sensitive and both Windows and macOS only pretend to be case-sensitive. This can cause some weird problems, particularly when you rename folders, so the easiest way to avoid those problems is to stick to all-lower case for folder names. Linux file systems are usually case sensitive, so we can avoid a lot of weird problems by using Linux, however the network file servers that we are using are not-case sensitive, so we still have to be careful.

    Please also consider if the parent folder that you are putting your projects into contains any spaces. It doesn't matter if you are careful with your project folder names if you are storing them in a folder named <>.

    Also, try to avoid putting your project folders into folders that are managed by iCloud, or OneDrive (or any other cloud-synced folder). Cloud based file systems do the bare minimum that they can to back up your files and allow you to open them --- they are not complete files systems. Development tools like IDEs expect to get notified when a file gets updated and cloud based files systems don't do this --- lots of things break if you store your development projects in a cloud-synced folder. You will be using GitBucket for storing all of your projects in this course, so GitBucket will act as both a remote backup, and give you a way to access your files if aren't near your computer.

  • Java classes and interfaces should always start with an uppercase letter (which makes them easily distinguishable from other identifiers in your source code).

  • All other identifiers: packages, fields, variables, methods; always start with a lowercase letter.

  • Use camel case (whereTheWordsAreSeparatedLikeThis) rather than underscores for all identifiers.

    This is a standard Java convention and some libraries and tools (some of which we will be using in this course) assume that your classes will use camel case and will not work properly if you don't.