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() calls
  • 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

  • FullJS applications follows application shell (or app shell) + dynamic content model. The “shell”of the applcation is cached (the minimal HTML, JavaScript and CSS needed to display the structure and layout) and then the dynamic content is loaded for each specific page via a client-side request.
  • 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.