Characteristics of Great Engineering (Hardware, Software and Design)

 

  1. Original (not derivative)
  2. Header: Project, Purpose, Author, Date, MCU, Status, Reference, Notes, etc. (edit Bareminimum.ino sketch for consistency/productivity/efficiency gains)
  3. Formatted
  4. Modularity: highly cohesive; loosely coupled
  5. Hierarchical Design (Scalable): highly-leveraged code, threaded from global/class constants and variables, ensures a robust response to changing project task size
  6. Scope: priority for local variable declarations over global
  7. Well-named, consistent, identifiers for variables
  8. Primitive Data Types: Judiciously chosen memory sizes as per (partial) table below, all appropriately initialized

    Arduino AVR-libc (preferred) Bytes Range Comments
    void void 0 none  
    bool, boolean bool 1 false, true  
    char int8_t 1 [-128,127] ASCII Character or Signed (2's complement) 8-bit integer
    byte uint8_t 1 [0,255]  
    int, short int16_t 2 [-32768,32767]  
    unsigned int uint16_t 2 [0..65535]  
    long int32_t 4 [~2^31-1, 2^31]  
    unsigned long uint32_t 4 [0,2^32-1]  
    float float 4 [~-3.4×1038,~3.4×1038]
    double double 4 Same as float on the Arduino platform

  9. Composite Data Types used for high cohesion (arrays, structs, etc.), all appropriately initialized
  10. Efficient
  11. Application Specific Complexity (whichever is appropriate for the context): eg. high-level vs register-level or polling vs interrupts
  12. Well-documented throughout
  13. Easy to read (no attempt to be cryptic aka, show off)
  14. Keep statements lengths to the width of your IDE
  15. Any others ?

Why Everyone Should Learn to Code