Skip to content

Intro to Coding

raisercostin edited this page Jun 26, 2017 · 18 revisions

Rules to follow when writing code:

  1. Use principles as guide in unknown territory
  2. The absolute needed libraries are:
    • junit - testing api
    • slf4j - logging api
    • logback - simple logging implementation
    • guava - google utilities
  3. Careful on exception idioms
    • Never swallow an exception. If in doubt rethrow it.
    • principle~Fail Fast
    • A logged exception at info level is always a bug.
    • The exception should give enough details to be able to investigate the problem without debugging. If the investigation lasts more than 30s you have a bug on investigation of the exception.
    • see Checked Exceptions vs Unchecked Exceptions
  4. Do not use
    • static fields
  5. Try to use
    • final fields
  6. Beans, Getters and Setters are overhyped
  • Immutable classes (do not confuse with final fields)

Table of Contents

Clone this wiki locally