Summary

MotivLabs engineers work with a variety of code and software.

The Coding Standards on this page represent how MotivLabs engineers code the services and software we write.

General Guidelines

  • Whenever possible code, solutions and applications should run in Docker. The idea is to develop directly in Docker. Running and Debugging should be happening in Docker.
  • Test Driven Development. The idea is to write a test FIRST before a class or function is created.
    • UNIT tests should cover functions/methods that make sense to UNIT test
    • Any bug found gets testing added for the case before a code fix
    • All tests are expected to work with our Continuous Integration (CI/CD)
  • Once deployed/released, API’s must be immutable
    • MotivLabs sees the importance of not breaking APIs our clients consume and code against
    • We create new versions when a breaking change would be introduced. For example version 1 API vs 2 but Version 1 is immutable from the standpoint of tests, how to call it, and how it works.
    • This is all enforced with both Integration Tests and UNIT Tests
    • All APIs need Integration Tests. Integration Tests will test the whole stack ie.. a GO REST service backed by Cassandra etc…
  • MotivLabs engineers follow strict CI/CD processes. While MotivLabs might release often as we follow an iterative approach we ensure the release follows known and expected CI/CD processes
  • Documentation
    • Code MUST be documented. A User Story should fail without proper tests and without Documentation
  • Code must conform to coding guidelines
    • Ie.. For Go, that means formatted according to gofmt and following naming conventions
  • As a general rule in Go developers should avoid singletons. Variables should be created as close to possible to being used
    • This will also help as our code is intended to be completely stateless. Singletons run the risk of storing things that require state and can lead to errors developers inadvertently make
  • Program to Interfaces. Program to Interfaces. Program to Interfaces.
  • All Repositories with REST Handlers should be tested in Postman and Documented in Postman
    • In Postman we need a Documentation Collection for every Microservice
    • This should be used to Test AND to Doc Rest End Points