Tech Standards

This page covers coding standards and best practices used in the tech department.

Always Test

Always test your code before you ask for feedback or say that you are done. When you just finished coding a feature you should assume it’s broken and buggy. You should always launch your local Minecraft server and test all aspects of the feature. You will almost always find something to correct.

The reason we bring this up is because new tech staff members usually don’t test their code enough.

Code Style

Follow the MassiveCraft code style. It’s described below by example.

You will also have to configure your IDE.

Name Positively

Double negations are harder to understand than no negations at all. With that in mind booleans should have positive names and not negative ones.

Right:

Wrong:

Name Backwards

When coding it’s often good to name things backwards. It will allow for better readability and string based sorting. Explain the the core nature first in the name rather than in the end.

This is best proven by example. Assume you have three different comparators. They compare players, awesomeness, and files. In human speech you would say that the comparator comparing players is a “Player Comparator”. But the backwards “Comparator Player” will work much better. Please note how grouping up the common words to the left improves readability, even if it mean naming backwards in some cases:

Right:

  • ComparatorPlayer
  • ComparatorAwesomeness
  • ComparatorFile

Right:

Wrong:

  • PlayerComparator
  • AwesomenessComparator
  • FileComparator

Wrong:

Beware Player NPCs

Just because something seems to be a player does not mean it actually is. It can be a player NPC. Use the method in MUtil to test this.

Continue and Return to Avoid Indentation

The more indentation the harder the source code is to read. To avoid indentation you should use the continue statement in loops and the return statement in methods.

Right:

Wrong:

Use Singletons

Use singletons when you can rather than creating new instances of the class over and over again.

Join Staff

We’re always looking for volunteers!