Giter VIP home page Giter VIP logo

code-standards's Introduction

Code quality and testability guidelines

A set of JavaScript code standards for programmers at Toaster Ltd.

Objectives

Due to the nature of the work we do, we aim to achieve these qualities in all the code written at Toaster Ltd.

  • Maintainability
  • Readability
  • Testability

Maintainability

When handing over code to clients, we want to be kind to future maintainers (which in a lot of the cases, will be you. So be kind to your future self as well!). It should be simple to modify existing features, and designed in a way that reduces the friction of adding new features.

Try to take a pragmatic approach to application design, only adding features as they are needed, while making it easy to continue adding features without affecting too much of the existing codebase.

  • Assume the spec will change.
  • Agree important design choices across all developers working on the project.
  • Follow a modular and event-oriented approach to application design.
  • Keep modules and interfaces as small as possible. Follow the rule of seperation.
  • Provide an overall project documentation, including how to build, deploy, run tests along with an overview of the important code modules and how they interact with each other.
  • Try to provide special documentation for any hacks. (Add a comment to any particularly hacky code explaining how it works and why it is there.)
  • Make sure to have a one step build and deploy tool.

Readability

When writing code we should try to optimise for readability. It should be easy for any other experienced JavaScript programmer to usefully modify your code.

  • Document all non-trivial code in accordance with JSDoc/Closure standards.
  • Follow Toaster Ltd/Closure code style guidelines.

Testability

When refactoring code and adding new features, we want to have as much automated testing as possible to catch any regressions. Writing for testability also improves code quality, as your functions must produce an expectable and predictable result across many cases.

  • Write functions that have a predictible behaviour.
  • Write unit tests.

code-standards's People

Contributors

adamcbrewer avatar aychtang avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.