Code guidelines for ShapeLogic

There is nothing revolutionary about these code guidelines. This is common sense and current best practices. They are meant to establish a culture or style for ShapeLogic.

KISS, Keep it simple stupid

This is the most important principle. When trying to solve a complex problem, it is important to try to keep the code as simple as possible.

For a good description see Python culture.

TDD, Test driven development

It is best to start by writing the test class before writing the class.

When a bug is found write a new test case for it. Let the test fail, then make corrections to the code.

All classes should have a test class assigned.

Do not check code into SVN that do not pass all unit tests.

Use Javadoc

Make Javadoc for all classes and packages.

But do not make it for obvious functions or parameters.

Use loose coupling

Be very selective about using extra libraries. The complexity that an extra library introduces makes ShapeLogic harder to understand.

Also try to avoid inter package dependencies.

Be very cautious about deep object hierarchies, they introduces tight coupling, and break encapsulation.