General Architecture Design

  • JavaScript everywhere: client side, server side and even in microcontrollers
  • FullJS applications and modules should exploit the latest javascript features, such as promises, modules, async functions, etc.
  • Applications and modules should stick to Object-Oriented and Event-Driven design
  • Use static imports for initial dependencies. In other cases, consider loading dependencies on-demand with dynamic import()
  • Use true private variables (#privateVariable) instead of other alternative solutions (such as using symbols,  using an underscore, etc.)

Error Handling

  • Synchronous implementations should throw exceptions. If an exception is unhandled by a try {} catch {} block then an error messege will be sent to the console.
  • Asynchronous implementations should provide Error objects to the function’s onerror method. if no callback is provided then an error messege will be sent to the console.
  • A specific module implementation should not mix  synchronous and asynchronous error handling approach (e.g.: a module should not throw exception on one kind of error and provide onerror method on an other type of error)
  • Getters and setters should throw exceptions to signal an error state

Portability

  • Module implementations should support all relevant runtime environments (e.g.: path module can be imported and used on browser side, server side and even in RTOS environment)
  • Module APIs should be general enough to be used on all relevant runtime environments. (e.g.: Pin module have the same API on X86, ARM, and ST microcontoller runtime environment)

Front End Design

  • A good rule of thumb is that if a part of your UI is used several times (YourSpecialButton, YourSpecialIcon), or is complex enough on its own (ConsoleView, NavigationView), it is a good candidate to be a separate WebComponent.