The Wizards Engine : Coding guidelines

Capitalization

(Higher has more priority)

  1. Do not use underscores!
  2. Classes: PascalCasing
  3. Public: PascalCasing
  4. Private: camelCasing

Naming

  • Namespaces: never use nouns for namespace naming (eg: World, or Engine, ...) Preferably use the -ing suffix.
  • Classes are nuons, singular
  • Methods contain a verb

Software Design

We are now using IoC for the wizards. This means:

Do not use the 'new' keyword, unless you are using it within a factory class or a factory method. The only allowed usages of new are with structures and for collections.

Use Responsibility driven design. This means that you should list each responsibility of the class above the class (documentation). There should be only one class with for each responsibility. Having a responsibility means: If some other part of the system needs this responsibily, it HAS to use that single class implementing the responsibility. If this is not possible, your design is flawed.

Unit Testing

The wizards approach to unit testing is a bit different than you would expect. You Should write tests for every feature/responsibility in your application. The reasoning is that unit tests are documenting your responsibilities. Through a unit test, you know that the responsibility exists, and how to use it. By running the test you should be able to see what the responsibility accomplishes. It is not that important that the unit tests effectively automatically 'tests' that the feature works.

The characteristics of a good set of unit tests are:

  • You should be able to see every feature/responsibility that your code implements by running the tests. 
  • Your test should serve as documentation on how to use your code
  • It should test a small part of your code. The larger the test, the more complex to understand it and thus the more complex your documentation is.